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.websitesip:1001@decasa.website;tag=a6a1c5f60faecf035a1ae5b6e96e979a-f6a3 From: "1000"sip:1000@decasa.websitesip: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.orgmailto: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