[SR-Users] Dispatcher BYE issue

Ahmed Salem ahmed.salem4282 at gmail.com
Wed Nov 26 12:59:00 CET 2014


Muhammad thanks for your reply.
I tried without the loose route in the main block but I can't make any
calls.
I also attached the ngrep output.

Thanks
Ahmed

INVITE sip:2000 at 178.62.126.15 SIP/2.0
Via: SIP/2.0/TCP 10.65.47.53:51977;branch=z9hG4bK.ZFrwHAOUd;rport
From: <sip:1000 at 178.62.126.15>;tag=A0DduhJxi
To: sip:2000 at 178.62.126.15
CSeq: 20 INVITE
Call-ID: -pF7mvvFRp
Max-Forwards: 70
Supported: outbound
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE,
SUBSCRIBE, INFO, UPDATE
Content-Type: application/sdp
Content-Length: 454
Contact: <sip:1000 at 105.35.19.185:51977
;transport=tcp>;+sip.instance="<urn:uuid:07d94e90-bda1-4dc6-951c-84a1464c2ec8>"
User-Agent: LinphoneIPhone/2.2.3 (belle-sip/1.3.3)

v=0
o=1000 622 2563 IN IP4 10.65.47.53
s=Talk
c=IN IP4 10.65.47.53
b=AS:380
t=0 0
a=rtcp-xr:rcvr-rtt=all:10000 stat-summary=loss,dup,jitt,TTL voip-metrics
m=audio 7076 RTP/AVP 124 120 111 110 0 8 101
a=rtpmap:124 opus/48000/2
a=fmtp:124 useinbandfec=1; stereo=0; sprop-stereo=0
a=rtpmap:120 SILK/16000
a=rtpmap:111 speex/16000
a=fmtp:111 vbr=on
a=rtpmap:110 speex/8000
a=fmtp:110 vbr=on
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
xЛuTЁLKK+˜—E;#п@@gЄВ>~i#ЙФЫ ŠRq‰Јž р€ƒЏW
~№-йhSIP/2.0 100 trying -- your call is important to us
Via: SIP/2.0/TCP 10.65.47.53:51977
;branch=z9hG4bK.ZFrwHAOUd;rport=51977;received=105.35.19.185
From: <sip:1000 at 178.62.126.15>;tag=A0DduhJxi
To: sip:2000 at 178.62.126.15
CSeq: 20 INVITE
Call-ID: -pF7mvvFRp
Server: kamailio (4.0.4 (x86_64/linux))
Content-Length: 0
Warning: 392 178.62.126.15:5060 "Noisy feedback tells:  pid=2147
req_src_ip=105.35.19.185 req_src_port=51977 in_uri=sip:2000 at 178.62.126.15
out_uri=sip:2000 at 10.131.217.48;transport=tcp via_cnt==1"

xЛuT^Mњњ+˜—Eъщ@@
ƒй-
ƒй0мяФш&Є
Ѓяе€Ь@
~№tINVITE sip:2000 at 10.131.217.48;transport=tcp SIP/2.0
Record-Route: <sip:178.62.126.15;transport=tcp;lr=on;ftag=A0DduhJxi>
Via: SIP/2.0/TCP 10.131.217.45;branch=z9hG4bK4f91.7ba7e9a7.0;i=7
Via: SIP/2.0/TCP 10.65.47.53:51977
;received=105.35.19.185;branch=z9hG4bK.ZFrwHAOUd;rport=51977
From: <sip:1000 at 178.62.126.15>;tag=A0DduhJxi
To: sip:2000 at 178.62.126.15
CSeq: 20 INVITE
Call-ID: -pF7mvvFRp
Max-Forwards: 16
Supported: outbound
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE,
SUBSCRIBE, INFO, UPDATE
Content-Type: application/sdp
Content-Length: 454
Contact: <sip:1000 at 105.35.19.185:51977
;transport=tcp>;+sip.instance="<urn:uuid:07d94e90-bda1-4dc6-951c-84a1464c2ec8>"
User-Agent: LinphoneIPhone/2.2.3 (belle-sip/1.3.3)

