Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rtpengine: Delete flags & delete handling improvement #1103

Closed
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
35 changes: 19 additions & 16 deletions src/modules/rtpengine/rtpengine.c
Expand Up @@ -114,7 +114,7 @@ enum {
#define CPORT "22222"

struct ng_flags_parse {
int via, to, packetize, transport;
int via, to, packetize, transport, c_id, from;
bencode_item_t *dict, *flags, *direction, *replace, *rtcp_mux;
};

Expand Down Expand Up @@ -1784,9 +1784,7 @@ static int parse_flags(struct ng_flags_parse *ng_flags, struct sip_msg *msg, enu
case 6:
if (str_eq(&key, "to-tag")) {
ng_flags->to = 1;
if (val.s && val.len > 0)
bencode_dictionary_str_add_str(ng_flags->dict,&key,&val);
goto next;
goto generic;
}
break;

Expand All @@ -1795,6 +1793,11 @@ static int parse_flags(struct ng_flags_parse *ng_flags, struct sip_msg *msg, enu
ng_flags->transport = 0x100;
goto next;
}

if(str_eq(&key, "call-id")){
ng_flags->c_id = 1;
goto generic;
}
break;

case 8:
Expand All @@ -1807,6 +1810,11 @@ static int parse_flags(struct ng_flags_parse *ng_flags, struct sip_msg *msg, enu
else
goto generic;
goto next;

if (str_eq(&key, "from-tag")) {
ng_flags->from = 1;
goto generic;
}
break;

case 9:
Expand Down Expand Up @@ -1969,14 +1977,10 @@ static bencode_item_t *rtpp_function_call(bencode_buffer_t *bencbuf, struct sip_
transports[ng_flags.transport & 0x003]);
if (ng_flags.rtcp_mux && ng_flags.rtcp_mux->child)
bencode_dictionary_add(ng_flags.dict, "rtcp-mux", ng_flags.rtcp_mux);

temp.s = NULL;
if (!bencode_dictionary_get_str(ng_flags.dict, "call-id", &temp))
bencode_dictionary_add_str(ng_flags.dict, "call-id", &callid);
else if (temp.s) {
LM_NOTICE("using call-id from command flags: %.*s\n",temp.len,temp.s);
}

if(ng_flags.c_id)
bencode_dictionary_add_str(ng_flags.dict, "call-id", &callid);

if (ng_flags.via) {
if (ng_flags.via == 1 || ng_flags.via == 2)
ret = get_via_branch(msg, ng_flags.via, &viabranch);
Expand All @@ -2003,11 +2007,10 @@ static bencode_item_t *rtpp_function_call(bencode_buffer_t *bencbuf, struct sip_
|| (msg->first_line.type == SIP_REPLY && op == OP_DELETE)
|| (msg->first_line.type == SIP_REPLY && op == OP_ANSWER))
{
if (!bencode_dictionary_get_str(ng_flags.dict, "from-tag", &temp_fromtag))
if (ng_flags.from)
bencode_dictionary_add_str(ng_flags.dict, "from-tag", &from_tag);
if (ng_flags.to )
if (!bencode_dictionary_get_str(ng_flags.dict,"to-tag",&temp_totag) && to_tag.s && to_tag.len)
bencode_dictionary_add_str(ng_flags.dict, "to-tag", &to_tag);
if (ng_flags.to && to_tag.s && to_tag.len)
bencode_dictionary_add_str(ng_flags.dict, "to-tag", &to_tag);

}
else {
Expand Down Expand Up @@ -3182,4 +3185,4 @@ static sr_kemi_t sr_kemi_rtpengine_exports[] = {
int mod_register(char *path, int *dlflags, void *p1, void *p2) {
sr_kemi_modules_add(sr_kemi_rtpengine_exports);
return 0;
}
}