Hi Daniel,

I am attaching here my sip trace at client side.Request you to see this.

My client IP in register request is 125.16.231.74 and the server on which 
kamailio is running is 185.122.205.178.


I want my contact header to be <sip:OTT919620649614@185.122.205.178:5070;lr>


I am using avp_subst() function to replace this.But kamailio is not starting.

Please reply if I am in wrong way or have different understanding as I am very 
new to kamailio.


Thanks,

Narayan



________________________________
From: Narayan P
Sent: Friday, April 14, 2017 12:54:25 PM
To: sr-us...@lists.sip-router.org
Cc: moco...@gmail.com
Subject: RE: Not able to replace route_uri in contact header uri

Hi Daniel,

Thanks for your response.

I mean to say,
In my register request the route header i.e. route_uri is <sip:185.122.205.178> 
and contact header is 3333@172.22.13.41.
I want my contact header to be 3333@185.122.205.178.
So how can I replace the contact header's only domain part with route_uri.the 
user part of the contact header remains same.


Thanks,
Narayan
________________________________________
From: Narayan P
Sent: Thursday, April 13, 2017 11:13 AM
To: sr-us...@lists.sip-router.org
Subject: Re: Not able to replace route_uri in contact header uri

Hi ,

Can anybody help me how to replace the domain part of $route-uri in contact  
header .

I am using avp_subst().But kamailio is not starting.


I am new to kamailio.Any help will be highly appreciated.


Thanks,

Narayan

________________________________
From: Narayan P
Sent: Wednesday, April 12, 2017 8:17:02 AM
To: sr-us...@lists.sip-router.org
Subject: Not able to replace route_uri in contact header uri


Hi All,