v=0
o=1000 622 2563 IN IP4 10.65.47.53
s=Talk
c=IN IP4 10.65.47.53
b=AS:380
t=0 0
a=rtcp-xr:rcvr-rtt=all:10000 stat-summary=loss,dup,jitt,TTL voip-metrics
m=audio 7076 RTP/AVP 124 120 111 110 0 8 101
a=rtpmap:124 opus/48000/2
a=fmtp:124 useinbandfec=1; stereo=0; sprop-stereo=0
a=rtpmap:120 SILK/16000
a=rtpmap:111 speex/16000
a=fmtp:111 vbr=on
a=rtpmap:110 speex/8000
a=fmtp:110 vbr=on
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
xЛuTGTдд1s!EФ
8@@dˆ
ƒй0
ƒй-ФмяЃяеш&Јг€ž№Џ
€Щ~№SIP/2.0 100 trying -- your call is important to us
Via: SIP/2.0/TCP 10.131.217.45;branch=z9hG4bK4f91.7ba7e9a7.0;i=7;rport=56559
Via: SIP/2.0/TCP 10.65.47.53:51977
;received=105.35.19.185;branch=z9hG4bK.ZFrwHAOUd;rport=51977
From: <sip:1000 at 178.62.126.15>;tag=A0DduhJxi
To: sip:2000 at 178.62.126.15
CSeq: 20 INVITE
Call-ID: -pF7mvvFRp
Server: kamailio (4.0.4 (x86_64/linux))
Content-Length: 0

xЛuTйUьь1s!EмŒт@@рХ
ƒй0
ƒй-jФЛŽcp™T!Д€ѕж
€Щr.INVITE sip:2000 at 105.40.65.70:44789;transport=tcp SIP/2.0
Record-Route: <sip:10.131.217.48;transport=tcp;lr=on;nat=yes>
Record-Route: <sip:178.62.126.15;transport=tcp;lr=on;ftag=A0DduhJxi>
Via: SIP/2.0/TCP 10.131.217.48;branch=z9hG4bK4f91.097a02e.0;i=8
Route: <sip:10.131.217.45;transport=tcp;lr;received='sip:105.40.65.70:44789
;transport=tcp'>
Via: SIP/2.0/TCP 10.131.217.45;rport=56559;branch=z9hG4bK4f91.7ba7e9a7.0;i=7
Via: SIP/2.0/TCP 10.65.47.53:51977
;received=105.35.19.185;branch=z9hG4bK.ZFrwHAOUd;rport=51977
From: <sip:1000 at 178.62.126.15>;tag=A0DduhJxi
To: sip:2000 at 178.62.126.15
CSeq: 20 INVITE
Call-ID: -pF7mvvFRp
Max-Forwards: 15
Supported: outbound
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE,
SUBSCRIBE, INFO, UPDATE
Content-Type: application/sdp
Content-Length: 477
Contact: <sip:1000 at 105.35.19.185:51977
;alias=10.131.217.45~56559~2;transport=tcp>;+sip.instance="<urn:uuid:07d94e90-bda1-4dc6-951c-84a1464c2ec8>"
User-Agent: LinphoneIPhone/2.2.3 (belle-sip/1.3.3)

On Wednesday, November 26, 2014, Muhammad Shahzad <shaheryarkh at gmail.com>
wrote:

> Don't do loose route in main route block. The WITHINDLG route will take
> care of that.
>
> Also you may need to do "handle_ruri_alias" just after loose route in
> WITHINDLG route. See below link for more details,
>
>
> http://www.kamailio.org/docs/modules/4.2.x/modules/nathelper.html#nathelper.f.handle_ruri_alias
>
> something like this,
>
> ---
> if (loose_route()) {
>     if(!isdsturiset()) {
>         handle_ruri_alias();
>     };
>
>     if (is_method("BYE")) {
> ...
>
> Thank you.
>
>
>
> On Tue, Nov 25, 2014 at 3:49 PM, Ahmed Salem <ahmed.salem4282 at gmail.com>
> wrote:
>
>> Hi,
>>
>> I'm trying to achieve this configuration
>>
>> phone --> NAT --> kamailio loadbalancer --> kamailio sip/proxy
>>             --> kamailio sip/proxy
>>
>> With the attached configuration I can make calls without any problems
>> but when the callee hangs up the call does not end only the caller can
>> hang up.
>>
>> Btw I'm using tcp for signalling.
>>
>> Any ideas?
>> Thanks
>>
>> #!define FLT_ACC 1
>> #!define FLT_ACCMISSED 2
>> #!define FLT_ACCFAILED 3
>> #!define FLT_NATS 5
>>
>> #!define FLB_NATB 6
>> #!define FLB_NATSIPPING 7
>>
>>
>> mhomed=1
>>
>> ####### Global Parameters #########
>>
>> #!ifdef WITH_DEBUG
>> debug=4
>> log_stderror=yes
>> #!else
>> debug=2
>> log_stderror=no
>> #!endif
>>
>> memdbg=5
>> memlog=5
>>
>> log_facility=LOG_LOCAL0
>>
>> fork=yes
>> children=4
>>
>> tcp_async=yes
>> tcp_connection_lifetime=3605
>>
>> port=5060
>> sip_warning=yes
>>
>> ####### Modules Section ########
>>
>> #!ifdef WITH_SRCPATH
>> mpath="modules_k:modules"
>> #!else
>> mpath="/usr/lib/x86_64-linux-gnu/kamailio/modules/"
>> #!endif
>>
>> loadmodule "db_mysql.so"
>> loadmodule "mi_fifo.so"
>> loadmodule "kex.so"
>> loadmodule "tm.so"
>> loadmodule "tmx.so"
>> loadmodule "sl.so"
>> loadmodule "rr.so"
>> loadmodule "pv.so"
>> loadmodule "maxfwd.so"
>> loadmodule "textops.so"
>> loadmodule "siputils.so"
>> loadmodule "xlog.so"
>> loadmodule "sanity.so"
>> loadmodule "ctl.so"
>> loadmodule "mi_rpc.so"
>> loadmodule "acc.so"
>> loadmodule "usrloc.so"
>> loadmodule "registrar.so"
>> loadmodule "dispatcher.so"
>> loadmodule "nathelper.so"
>> loadmodule "rtpproxy.so"
>> loadmodule "path.so"
>>
>> # ----------------- setting module-specific parameters ---------------
>>
>>
>> # ----- mi_fifo params -----
>> modparam("mi_fifo", "fifo_name", "/var/run/kamailio/kamailio_fifo")
>>
>> # ----- rr params -----
>> # add value to ;lr param to cope with most of the UAs
>> modparam("rr", "enable_full_lr", 1)
>> # do not append from tag to the RR (no need for this script)
>> modparam("rr", "append_fromtag", 1)
>> modparam("rr", "enable_double_rr", 0)
>>
>>
>> # ----- tm params -----
>> modparam("tm", "failure_reply_mode", 3)
>> modparam("tm", "fr_timer", 3000)
>> modparam("tm", "fr_inv_timer", 120000)
>>
>> # ----- dispatcher params -----
>> modparam("dispatcher", "db_url",
>> "mysql://kamailio:kamailiorw@localhost/kamailio")
>> modparam("dispatcher", "table_name", "dispatcher")
>> modparam("dispatcher", "flags", 2)
>> #modparam("dispatcher", "force_dst", 1)
>> modparam("dispatcher", "setid_col", "setid")
>> modparam("dispatcher", "destination_col", "destination")
>> modparam("dispatcher", "flags_col", "flags")
>> modparam("dispatcher", "priority_col", "priority")
>> modparam("dispatcher", "dst_avp", "$avp(AVP_DST)")
>> modparam("dispatcher", "grp_avp", "$avp(AVP_GRP)")
>> modparam("dispatcher", "cnt_avp", "$avp(AVP_CNT)")
>>
>>
>> modparam("path", "use_received", 1)
>>
>> modparam("registrar", "use_path", 1)
>> modparam("registrar", "path_mode", 0)
>> modparam("registrar", "path_use_received", 1)
>>
>> modparam("nathelper", "natping_interval", 30)
>> modparam("nathelper", "ping_nated_only", 1)
>> modparam("nathelper", "sipping_bflag", FLB_NATSIPPING)
>> modparam("nathelper", "sipping_from", "sip:pinger at kamailio.org")
>>
>> # params needed for NAT traversal in other modules
>> modparam("nathelper|registrar", "received_avp", "$avp(RECEIVED)")
>> modparam("usrloc", "nat_bflag", FLB_NATB)
>>
>> ####### Routing Logic ########
>>
>>
>> # main request routing logic
>>
>> request_route {
>> xlog("L_NOTICE", "*** loose routing enforced before: $rm, $ru, $si,
>> $du\n");
>> # per request initial checks
>>   route(REQINIT);
>>  loose_route();
>>  # handle requests within SIP dialogs
>> route(WITHINDLG);
>>
>> ### only initial requests (no To tag)
>>
>> # CANCEL processing
>> if (is_method("CANCEL"))
>> {
>> if (t_check_trans())
>> t_relay();
>> exit;
>> }
>>
>> t_check_trans();
>>
>> # record routing for dialog forming requests (in case they are routed)
>> # - remove preloaded route headers
>> #remove_hf("Route");
>> if (is_method("INVITE")){
>> record_route();
>> }
>>  if(is_method("REGISTER")){
>> add_path_received();
>> fix_nated_register();
>> }
>> else{
>> add_contact_alias();
>> }
>>
>> # dispatch destinations
>> route(DISPATCH);
>>
>> route(RELAY);
>> }
>>
>>
>> route[RELAY] {
>> if (!t_relay()) {
>> sl_reply_error();
>> }
>> exit;
>> }
>>
>> # Per SIP request initial checks
>> route[REQINIT] {
>> if (!mf_process_maxfwd_header("10")) {
>> sl_send_reply("483","Too Many Hops");
>> exit;
>> }
>>
>> if(!sanity_check("1511", "7"))
>> {
>> xlog("L_NOTICE", "*** loose routing enforced before: $rm, $ru, $si,
>> $du\n");
>> xlog("Malformed SIP message from $si:$sp\n");
>> exit;
>> }
>> }
>>
>> # Handle requests within SIP dialogs
>> route[WITHINDLG] {
>> if (has_totag()) {
>> # sequential request withing a dialog should
>> # take the path determined by record-routing
>> if (loose_route()) {
>> if (is_method("BYE")) {
>> setflag(1); # do accounting ...
>> setflag(3); # ... even if the transaction fails
>> }
>> route(RELAY);
>> } else {
>> if (is_method("SUBSCRIBE") && uri == myself) {
>> # in-dialog subscribe requests
>> #route(PRESENCE);
>> exit;
>> }
>> if ( is_method("ACK") ) {
>>  if ( t_check_trans() ) {
>> # non loose-route, but stateful ACK;
>> # must be ACK after a 487 or e.g. 404 from upstream server
>> t_relay();
>> exit;
>> } else {
>> # ACK without matching transaction ... ignore and discard.
>> exit;
>> }
>> }
>> sl_send_reply("404","Not here");
>> }
>> exit;
>> }
>> }
>>
>> # Dispatch requests
>> route[DISPATCH] {
>> # round robin dispatching on gateways group '1'
>> if(!ds_select_domain("1", "0"))
>> {
>> send_reply("404", "No destination");
>> exit;
>> }
>> xlog("L_DBG", "--- SCRIPT: going to <$ru> via <$du>\n");
>> t_on_failure("RTF_DISPATCH");
>> return;
>> }
>>
>> # Sample failure route
>> failure_route[RTF_DISPATCH] {
>> if (t_is_canceled()) {
>> exit;
>> }
>> # next DST - only for 500 or local timeout
>> if (t_check_status("500")
>> or (t_branch_timeout() and !t_branch_replied()))
>> {
>> if(ds_next_domain())
>> {
>> xlog("L_NOTICE", "going to next dst\n");
>> t_on_failure("RTF_DISPATCH");
>> route(RELAY);
>> exit;
>> }
>> }
>> }
>>
>>
>>
>> _______________________________________________
>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
>> sr-users at lists.sip-router.org
>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20141126/0be71259/attachment.html>


More information about the sr-users mailing list