[sr-dev] git:master:cf0964f0: pv: $msg(fpart) - return first line and the headers

Daniel-Constantin Mierla miconda at gmail.com
Wed Aug 8 09:32:28 CEST 2018


Module: kamailio
Branch: master
Commit: cf0964f0246c29366788c011dfddc09b2ab3bf33
URL: https://github.com/kamailio/kamailio/commit/cf0964f0246c29366788c011dfddc09b2ab3bf33

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2018-08-08T09:31:17+02:00

pv: $msg(fpart) - return first line and the headers

---

Modified: src/modules/pv/pv_core.c

---

Diff:  https://github.com/kamailio/kamailio/commit/cf0964f0246c29366788c011dfddc09b2ab3bf33.diff
Patch: https://github.com/kamailio/kamailio/commit/cf0964f0246c29366788c011dfddc09b2ab3bf33.patch

---

diff --git a/src/modules/pv/pv_core.c b/src/modules/pv/pv_core.c
index 5aedfd8a8d..7911d75bc7 100644
--- a/src/modules/pv/pv_core.c
+++ b/src/modules/pv/pv_core.c
@@ -3465,6 +3465,8 @@ int pv_parse_msg_attrs_name(pv_spec_p sp, str *in)
 		case 5:
 			if(strncmp(in->s, "fline", 5)==0)
 				sp->pvp.pvn.u.isname.name.n = 4;
+			else if(strncmp(in->s, "fpart", 5)==0)
+				sp->pvp.pvn.u.isname.name.n = 7;
 			else goto error;
 		break;
 		case 8:
@@ -3547,6 +3549,14 @@ int pv_get_msg_attrs(sip_msg_t *msg, pv_param_t *param, pv_value_t *res)
 			}
 			return pv_get_sintval(msg, param, res, n);
 
+		case 7: /* first part - first line + headers */
+			if(msg->unparsed==NULL)
+				return pv_get_null(msg, param, res);
+			s.s = msg->buf;
+			s.len = msg->unparsed - s.s;
+			trim(&s);
+			return pv_get_strval(msg, param, res, &s);
+
 		default:
 			return pv_get_null(msg, param, res);
 	}




More information about the sr-dev mailing list