Hello,
I have two Kamailio boxes running.
First one routes calls between my phones and asterisk. Here are the extra lines compared to the default config that came with my installation on the first server. Let's call this server kamailio :
loadmodule "pua.so" loadmodule "pua_mi.so" loadmodule "pua_dialoginfo.so" modparam("pua_dialoginfo", "include_localremote", 0) modparam("pua_dialoginfo", "include_tags", 0) modparam("pua_dialoginfo", "include_callid", 0) modparam("pua_dialoginfo", "caller_confirmed", 1) modparam("pua", "outbound_proxy", "sip:kamailio_presence_ip:5060")
if ( is_method("SUBSCRIBE") ) { t_relay("kamailio-presence-ip", "5060"); }
The second one handles presence stuff ( SUBSCRIBE and PUBLISH ), let's call it presence :
After the standard sanity checks :
if(is_method("PUBLISH")) { handle_publish(); t_release(); } else if( is_method("SUBSCRIBE")) { handle_subscribe(); t_release(); };
exit;
The problem is that I have two phones connected to the same username on the server.
Here is the sequence of events of a correctly functionning call :
1. Kamailio receives an INVITE 2. It sends the INVITE to each of the two phones 3. The first phone replies 180 Ringing 4. Kamailio sends a PUBLISH to presence 5. Presence replies with an OK, which includes a SIP-ETag header 6. Kamailio recieves the OK 7. Kamailio receives the 180 Ringing from the second phone 8. Kamailio sends a new PUBLISH with the SIP-If-Match using the value from the SIP-ETag header 9. Presence receives it, updates the presence table and sends an OK.
This is ok, the trouble is when the second 180 Ringing reaches Kamailio before the OK to the publish with the SIP-ETag.
1. Kamailio receives an INVITE 2. It sends the INVITE to each of the two phones 3. The first phone replies 180 Ringing 4. Kamailio sends a PUBLISH to presence 5. Kamailio receives the 180 Ringing from the second phone 6. Kamailio sends a PUBLISH to presence 7. Presence replies with an OK, which includes a SIP-ETag header 8. Presence replies with an OK, which includes a second SIP-ETag header 9. Kamailio recieves the OK 10. Kamailio recieves the OK
The presence table now has two seperate dialogs for the call because Kamailio didn't send the SIP-If-Match header as it did not yet receive the reply from presence.
When the two phones start ringing at the same time, the time between the two packets arriving at the server is shorter than a round trip to the presence server.
In the second scenario, Kamailio never updates the presence information using the first SIP-ETag, so the light on my phone stays stuck at "ringing".
Where do I go from here ?
Thanks,
David