I just tested and this does not work:
remove_hf("From");
append_hf("From: $ct;$ft\r\n");So basically I want to rewrite the From header by using the details from the Contact header. Any suggestions? - Julian On Wed, Mar 18, 2009 at 1:15 AM, Julian Yap <[email protected]> wrote: > I have a scenario where the PSTN to SIP gateway (AudioCodes) I am > using sets the From header to 'anonymous' when it does not receive a > Calling Name from the PSTN side. > > The modified INVITE from the gateway then looks like this (changed > some numbers and IP's): > From: "anonymous" <sip:[email protected]>;tag=1c49690767. > To: <sip:[email protected];user=phone>. > CSeq: 1 INVITE. > Contact: <sip:[email protected]>. > > When the gateway does receive the Calling Name from the PSTN, it looks > like this: > From: "HONOLULU HI" <sip:[email protected]>;tag=1c1248847826. > To: <sip:[email protected];user=phone>. > CSeq: 1 INVITE. > Contact: <sip:[email protected]>. > > In the first instance, I want to re-write the From header because I do > in fact have the calling number from the Contact header. In theory, > the PSTN gateway should sort this out for me and not send me the > 'anonymous' From header but I've searched the manuals and it doesn't. > Anyone else encountered this? > > This is the IF statement that satisfies the criteria: > if($fu=='sip:[email protected]' && > $ct=~"^<sip:[2-9][0-9]{2}[2-9][0-9]{6}@") > { > xlog("L_INFO", "fix anonymous\n"); > } > > The final From would be: > From: $ct;$ft > --> That is Contact header variable;From tag > > I had a look at the UAC module but using the function > uac_replace_from(), I don't know how to strip the '<' and '>' of the > Contact header to satisfy the arguments of the function. Is it > possible? I'm thinking that using the UAC is preferable to what I'm > proposing below. > > Does this method sound sane? Or is it dangerous?: > remove_hf("From"); > append_hf("From: $ct;$ft\r\n"); > > Thanks, > Julian > _______________________________________________ Users mailing list [email protected] http://lists.opensips.org/cgi-bin/mailman/listinfo/users