I am using pjsip client and kamailiio,both running on different servers.I want 
to replace the uri on which pjsip is running with the uri on which kamailio is 
running in contact header.
I put some logs on route[REGISTRAR] and able to see the $route_uri as kamailio 
server uri($avp(s:fs) and  $hdr(Contact) as pjsip server uri 
($avp(s:contact).But I am not able to replace the uri with avp_subst() function.

Can anybody help me how to replace the uri or with any any other function.

Below I have put the snippet of config file.


# Handle SIP registrations
route[REGISTRAR] {
        if (!is_method("REGISTER")) return;

        if(isflagset(FLT_NATS)) {
                setbflag(FLB_NATB);
#!ifdef WITH_NATSIPPING
                # do SIP NAT pinging
                setbflag(FLB_NATSIPPING);
#!endif
        }
        xlog("Narayan: before sending contact\n");
        $avp(s:contact) = $hdr(Contact);
        $avp(s:fs) = $route_uri;
        xlog("Narayan: Forced socket is $avp(s:fs)\n");
        xlog("Narayan: contact header is $avp(s:contact)\n");
        avp_subst("$avp(s:contact)/avp(s:contac)/g", "/(.*)@(.*)/$route_uri/");
        #avp_pushto("$ru/domain","$fd");
        #rewritehostport("185.122.206.62:5060");
        t_on_reply("MANAGE_REPLY");
        t_relay();
        #if (!save("location")) {
        #       sl_reply_error();
        #}
        exit;
}


Any suggestion will be highly appreciated.


Thanks,
Narayan


root@dharm-VirtualBox:/home/dharm/rudra/pjsip_comp/pjsip-apps/bin# 
root@dharm-VirtualBox:/home/dharm/rudra/pjsip_comp/pjsip-apps/bin# 
root@dharm-VirtualBox:/home/dharm/rudra/pjsip_comp/pjsip-apps/bin# 
root@dharm-VirtualBox:/home/dharm/rudra/pjsip_comp/pjsip-apps/bin# 
./pjsua-x86_64-unknown-linux-gnu --local-port=5067 
--outbound=sip:185.122.205.178:5070 --config-file=config_cfg.cfg --no-tcp
11:49:40.373 os_core_unix.c !pjlib 2.3 for POSIX initialized
11:49:40.373 sip_endpoint.c  .Creating endpoint instance...
11:49:40.373          pjlib  .select() I/O Queue created (0xe95240)
11:49:40.373 sip_endpoint.c  .Module "mod-msg-print" registered
11:49:40.373 sip_transport.  .Transport manager created.
11:49:40.373   pjsua_core.c  .PJSUA state changed: NULL --> CREATED
11:49:40.373   pjsua_core.c  .pjsua_init

11:49:40.373   pjsua_core.c  .rtpCompStatus 0 rtpEncStatus 0 sipCompressStatus 
1  encryptionState 1

11:49:40.373 sip_endpoint.c  .Module "mod-pjsua-log" registered
11:49:40.373 sip_endpoint.c  .Module "mod-tsx-layer" registered
11:49:40.373 sip_endpoint.c  .Module "mod-stateful-util" registered
11:49:40.373 sip_endpoint.c  .Module "mod-ua" registered
11:49:40.373 sip_endpoint.c  .Module "mod-100rel" registered
11:49:40.373 sip_endpoint.c  .Module "mod-pjsua" registered
11:49:40.373 sip_endpoint.c  .Module "mod-invite" registered
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)
11:49:40.427       pa_dev.c  ..PortAudio sound library initialized, status=0
11:49:40.428       pa_dev.c  ..PortAudio host api count=2
11:49:40.428       pa_dev.c  ..Sound device count=11
11:49:40.428          pjlib  ..select() I/O Queue created (0xeddd98)
11:49:40.434 sip_endpoint.c  .Module "mod-evsub" registered
11:49:40.436 sip_endpoint.c  .Module "mod-presence" registered
11:49:40.436 sip_endpoint.c  .Module "mod-mwi" registered
11:49:40.436 sip_endpoint.c  .Module "mod-refer" registered
11:49:40.436 sip_endpoint.c  .Module "mod-pjsua-pres" registered
11:49:40.436 sip_endpoint.c  .Module "mod-pjsua-im" registered
11:49:40.436 sip_endpoint.c  .Module "mod-pjsua-options" registered
11:49:40.436   pjsua_core.c  .1 SIP worker threads created
11:49:40.436   pjsua_core.c  .pjsua version 2.3 for 
Linux-4.4.0.64/x86_64/glibc-2.19 initialized
11:49:40.436   pjsua_core.c  .PJSUA state changed: CREATED --> INIT
11:49:40.436 sip_endpoint.c  Module "mod-default-handler" registered
11:49:40.436   pjsua_core.c  SIP UDP socket reachable at 172.22.13.41:5067
11:49:40.436    udp0xef1d80  SIP UDP transport started, published address is 
172.22.13.41:5067
11:49:40.436    pjsua_acc.c  Adding account: id=<sip:172.22.13.41:5067>
11:49:40.436    pjsua_acc.c  .Account <sip:172.22.13.41:5067> added with id 0
11:49:40.436    pjsua_acc.c  Modifying accunt 0
11:49:40.436    pjsua_acc.c  Acc 0: setting online status to 1..
11:49:40.436    pjsua_acc.c  Adding account: 
id=sip:OTT919620649614@185.122.206.62
11:49:40.436    pjsua_acc.c  .Account sip:OTT919620649614@185.122.206.62 added 
with id 1
11:49:40.436    pjsua_acc.c  .Acc 1: setting registration..
11:49:40.436   pjsua_core.c  ...TX 628 bytes Request msg REGISTER/cseq=41800 
(tdta0xef79f0) to UDP 185.122.205.178:5070:
REGISTER sip:185.122.206.62 SIP/2.0
Via: SIP/2.0/UDP 
172.22.13.41:5067;rport;branch=z9hG4bKPj475160b1-4579-48ba-8c56-6858389d292f
Route: <sip:185.122.205.178:5070;lr>
Max-Forwards: 70
From: 
<sip:OTT919620649614@185.122.206.62>;tag=35af1666-a2b1-4c6e-a7b6-8675845036e7
To: <sip:OTT919620649614@185.122.206.62>
Call-ID: 5bc6558f-1ffc-4990-bc99-d099c4fdcbcb
CSeq: 41800 REGISTER
User-Agent: PJSUA v2.3 Linux-4.4.0.64/x86_64/glibc-2.19
Contact: <sip:OTT919620649614@172.22.13.41:5067;ob>
Expires: 300
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, 
MESSAGE, OPTIONS
Content-Length:  0


--end msg--
11:49:40.436    pjsua_acc.c  ..Acc 1: Registration sent
11:49:40.436    pjsua_acc.c  Acc 1: setting online status to 1..
11:49:40.436   pjsua_core.c  PJSUA state changed: INIT --> STARTING
11:49:40.436 sip_endpoint.c  .Module "mod-unsolicited-mwi" registered
11:49:40.436   pjsua_core.c  .PJSUA state changed: STARTING --> RUNNING
11:49:40.436         main.c  Ready: Success
>>>>
Account list:
  [ 0] <sip:172.22.13.41:5067>: does not register
       Online status: Online
 *[ 1] sip:OTT919620649614@185.122.206.62: 100/In Progress (expires=0)
       Online status: Online
Buddy list:
 -none-

+=============================================================================+
|       Call Commands:         |   Buddy, IM & Presence:  |     Account:      |
|                              |                          |                   |
|  m  Make new call            | +b  Add new buddy       .| +a  Add new accnt |
|  M  Make multiple calls      | -b  Delete buddy         | -a  Delete accnt. |
|  a  Answer call              |  i  Send IM              | !a  Modify accnt. |
|  h  Hangup call  (ha=all)    |  s  Subscribe presence   | rr  (Re-)register |
|  H  Hold call                |  u  Unsubscribe presence | ru  Unregister    |
|  v  re-inVite (release hold) |  t  ToGgle Online status |  >  Cycle next ac.|
|  U  send UPDATE              |  T  Set online status    |  <  Cycle prev ac.|
| ],[ Select next/prev call    +--------------------------+-------------------+
|  x  Xfer call                |      Media Commands:     |  Status & Config: |
|  X  Xfer with Replaces       |                          |                   |
|  #  Send RFC 2833 DTMF       | cl  List ports           |  d  Dump status   |
|  *  Send DTMF with INFO      | cc  Connect port         | dd  Dump detailed |
| dq  Dump curr. call quality  | cd  Disconnect port      | dc  Dump config   |
|                              |  V  Adjust audio Volume  |  f  Save config   |
|  S  Send arbitrary REQUEST   | Cp  Codec priorities     |                   |
+-----------------------------------------------------------------------------+
|  q  QUIT   L  ReLoad   sleep MS   echo [0|1|txt]     n: detect NAT type     |
+=============================================================================+
You have 0 active call
>>> 11:49:40.600   pjsua_core.c  .RX 493 bytes Response msg 
>>> 401/REGISTER/cseq=41800 (rdata0xef3808) from UDP 185.122.205.178:5070:
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 
172.22.13.41:5067;rport=25841;branch=z9hG4bKPj475160b1-4579-48ba-8c56-6858389d292f;received=125.16.231.74
From: 
<sip:OTT919620649614@185.122.206.62>;tag=35af1666-a2b1-4c6e-a7b6-8675845036e7
To: <sip:OTT919620649614@185.122.206.62>
Call-ID: 5bc6558f-1ffc-4990-bc99-d099c4fdcbcb
CSeq: 41800 REGISTER
WWW-Authenticate: Digest 
nonce="af7780946d2b72ddc5e765a68798e937",realm="185.122.206.62",opaque="",stale=FALSE,algorithm=MD5
Content-Length: 0


--end msg--
11:49:40.600    pjsua_acc.c  ....IP address change detected for account 1 
(172.22.13.41:5067 --> 125.16.231.74:25841). Updating registration (using 
method 4)
11:49:40.600   pjsua_core.c  ....TX 834 bytes Request msg REGISTER/cseq=41801 
(tdta0xef79f0) to UDP 185.122.205.178:5070:
REGISTER sip:185.122.206.62 SIP/2.0
Via: SIP/2.0/UDP 
125.16.231.74:25841;rport;branch=z9hG4bKPj592750e4-9a06-4662-a55e-a8a71dedb974
Route: <sip:185.122.205.178:5070;lr>
Max-Forwards: 70
From: 
<sip:OTT919620649614@185.122.206.62>;tag=35af1666-a2b1-4c6e-a7b6-8675845036e7
To: <sip:OTT919620649614@185.122.206.62>
Call-ID: 5bc6558f-1ffc-4990-bc99-d099c4fdcbcb
CSeq: 41801 REGISTER
User-Agent: PJSUA v2.3 Linux-4.4.0.64/x86_64/glibc-2.19
Contact: <sip:OTT919620649614@125.16.231.74:25841;ob>
Expires: 300
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, 
MESSAGE, OPTIONS
Authorization: Digest username="OTT919620649614", realm="185.122.206.62", 
nonce="af7780946d2b72ddc5e765a68798e937", uri="sip:185.122.206.62", 
response="a4c0614fbc3c72ece619247de5766a4b", algorithm=MD5
Content-Length:  0


--end msg--
11:49:40.768   pjsua_core.c  .RX 456 bytes Response msg 200/REGISTER/cseq=41801 
(rdata0x7f1190001d08) from UDP 185.122.205.178:5070:
SIP/2.0 200 OK
Via: SIP/2.0/UDP 
125.16.231.74:25841;rport=25841;branch=z9hG4bKPj592750e4-9a06-4662-a55e-a8a71dedb974;received=125.16.231.74
From: 
<sip:OTT919620649614@185.122.206.62>;tag=35af1666-a2b1-4c6e-a7b6-8675845036e7
Call-ID: 5bc6558f-1ffc-4990-bc99-d099c4fdcbcb
CSeq: 41801 REGISTER
To: <sip:OTT919620649614@185.122.206.62>;tag=1492409213989
Expires: 50
Contact: <sip:OTT919620649614@125.16.231.74:25841;ob>;expires=50
Content-Length: 0


--end msg--
11:49:40.769    pjsua_acc.c  ....SIP outbound status for acc 1 is not active
11:49:40.769    pjsua_acc.c  ....sip:OTT919620649614@185.122.206.62: 
registration success, status=200 (OK), will re-register in 50 seconds
11:49:40.769    pjsua_acc.c  ....Keep-alive timer started for acc 1, 
destination:185.122.205.178:5070, interval:15s
^C
root@dharm-VirtualBox:/home/dharm/rudra/pjsip_comp/pjsip-apps/bin# 
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

Reply via email to