Hi Daniel,
Following up on this, I continued doing further tests...
So I confirmed that the to-tag value is in fact added to the $tt only after the SIP ACK is
received. So I was able to temporarily stored them (just for the sake of pursuing
tests...) as:
$shv(ftag)=$ft;
$shv(ttag)=$tt;
When later I get the HTTP (w/ a call release event), I noticed that the $tt is not
available anymore - only since I kept on a shared variable I was able to restore the
dialogue. Below find a extract of the config file being used.
if(is_known_dlg()) {
xlog("Request $rm from $ci is in-dialog\n");
xlog("From tag is $ft and To tag is $tt\n");
}
xlog("L_DBG","From-tag is $shv(ftag) and To-tag $shv(ttag)\n\n");
if(dlg_get("$var(call_id)", "$shv(ftag)", "$shv(ttag)")) {
xlog("L_DBG","Dialogue was restored\n\n");
}
dlg_bye("caller");
and the respective log.
14(14527) exec: *** cfgtrace:request_route=[MATRIX_LONG_PULL]
c=[/etc/kamailio/kamailio.cfg] l=1313 a=24 n=is_known_dlg
14(14527) DEBUG: dialog [dlg_hash.c:697]: internal_get_dlg(): ref dlg 0x7f6896bd35f0 with
1 -> 3
14(14527) DEBUG: dialog [dlg_hash.c:700]: internal_get_dlg(): dialog
callid='a03faa7f-a6a6-fa6f-549d-d7e9c308f5ea' found on entry 525, dir=1
14(14527) DEBUG: dialog [dlg_hash.c:858]: dlg_unref(): unref dlg 0x7f6896bd35f0 with 1
-> 2
14(14527) exec: *** cfgtrace:request_route=[MATRIX_LONG_PULL]
c=[/etc/kamailio/kamailio.cfg] l=1314 a=25 n=xlog
14(14527) ERROR: <script>: Request INVITE from a03faa7f-a6a6-fa6f-549d-d7e9c308f5ea
is in-dialog
14(14527) exec: *** cfgtrace:request_route=[MATRIX_LONG_PULL]
c=[/etc/kamailio/kamailio.cfg] l=1315 a=25 n=xlog
14(14527) DEBUG: pv [pv_core.c:376]: pv_get_xto_attr(): no Tag parameter
14(14527) ERROR: <script>: From tag is W92rKx26QMoMWR7ZNXZo and To tag is
<null>
14(14527) exec: *** cfgtrace:request_route=[MATRIX_LONG_PULL]
c=[/etc/kamailio/kamailio.cfg] l=1318 a=26 n=xlog
14(14527) DEBUG: <script>: From-tag is W92rKx26QMoMWR7ZNXZo and To-tag
a6a1c5f60faecf035a1ae5b6e96e979a-2d04
14(14527) exec: *** cfgtrace:request_route=[MATRIX_LONG_PULL]
c=[/etc/kamailio/kamailio.cfg] l=1324 a=16 n=if
14(14527) exec: *** cfgtrace:request_route=[MATRIX_LONG_PULL]
c=[/etc/kamailio/kamailio.cfg] l=1320 a=27 n=dlg_get
14(14527) DEBUG: dialog [dlg_hash.c:697]: internal_get_dlg(): ref dlg 0x7f6896bd35f0 with
1 -> 3
14(14527) DEBUG: dialog [dlg_hash.c:700]: internal_get_dlg(): dialog
callid='a03faa7f-a6a6-fa6f-549d-d7e9c308f5ea' found on entry 525, dir=1
14(14527) DEBUG: dialog [dlg_hash.c:858]: dlg_unref(): unref dlg 0x7f6896bd35f0 with 1
-> 2
14(14527) exec: *** cfgtrace:request_route=[MATRIX_LONG_PULL]
c=[/etc/kamailio/kamailio.cfg] l=1321 a=26 n=xlog
14(14527) DEBUG: <script>: Dialogue was restored
14(14527) exec: *** cfgtrace:request_route=[MATRIX_LONG_PULL]
c=[/etc/kamailio/kamailio.cfg] l=1324 a=25 n=dlg_bye
14(14527) DEBUG: dialog [dlg_hash.c:640]: dlg_lookup(): ref dlg 0x7f6896bd35f0 with 1
-> 3
14(14527) DEBUG: dialog [dlg_hash.c:642]: dlg_lookup(): dialog id=9134 found on entry 525
14(14527) DEBUG: dialog [dlg_req_within.c:351]: send_bye(): sending BYE to caller
14(14527) DEBUG: tm [uac.c:249]: t_uac_prepare(): DEBUG:tm:t_uac:
next_hop=<sip:1000@188.165.231.30:12060;rtcweb-breaker=no;click2call=no;transport=udp;ws-src-ip=85.138.200.8;ws-src-port=50245;ws-src-proto=ws>
14(14527) DEBUG: tm [uac.c:150]: dlg2hash(): DEBUG: dlg2hash: 8772
14(14527) DEBUG: dialog [dlg_req_within.c:384]: send_bye(): BYE sent to caller
When checking the received SIP BYE (on the client side - using sipML5 as a client) I was
able to see that the To and From fields were sent inverted, which caused a 482 Loop
detected response, as can be seen from the logs extracted from the java console.
SEND: ACK sip:1001@decasa.website SIP/2.0
Via: SIP/2.0/WS df7jal23ls0d.invalid;branch=z9hG4bK22JccDrfSPOxK4PO4J70;rport
From: "alice"<sip:1000@decasa.website>;tag=nZ1iB1bCyfLr3n1RWpff
To: <sip:1001@decasa.website>;tag=a6a1c5f60faecf035a1ae5b6e96e979a-8c08
Contact:
"alice"<sip:1000@df7jal23ls0d.invalid;rtcweb-breaker=no;click2call=no;transport=ws>;+g.oma.sip-im;language="en,fr"
Call-ID: adec7d16-c08a-950f-2b09-db388e20b90b
CSeq: 27168 ACK
Content-Length: 0
Route: <sip:decasa.website:5060;lr;sipml5-outbound;transport=udp>
Max-Forwards: 70
User-Agent: IM-client/OMA1.0 sipML5-v1.2015.03.18
recv=BYE
sip:1000@188.165.231.30:14060;rtcweb-breaker=no;click2call=no;transport=ws;ws-src-ip=85.138.200.8;ws-src-port=50129;ws-src-proto=ws
SIP/2.0
Via: SIP/2.0/UDP 151.236.52.84;branch=z9hG4bK84d6.49978fe6000000000000000000000000.0
From: <sip:1001@decasa.website>
To: <sip:1000@decasa.website>;tag=nZ1iB1bCyfLr3n1RWpff
Call-ID: adec7d16-c08a-950f-2b09-db388e20b90b
CSeq: 1 BYE
Content-Length: 0
User-Agent: kamailio (4.3.0 (x86_64/linux))
Max-Forwards: 70
SEND: SIP/2.0 482 Loop Detected (Check your iFCs)
Via: SIP/2.0/UDP 151.236.52.84;branch=z9hG4bK84d6.49978fe6000000000000000000000000.0
From: <sip:1001@decasa.website>
To: <sip:1000@decasa.website>;tag=nZ1iB1bCyfLr3n1RWpff
Call-ID: adec7d16-c08a-950f-2b09-db388e20b90b
CSeq: 1 BYE
Content-Length: 0
If you require further info to track down the problem let me know.
Many Thanks,
Joao
From: Joao Alves
Sent: sexta-feira, 17 de Julho de 2015 12:07
To: 'miconda(a)gmail.com'com'; Kamailio (SER) - Users Mailing List
Subject: RE: [SR-Users] Dialogue restore after initial processing
Hi Daniel,
If I remember correctly the To-tag would be needed prior to 200 OK do to "early
dialogs". Which in a way is supported by the 180 Ringing where the To-tag was
self-generated by kamailio when building the response.
So I was not sure was a "bug" not updating the $tt accordingly or, whether there
would be a need for a new function dlg_get_early(callid, ftag) as you suggested.
But both would work for me. If this could be done, appreciated:)
Many Thanks,
Joao
From: Daniel-Constantin Mierla [mailto:miconda@gmail.com]
Sent: quinta-feira, 16 de Julho de 2015 10:38
To: Kamailio (SER) - Users Mailing List; Joao Alves
Subject: Re: [SR-Users] Dialogue restore after initial processing
Hello,
iirc, the to-tag is set in the dialog structure when the 200ok is processed. During the
call setup, there can be many outgoing branches, therefore many 'early' to-tags,
but only one will be final, once the call is answered.
On the other hand, there is a C function that returns the local generated To-tag. It is in
sl module, named get_reply_totag(...). It is not available in the config file, not being
needed so far.
Anyhow, in your case, might be better to add a function dlg_get_early(callid, ftag),
because to-tag of the dialog is not really known at that moment.
Cheers,
Daniel
On 14/07/15 17:14, Joao Alves wrote:
Hi,
I'm trying to restore a SIP session dialogue context and found dlg_get(callid, ftag,
ttag) function for that.
However, I cannot access the To tag. I noticed on the 180 RINGING there was already an
self-generated included on this response, but I also could not access its value.
When receiving the SIP INVITE request I used the dlg_manage() and the context was
initially stored.
if(is_known_dlg()) {
xlog("Request $rm from $ci is in-dialog\n");
xlog(">>From tag is $ft and To tag is $tt\n");
# Needed to later restore the dialog
$shv(ftag)=$ft;
$shv(ttag)=$tt;
}
15(49100) ERROR: <script>: Request INVITE from
76589ZWQ5NzIyYjMzNDI1YjVjM2E5ZWU5NjhkYzEyNjE3MzQ is in-dialog
15(49100) exec: *** cfgtrace:request_route=[MATRIX] c=[/etc/kamailio/kamailio.cfg] l=1021
a=25 n=xlog
15(49100) DEBUG: pv [pv_core.c:376]: pv_get_xto_attr(): no Tag parameter
15(49100) ERROR: <script>: >>From tag is 8fd06474 and To tag is <null>
Since there was a self-generated one (after the 180 RINGING being sent), I rechecked the
$tt and $dlg(to_tag) values and both still returned null values.
15(49100) DEBUG: tm [t_lookup.c:1083]: t_check_msg(): DEBUG: t_check_msg: T already
found!
15(49100) DEBUG: <core> [tcp_main.c:2196]: tcpconn_send_put(): send from reader
(49100 (15)), reusing fd
15(49100) DEBUG: <core> [tcp_main.c:2430]: tcpconn_do_send(): sending...
15(49100) DEBUG: <core> [tcp_main.c:2464]: tcpconn_do_send(): after real write: c=
0x7effdf7da860 n=396 fd=5
15(49100) DEBUG: <core> [tcp_main.c:2465]: tcpconn_do_send(): buf=
SIP/2.0 180 ringing
Via: SIP/2.0/TCP
192.168.1.5:58751;branch=z9hG4bK-524287-1---a64e0a42199ee419;rport=61134;received=85.138.200.8
To:
<sip:1001@decasa.website><sip:1001@decasa.website>;tag=a6a1c5f60faecf035a1ae5b6e96e979a-f6a3
From:
"1000"<sip:1000@decasa.website><sip:1000@decasa.website>;tag=8fd06474
Call-ID: 76589ZWQ5NzIyYjMzNDI1YjVjM2E5ZWU5NjhkYzEyNjE3MzQ
CSeq: 1 INVITE
Server: kamailio (4.3.0 (x86_64/linux))
Content-Length: 0
..., shmem=0x7effdf7e1e00: SIP/2.0 180 ringingght(): DEBUG: reply sent out.
buf=0x7effec023bf8: SIP/2.0 180 ringing
15(49100) DEBUG: tm [t_reply.c:657]: _reply_light(): DEBUG: _reply_light: finished
15(49100) DEBUG: sl [sl.c:272]: send_reply(): reply in stateful mode (tm)
15(49100) exec: *** cfgtrace:request_route=[MATRIX] c=[/etc/kamailio/kamailio.cfg] l=1031
a=25 n=xlog
15(49100) DEBUG: dialog [dlg_hash.c:640]: dlg_lookup(): ref dlg 0x7effdf7e1bf0 with 1
-> 2
15(49100) DEBUG: dialog [dlg_hash.c:642]: dlg_lookup(): dialog id=5769 found on entry 128
15(49100) DEBUG: dialog [dlg_hash.c:858]: dlg_unref(): unref dlg 0x7effdf7e1bf0 with 1
-> 1
15(49100) ERROR: <script>: Dialog To Tag: <null>
<==
xlog("Dialog To Tag: $dlg(to_tag)\n");
15(49100) exec: *** cfgtrace:request_route=[MATRIX] c=[/etc/kamailio/kamailio.cfg] l=1033
a=25 n=xlog
15(49100) DEBUG: pv [pv_core.c:376]: pv_get_xto_attr(): no Tag parameter
15(49100) ERROR: <script>: >>From2 tag is 8fd06474 and To tag is <null>
Many thanks,
Joao Alves
Solution Architect, Unified Communications
This message and the information contained herein is proprietary and confidential and
subject to the Amdocs policy statement, you may review at
http://www.amdocs.com/email_disclaimer.asp
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org<mailto:sr-users@lists.sip-router.org>
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
--
Daniel-Constantin Mierla
http://twitter.com/#!/miconda -
http://www.linkedin.com/in/miconda
Book: SIP Routing With Kamailio -
http://www.asipto.com