Jeff,<div><br></div><div>Yeah xlog shows the avp being set - and I figured out why the call wasn't looping through that piece of code. </div><div><br></div><div>I'm sorry that I didn't mention I had created the $avp(oriUri) alias higher up in the code but didn't paste it. It's aliased to an integer value.</div>
<div><br></div><div>Oddly - all of my append_hf("BLAH") are called without saying where to insert them after - and they all get inserted after Allow by default:</div><div><br></div><div><div>Allow: INVITE, ACK, CANCEL, BYE</div>
<div>GW: ALPHA</div><div>GW: CHARLIE</div><div>GW: EPSILONEPSILON</div><div>GW: NOVEMBER</div><div>GW: SIERRA</div><div>GW: TANGO</div><div>GW: WILCO</div><div>GW: XRAY</div><div>GW: ZULU</div></div><div><br></div><div><br>
</div><div>That's without specifying the header. This is default behavior I just stumbled on - I would have expected them to be added at the top of the packet as well.</div><div><br><br><div class="gmail_quote">On Tue, Feb 8, 2011 at 2:59 AM, Jeff Pyle <span dir="ltr"><<a href="mailto:jpyle@fidelityvoice.com">jpyle@fidelityvoice.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Dave,<br>
<br>
Nah. We use a mix of P- and X- headers with no problem.<br>
<br>
<br>
Tyler,<br>
<br>
I have a similar requirement where I need to pull the user from a<br>
P-Charge-Info field. I use:<br>
<br>
if (is_present_hf("P-Charge-Info")) {<br>
...<br>
$var(whatever) = $(hdr(P-Charge-Info){uri.user});<br>
...<br>
}<br>
<br>
This works pretty well. I should pull the NUMBER out of<br>
"P-Called-Party-Id: <sip:NUMBER@HOST:5060>" for you; just don't forget to<br>
change it to P-Called-Party-Id.<br>
<br>
Elsewhere in the script we use {uri.domain} with equal success to pull<br>
what you've shown as HOST. No problems there either.<br>
<br>
Does the xlog statement show anything at all?<br>
<br>
An append_hf statement without a second parameter will put the header at<br>
the very top. I know I've missed it there a time or three. I find it<br>
easier to deal with visually if I put it around the Contact header.<br>
Something like:<br>
append_hf("GW: EPSILON\r\n", "Contact");<br>
<br>
Another thing I noticed is $avp(oriUri). You may want to try<br>
$avp(s:oriUri) instead. Perhaps it's changed recently, but it at least<br>
used to be you had to identify AVPs with a s:string or i:integer (i.e.<br>
I:19).<br>
<font color="#888888"><br>
<br>
- Jeff<br>
</font><div><div></div><div class="h5"><br>
<br>
<br>
On 2/7/11 12:48 PM, "Dave Singer" <<a href="mailto:dave.singer@wideideas.com">dave.singer@wideideas.com</a>> wrote:<br>
<br>
>Tyler,<br>
><br>
>Not sure but I believe custom headers are supposed to start with "X-"<br>
>and it may be that opensips is rejecting putting it in because it is<br>
>not a standard SIP header and it does not start with "X-".<br>
>Turning up the debug would probably show why.<br>
><br>
>Dave<br>
><br>
>On Mon, Feb 7, 2011 at 6:02 AM, Tyler Merritt <<a href="mailto:tyler@fonality.com">tyler@fonality.com</a>> wrote:<br>
>> Using Opensips 1.6 -><br>
>> Can anyone tell me what I'm doing wrong here?<br>
>> if (is_present_hf("P-Called-Party-Id")) {<br>
>> append_hf("GW: EPSILON\r\n");<br>
>> $avp(oriUri) =<br>
>> $(hdr(P-Called-Party-Id){s.substr,5,12});<br>
>> xlog("L_INFO", "Reply user now equals<br>
>>$avp(oriUri)<br>
>> from P-Called-Party-Id");<br>
>> }<br>
>><br>
>> Here is the packet that should hit this block:<br>
>> E.....@...u.................INVITE sip:NUMBER@HOST:5060 SIP/2.0<br>
>> Via: SIP/2.0/UDP REMOTEHOST:5060;branch=z9hG4bKbkr26a0010bgsbs5b640.1<br>
>> Max-Forwards: 66<br>
>> From: "NUMBER" <sip:NUMBER@HOST>;tag=SDd4l3002-as19e30264<br>
>> To: <sip:NUMBER@HOST><br>
>> Contact: <sip:NUMBER@HOST:5060;transport=udp>;nat=yes<br>
>> CSeq: 103 INVITE<br>
>> P-Called-Party-Id: <sip:NUMBER@HOST:5060><br>
>> Allow: INVITE, ACK, CANCEL, BYE<br>
>> As you can see - there is definitely a P-Called-Party-Id...<br>
>> The daemon.log actually shows the avp being set:<br>
>> /usr/sbin/opensips[13365]: Reply user now equals NUMBER from<br>
>> P-Called-Party-Id<br>
>> That's the only place in my config where I'm setting the $avp at all.<br>
>> And yet - I've added a bunch of header fields that help me watch where a<br>
>> packet routes through the code:<br>
>> GW: ALPHA<br>
>> GW: CHARLIE<br>
>> GW: NOVEMBER<br>
>> GW: SIERRA<br>
>> GW: TANGO<br>
>> GW: WILCO<br>
>> GW: XRAY<br>
>> GW: ZULU<br>
>><br>
>> The header "GW: EPSILON" should be added if the packet were routed<br>
>>through<br>
>> that block of code - and it's not...<br>
>> I don't get it. The functionality that I'm aiming for isn't working<br>
>> (resetting the outbound Contact to the inbound URI of the original<br>
>>request -<br>
>> but there's an Asterisk box in the way so it's the same as referencing<br>
>>two<br>
>> requests prior).<br>
>><br>
>> _______________________________________________<br>
>> Users mailing list<br>
>> <a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a><br>
>> <a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
>><br>
>><br>
><br>
>_______________________________________________<br>
>Users mailing list<br>
><a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a><br>
><a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
<br>
</div></div></blockquote></div><br></div>