Module: kamailio Branch: master Commit: 89382ad9ced840c0e4822cc0c5af6397aa6e1468 URL: https://github.com/kamailio/kamailio/commit/89382ad9ced840c0e4822cc0c5af6397...
Author: jaybeepee jason.penton@gmail.com Committer: jaybeepee jason.penton@gmail.com Date: 2015-05-28T17:49:30+02:00
modules/ims_registrar_scscf: on save send back contact params in 200OK - this is required to tell VoLTE phones what capabilities have been accepted by IMS - TODO: nice to have a black/whitelist
---
Modified: modules/ims_registrar_scscf/reply.c
---
Diff: https://github.com/kamailio/kamailio/commit/89382ad9ced840c0e4822cc0c5af6397... Patch: https://github.com/kamailio/kamailio/commit/89382ad9ced840c0e4822cc0c5af6397...
---
diff --git a/modules/ims_registrar_scscf/reply.c b/modules/ims_registrar_scscf/reply.c index 17022da..5847e7a 100644 --- a/modules/ims_registrar_scscf/reply.c +++ b/modules/ims_registrar_scscf/reply.c @@ -93,6 +93,7 @@ static inline unsigned int calc_buf_len(impurecord_t* impurec) { int qlen; int i=0; ucontact_t* c; + param_t *tmp;
len = 0; while (i<MAX_CONTACTS_PER_IMPU && (c=impurec->newcontacts[i])) { @@ -111,6 +112,27 @@ static inline unsigned int calc_buf_len(impurecord_t* impurec) { + 1 /* dquote */ ; } + tmp = c->params; + while (tmp) { + if ((tmp->name.s[0] == 'R' || tmp->name.s[0]=='r') && tmp->name.len == 8 && !memcmp(tmp->name.s+1, "eceived", 7)) { + tmp = tmp->next; + continue; + } + if ((tmp->name.s[0] == 'Q' || tmp->name.s[0]=='q') && tmp->name.len == 1) { + tmp = tmp->next; + continue; + } + if ((tmp->name.s[0] == 'E' || tmp->name.s[0] == 'e') && tmp->name.len == 7 && !memcmp(tmp->name.s + 1, "xpires", 6)) { + tmp = tmp->next; + continue; + } + len += tmp->name.len; + if (tmp->body.len > 0) { + len = len + 1/*=*/ + 2/*2 x "*/; + len += tmp->body.len; + } + tmp=tmp->next; + } } i++; } @@ -401,6 +423,7 @@ int build_contact(impurecord_t* impurec, contact_for_header_t** contact_header) char *p, *cp; int fl, len; ucontact_t* c; + param_t* tmp; *contact_header = 0; int i=0;
@@ -460,6 +483,34 @@ int build_contact(impurecord_t* impurec, contact_for_header_t** contact_header) p += c->received.len; *p++ = '"'; } + + /* put in the rest of the params except Q and received */ + tmp = c->params; + while (tmp) { + if ((tmp->name.s[0] == 'R' || tmp->name.s[0]=='r') && tmp->name.len == 8 && !memcmp(tmp->name.s+1, "eceived", 7)) { + tmp = tmp->next; + continue; + } + if ((tmp->name.s[0] == 'Q' || tmp->name.s[0]=='q') && tmp->name.len == 1) { + tmp = tmp->next; + continue; + } + if ((tmp->name.s[0] == 'E' || tmp->name.s[0]=='e') && tmp->name.len == 7 && !memcmp(tmp->name.s+1, "xpires", 6)) { + tmp = tmp->next; + continue; + } + *p++ = ';'; + memcpy(p, tmp->name.s, tmp->name.len); + p += tmp->name.len; + if (tmp->body.len > 0) { + *p++ = '='; + *p++ = '"'; + memcpy(p, tmp->body.s, tmp->body.len); + p += tmp->body.len; + *p++ = '"'; + } + tmp = tmp->next; + } } i++; }