[OpenSIPS-Users] Help with is_present_hf

Tyler Merritt tyler at fonality.com
Mon Feb 7 15:02:17 CET 2011


Using Opensips 1.6 ->

Can anyone tell me what I'm doing wrong here?

if (is_present_hf("P-Called-Party-Id")) {
                         append_hf("GW: EPSILON\r\n");
                         $avp(oriUri) =
$(hdr(P-Called-Party-Id){s.substr,5,12});
                         xlog("L_INFO", "Reply user now equals $avp(oriUri)
from P-Called-Party-Id");
  }


Here is the packet that should hit this block:

E..... at ...u.................INVITE sip:NUMBER at HOST:5060 SIP/2.0
Via: SIP/2.0/UDP REMOTEHOST:5060;branch=z9hG4bKbkr26a0010bgsbs5b640.1
Max-Forwards: 66
From: "NUMBER" <sip:NUMBER at HOST>;tag=SDd4l3002-as19e30264
To: <sip:NUMBER at HOST>
Contact: <sip:NUMBER at HOST:5060;transport=udp>;nat=yes
CSeq: 103 INVITE
P-Called-Party-Id: <sip:NUMBER at HOST:5060>
Allow: INVITE, ACK, CANCEL, BYE

As you can see - there is definitely a P-Called-Party-Id...

The daemon.log actually shows the avp being set:

/usr/sbin/opensips[13365]: Reply user now equals NUMBER from
P-Called-Party-Id

That's the only place in my config where I'm setting the $avp at all.

And yet - I've added a bunch of header fields that help me watch where a
packet routes through the code:

GW: ALPHA
GW: CHARLIE
GW: NOVEMBER
GW: SIERRA
GW: TANGO
GW: WILCO
GW: XRAY
GW: ZULU


The header "GW: EPSILON" should be added if the packet were routed through
that block of code - and it's not...

I don't get it.  The functionality that I'm aiming for isn't working
(resetting the outbound Contact to the inbound URI of the original request -
but there's an Asterisk box in the way so it's the same as referencing two
requests prior).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20110207/2988c8e3/attachment.htm>


More information about the Users mailing list