How Kamailio transformations work?

815 views Asked by At

Why Kamailio isn't set ALL headers properly?

Kamailio route excerpt:

route[PSTN] {
    ...
    # Set from user
    $fU = "+34687XXXXXX";

    # Set some info headers
    append_hf("Remote-Party-ID: <$fu>\r\n");
    append_hf("P-Preferred-Identity: <$fu>\r\n");
    ...
}

ngrep result of INVITE:

U XXX.XXX.XXX.XXX:5060 -> XXX.XXX.XXX.XXX:5060
INVITE sip:[email protected];transport=udp SIP/2.0.
Record-Route: <sip:XXX.XXX.XXX.XXX;lr>.
Via: SIP/2.0/UDP XXX.XXX.XXX.XXX;branch=z9hG4bKe235.4728a380ee70fc55cc0cecbb7919bee5.0.
Via: SIP/2.0/UDP XXX.XXX.XXX.XXX:38293;rport=38293;branch=z9hG4bK-d8754z-34c6ee584c5f95cd-1---d8754z-.
Max-Forwards: 69.
Contact: <sip:[email protected]:38293;transport=UDP>.
To: <sip:[email protected];transport=UDP>.
From: <sip:[email protected];transport=UDP>;tag=666b4350.
Call-ID: MGY2ODBkZjQ4OWI3ZWFmN2ZiNWQwYzhiZWI5ZmRkYzk..
CSeq: 2 INVITE.
Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, MESSAGE, OPTIONS, INFO, SUBSCRIBE.
Content-Type: application/sdp.
Supported: replaces, norefersub, extended-refer, timer, X-cisco-serviceuri.
Allow-Events: presence, kpml.
Content-Length: 163.
Remote-Party-ID: <sip:[email protected];transport=UDP>.
P-Preferred-Identity: <sip:[email protected];transport=UDP>.
User-Agent: voiper.es.
.
v=0.
o=Z 0 0 IN IP4 XXX.XXX.XXX.XXX.
s=Z.
c=IN IP4 XXX.XXX.XXX.XXX.
t=0 0.
m=audio 8000 RTP/AVP 8 101.
a=rtpmap:101 telephone-event/8000.
a=fmtp:101 0-15.
a=sendrecv.

The From header is set properly, but Remote-Party-ID and P-Preferred-Identity isn't set properly.

I'm running Kamailio 4.2.0 on Debian 8.

3

There are 3 answers

0
Rajesh On

$fU is specific to the FROM user in the Kamailio syntax. Can you try putting it to a local variable and using it for the purpose mentioned ?

0
shang hai old Lee On

you can use it:

   $fU = "nway.com.cn";
   msg_apply_changes();
0
miconda On

Changes to headers and body of SIP message are not applied immediately by default, an explicit msg_apply_changes() is needed. More detailed explanation how to handle it at: