diff --git a/modules/ims_registrar_scscf/reply.c b/modules/ims_registrar_scscf/reply.c index 17022da3f22..5847e7a71ad 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 (inewcontacts[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++; }