It's not really standards compliant, but you can do it. I'm not sure why you want to take stuff out of the contact header and stick it in from. From shouldn't ever be changed, if you can help it. If your really trying to change the resultant display name (ie: caller id) then go for manipulating / adding RPID headers instead.<div>
<br class="webkit-block-placeholder"></div><div><a href="http://www.opensips.org/html/docs/modules/1.4.x/auth.html#append-rpid-hf-no-params">http://www.opensips.org/html/docs/modules/1.4.x/auth.html#append-rpid-hf-no-params</a><br class="webkit-block-placeholder">
</div><div><br class="webkit-block-placeholder"></div><div>I've had to rewrite "From" headers because non-compliant carriers have insisted on using data in the from header for E911 call routing.. idiots.. :P</div>
<div><br></div><div>If you insist on changing the From header; this may help.. you won't be able to do it the way you are presently trying..</div><div><br class="webkit-block-placeholder"></div><div>take a look here:</div>
<div><a href="http://www.opensips.org/index.php?n=Resources.DocsTipsFaqs">http://www.opensips.org/index.php?n=Resources.DocsTipsFaqs</a></div><div><br class="webkit-block-placeholder"></div><div>and here:</div><div><a href="http://www.opensips.org/html/docs/modules/1.4.x/uac.html#id227417">http://www.opensips.org/html/docs/modules/1.4.x/uac.html#id227417</a></div>
<div><br><br><div class="gmail_quote">On Wed, Mar 18, 2009 at 2:37 PM, Julian Yap <span dir="ltr"><<a href="mailto:julianokyap@gmail.com">julianokyap@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
I just tested and this does not work:<br>
<div class="im">remove_hf("From");<br>
append_hf("From: $ct;$ft\r\n");<br>
<br>
</div>So basically I want to rewrite the From header by using the details<br>
from the Contact header.<br>
<br>
Any suggestions?<br>
<font color="#888888"><br>
- Julian<br>
</font><div><div></div><div class="h5"><br>
On Wed, Mar 18, 2009 at 1:15 AM, Julian Yap <<a href="mailto:julianokyap@gmail.com">julianokyap@gmail.com</a>> wrote:<br>
> I have a scenario where the PSTN to SIP gateway (AudioCodes) I am<br>
> using sets the From header to 'anonymous' when it does not receive a<br>
> Calling Name from the PSTN side.<br>
><br>
> The modified INVITE from the gateway then looks like this (changed<br>
> some numbers and IP's):<br>
> From: "anonymous" <sip:anonymous@anonymous.invalid>;tag=1c49690767.<br>
> To: <<a href="mailto:sip%3A%2B18085557005@192.168.178.50">sip:+18085557005@192.168.178.50</a>;user=phone>.<br>
> CSeq: 1 INVITE.<br>
> Contact: <<a href="mailto:sip%3A8084446503@192.168.178.60">sip:8084446503@192.168.178.60</a>>.<br>
><br>
> When the gateway does receive the Calling Name from the PSTN, it looks<br>
> like this:<br>
> From: "HONOLULU HI" <<a href="mailto:sip%3A8083330048@192.168.178.60">sip:8083330048@192.168.178.60</a>>;tag=1c1248847826.<br>
> To: <<a href="mailto:sip%3A%2B18085557005@192.168.178.50">sip:+18085557005@192.168.178.50</a>;user=phone>.<br>
> CSeq: 1 INVITE.<br>
> Contact: <<a href="mailto:sip%3A8083330048@192.168.178.60">sip:8083330048@192.168.178.60</a>>.<br>
><br>
> In the first instance, I want to re-write the From header because I do<br>
> in fact have the calling number from the Contact header. In theory,<br>
> the PSTN gateway should sort this out for me and not send me the<br>
> 'anonymous' From header but I've searched the manuals and it doesn't.<br>
> Anyone else encountered this?<br>
><br>
> This is the IF statement that satisfies the criteria:<br>
> if($fu=='sip:anonymous@anonymous.invalid' &&<br>
> $ct=~"^<sip:[2-9][0-9]{2}[2-9][0-9]{6}@")<br>
> {<br>
> xlog("L_INFO", "fix anonymous\n");<br>
> }<br>
><br>
> The final From would be:<br>
> From: $ct;$ft<br>
> --> That is Contact header variable;From tag<br>
><br>
> I had a look at the UAC module but using the function<br>
> uac_replace_from(), I don't know how to strip the '<' and '>' of the<br>
> Contact header to satisfy the arguments of the function. Is it<br>
> possible? I'm thinking that using the UAC is preferable to what I'm<br>
> proposing below.<br>
><br>
> Does this method sound sane? Or is it dangerous?:<br>
> remove_hf("From");<br>
> append_hf("From: $ct;$ft\r\n");<br>
><br>
> Thanks,<br>
> Julian<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>
</div></div></blockquote></div><br></div>