Hello,

look at the uac module for uac_replace_from() and uac_replace_to() functions.

Btw, rfc3261 mandates a tag parameter for From header, which is missing on the INVITE you pasted here, so it is rather broken and many UA may reject it.

Cheersm
Daniel

On 9/23/13 7:09 PM, julian arsanches wrote:
Can someone advise me on how to change the to header to show the host that we are sending the call to an not the servers ip.

I am using dispatcher on my setup .

i am getting this


U 2013/09/23 12:57:54.576312 10.0.1.206:5060 -> 2.2.2.2:5060
INVITE sip:+42123333235@2.2.2.2:5060 SIP/2.0.
Record-Route: <sip:1.1.1.1;lr=on;ftag=as1f3df8b3>.
Via: SIP/2.0/UDP 1.1.1.1:5060;branch=z9hG4bKb29d.7399c2b3.0.
Via: SIP/2.0/UDP  1.1.1.5:5060;branch=z9hG4bK42a1ecaf;rport=5060.
Max-Forwards: 16.
From:<sip:unavailable@1.1.1.1>.
To: <sip:+4212333323@1.1.1.1>.
Contact: <sip:anonymous@1.1.1.5:5060>.
Call-ID: 0df8db614d45bae27035443c35166ba6@1.1.1.5:5060.
CSeq: 102 INVITE.
User-Agent: Asterisk PBX 1.8.15-cert2.
Date: Mon, 23 Sep 2013 16:58:25 GMT.
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH.
Supported: replaces, timer.
Cisco-Guid: 7128745-3588944267-852064@msc1
Content-Type: application/sdp.
Content-Length: 288.
.
v=0.
o=root 1760548326 1760548326 IN IP4 54.236.97.30.
s=Asterisk PBX 1.8.15-cert2.
c=IN IP4 1.1.1.5.
t=0 0.
m=audio 39794 RTP/AVP 0 18 101.
a=rtpmap:0 PCMU/8000.
a=rtpmap:18 G729/8000.
a=fmtp:18 annexb=no.
a=rtpmap:101 telephone-event/8000.
a=fmtp:101 0-16.
a=ptime:20.
a=sendrecv.

I need to  sent header to a carrier like this 

To: <sip:+4212333323@2.2.2.2>  instead of 1.1.1.1.

i am proxing calls from asterisk to a main carrier.
Please help.

here is my config.



if (starts_with("$var(o)","anonymous")) {

ds_select_domain("$var(z)", "4");#carrier dynamic


xlog("here is anonymous call <$var(o)>77777\n");


$var(n)=$(tU{s.substr,3,0});


remove_hf("From");
remove_hf("P-Asserted-Identity");
remove_hf("Privacy");

insert_hf("From:<sip:unavailable@1.1.1.1.1>\r\n", "From");
$tU=$var(n);
xlog("out header CHECK ANONYMOUS BEFORE to $tu--$td - contact pai+++ <<$ct>>++ from_uri=$fu;<$tU---=$var(n)> to_uri=$tu; }pai<$ai>intid=$fU; type_call=$si; dst_ip=$ru; carriercode=$var(z);callmode=$var(out)");

if(!t_relay()){;
sl_reply_error();
exit;
};
##ENDANONYMOUS

exit;

}

Again thanks  a lot for any help.



_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Kamailio Advanced Trainings - Berlin, Oct 21-24; Miami, Nov 11-13, 2013
  - more details about Kamailio trainings at http://www.asipto.com -