Module: sip-router
Branch: master
Commit: af1734cea213b2a07c9d725fff158cd4899725d1
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=af1734c…
Author: Carsten Bock <carsten(a)ng-voice.com>
Committer: Carsten Bock <carsten(a)ng-voice.com>
Date: Wed Dec 11 13:47:57 2013 +0100
lib/ims: Replaced custom getter for P-Asserted-Identity with the Parser from Core
---
lib/ims/ims_getters.c | 45 +++++++--------------------------------------
1 files changed, 7 insertions(+), 38 deletions(-)
diff --git a/lib/ims/ims_getters.c b/lib/ims/ims_getters.c
index 8fce196..a41cd31 100644
--- a/lib/ims/ims_getters.c
+++ b/lib/ims/ims_getters.c
@@ -56,6 +56,7 @@
#include "../../parser/parse_from.h"
#include "../../parser/parse_content.h"
#include "ims_getters.h"
+#include "../../parser/parse_ppi_pai.h"
/**
@@ -389,45 +390,13 @@ str s_asserted_identity={"P-Asserted-Identity",19};
*/
str cscf_get_asserted_identity(struct sip_msg *msg)
{
- name_addr_t id;
- struct hdr_field *h;
- rr_t *r;
- memset(&id,0,sizeof(name_addr_t));
- if (!msg) return id.uri;
- if (parse_headers(msg, HDR_EOH_F, 0)<0) {
- return id.uri;
- }
- h = msg->headers;
- while(h)
- {
- if (h->name.len == s_asserted_identity.len &&
- strncasecmp(h->name.s,s_asserted_identity.s,s_asserted_identity.len)==0)
- {
- if (parse_rr(h)<0){
- //This might be an old client
- LM_CRIT("WARN:cscf_get_asserted_identity: P-Asserted-Identity header must
contain a Nameaddr!!! Fix the client!\n");
- id.name.s = h->body.s;
- id.name.len = 0;
- id.len = h->body.len;
- id.uri = h->body;
- while(id.uri.len && (id.uri.s[0]==' ' || id.uri.s[0]=='\t' ||
id.uri.s[0]=='<')){
- id.uri.s = id.uri.s+1;
- id.uri.len --;
- }
- while(id.uri.len && (id.uri.s[id.uri.len-1]==' ' ||
id.uri.s[id.uri.len-1]=='\t' || id.uri.s[id.uri.len-1]=='>')){
- id.uri.len--;
- }
- return id.uri;
- }
- r = (rr_t*) h->parsed;
- id = r->nameaddr;
- free_rr(&r);
- h->parsed=r;
- return id.uri;
- }
- h = h->next;
+ str uri = {0,0};
+ if (!msg) return uri;
+ if((parse_pai_header(msg) == 0) && (msg->pai) &&
(msg->pai->parsed)) {
+ to_body_t *pai = get_pai(msg)->id;
+ return pai->uri;
}
- return id.uri;
+ return uri;
}
static str phone_context_s={";phone-context=",15};