[OpenSIPS-Devel] uri->host.s problem when using parse_from_uri
Alejandro Rios P.
alerios at debian.org
Thu Apr 14 00:57:19 CEST 2011
Hi All,
I've been playing a little bit with the source code of 'closeddial' module
(v1.6.2), and I'm having an issue with the 'parse_from_uri' function:
1. First, there is call to parse_from_uri:
if ( (from_uri = parse_from_uri(_msg ))==NULL ) {
LM_ERR("Failed to parse FROM header\n");
return -1;
}
2. Then, it is used to extract the username and build the query (which works
well):
/* username=? */
valsToMatch[0].type=DB_STR;
valsToMatch[0].nul=0;
valsToMatch[0].val.str_val.s=
from_uri->user.s;
valsToMatch[0].val.str_val.len=from_uri->user.len;
3. Then, I'm trying to use the 'host' part:
if(use_domain > 0) {
/* ... and domain= ... */
colsToCompare[1]=&domain_column;
/* domain as taken from host in from_uri */
valsToMatch[1].type=DB_STR;
valsToMatch[1].nul=0;
valsToMatch[1].val.str_val.s=from_uri->host.s;
valsToMatch[1].val.str_val.len=from_uri->host.len;
LM_DBG("Comparing domain %s\n", from_uri->host.s);
}
4. But when running using debug, I'm getting not only the host part, but
everything else in the rest of the message:
Comparing domain 8.14.80.37:5061>;tag=as2e46cb60^M To: <
sip:56000 at 8.14.80.16:5061>^M Contact: <sip:55000 at 8.14.80.37:5061>^M Call-ID:
6fca172e2507a3e8720d95ae06e9a398 at 8.14.80.37^M CSeq: 102 INVITE^M User-Agent:
Livevox SBC 1.6.1^M Date: Wed, 13 Apr 2011 21:36:35 GMT^M Session-Expires:
1800^M Min-SE: 90^M Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER,
SUBSCRIBE, NOTIFY, INFO^M Supported: replaces, timer^M Content-Type:
application/sdp^M Content-Length: 254^M ^M v=0^M o=root 131658240 131658240
IN IP4 8.14.80.37^M s=Livevox SBC 1.6.1^M c=IN IP4 8.14.80.37^M t=0 0^M
m=audio 15762 RTP/AVP 0 101^M a=rtpmap:0 PCMU/8000^M a=rtpmap:101
telephone-event/8000^M a=fmtp:101 0-16^M a=silenceSupp:off - - - -^M
a=ptime:20^M a=sendrecv
So, Is 'from_uri->host.s' wrong, or how can I reference only the from domain
of the request?
Thanks in advance,
Alejandro Rios
DISCLAIMER: The opinions expressed are my own, and not necessarily those of
my employer.
<http://www.avatar.com.co>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/devel/attachments/20110413/6851d806/attachment.htm>
More information about the Devel
mailing list