|
@@ -211,8 +211,13 @@ static int *rtpp_socks = 0;
|
|
|
static int setid_avp_type;
|
|
|
static int_str setid_avp;
|
|
|
|
|
|
+static str write_sdp_pvar_str = {NULL, 0};
|
|
|
+static pv_spec_t* write_sdp_pvar = NULL;
|
|
|
+
|
|
|
+
|
|
|
char* force_send_ip_str="";
|
|
|
|
|
|
+
|
|
|
typedef struct rtpp_set_link {
|
|
|
struct rtpp_set *rset;
|
|
|
pv_spec_t *rpv;
|
|
@@ -282,6 +287,7 @@ static param_export_t params[] = {
|
|
|
{"setid_avp", PARAM_STRING, &setid_avp_param },
|
|
|
{"force_send_interface", PARAM_STRING, &force_send_ip_str },
|
|
|
{"rtp_inst_pvar", PARAM_STR, &rtp_inst_pv_param },
|
|
|
+ {"write_sdp_pv", PARAM_STR, &write_sdp_pvar_str },
|
|
|
{0, 0, 0}
|
|
|
};
|
|
|
|
|
@@ -853,6 +859,16 @@ mod_init(void)
|
|
|
setid_avp_type = avp_flags;
|
|
|
}
|
|
|
|
|
|
+ if (write_sdp_pvar_str.len > 0) {
|
|
|
+ write_sdp_pvar = pv_cache_get(&write_sdp_pvar_str);
|
|
|
+ if (write_sdp_pvar == NULL
|
|
|
+ || (write_sdp_pvar->type != PVT_AVP && write_sdp_pvar->type != PVT_SCRIPTVAR) ) {
|
|
|
+ LM_ERR("write_sdp_pv: not a valid AVP or VAR definition <%.*s>\n",
|
|
|
+ write_sdp_pvar_str.len, write_sdp_pvar_str.s);
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if (rtpp_strings)
|
|
|
pkg_free(rtpp_strings);
|
|
|
|
|
@@ -1962,6 +1978,7 @@ rtpengine_offer_answer(struct sip_msg *msg, const char *flags, int op, int more)
|
|
|
bencode_item_t *dict;
|
|
|
str body, newbody;
|
|
|
struct lump *anchor;
|
|
|
+ pv_value_t pv_val;
|
|
|
|
|
|
dict = rtpp_function_call_ok(&bencbuf, msg, op, flags, &body);
|
|
|
if (!dict)
|
|
@@ -1978,14 +1995,28 @@ rtpengine_offer_answer(struct sip_msg *msg, const char *flags, int op, int more)
|
|
|
if (more)
|
|
|
body_intermediate = newbody;
|
|
|
else {
|
|
|
- anchor = del_lump(msg, body.s - msg->buf, body.len, 0);
|
|
|
- if (!anchor) {
|
|
|
- LM_ERR("del_lump failed\n");
|
|
|
- goto error_free;
|
|
|
- }
|
|
|
- if (!insert_new_lump_after(anchor, newbody.s, newbody.len, 0)) {
|
|
|
- LM_ERR("insert_new_lump_after failed\n");
|
|
|
- goto error_free;
|
|
|
+ if (write_sdp_pvar!= NULL) {
|
|
|
+ pv_val.rs = newbody;
|
|
|
+ pv_val.flags = PV_VAL_STR;
|
|
|
+
|
|
|
+ if (write_sdp_pvar->setf(msg,&write_sdp_pvar->pvp, (int)EQ_T, &pv_val) < 0)
|
|
|
+ {
|
|
|
+ LM_ERR("error setting pvar <%.*s>\n", write_sdp_pvar_str.len, write_sdp_pvar_str.s);
|
|
|
+ goto error_free;
|
|
|
+ }
|
|
|
+
|
|
|
+ pkg_free(newbody.s);
|
|
|
+
|
|
|
+ } else {
|
|
|
+ anchor = del_lump(msg, body.s - msg->buf, body.len, 0);
|
|
|
+ if (!anchor) {
|
|
|
+ LM_ERR("del_lump failed\n");
|
|
|
+ goto error_free;
|
|
|
+ }
|
|
|
+ if (!insert_new_lump_after(anchor, newbody.s, newbody.len, 0)) {
|
|
|
+ LM_ERR("insert_new_lump_after failed\n");
|
|
|
+ goto error_free;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|