I'm trying to get the MWI indicator on endpoints to work by redirecting the SUBSCRIBE to the voicemail server (asterisk) using usc_replace_(to|from). This works fine for the initial request but the next subscribe will fail since the to/from don't get rewritten, which is indicated by the error: ERROR: uac [replace.c:250]: decline FROM replacing in sequential request in auto mode (has TO tag)
This occurs when the modparam "uac","restore_mode" is manual or auto. When set to none the redirect will be correct but all responses have to be rewritten manually (I'm a beginner and I don't want to do this just yet). And since uac has knowledge about this having being rewritten, sending the original from/to looks like like a bug to me (more probable a misconfiguration/omission of something crucial withing dialog responses :)
Changes to the (default debian package) config, in route route[PRESENCE] in if(is_method("SUBSCRIBE"))
if( is_method("SUBSCRIBE")) { if(search_hf("Event", "message-summary", "a")) { if (!www_authenticate("$fd", "subscriber")) { www_challenge("$fd", "1"); exit; }
if(avp_db_query("SELECT value FROM usr_preferences WHERE username='$au' and attribute='voicemail' ORDER BY value limit 1")) { $avp(voicemail)=$avp(i:1);
$avp(subscrfrom)=$fu; avp_subst("$avp(subscrfrom)", "/sip:.*@/sip:$avp(voicemail)@/"); uac_replace_from("$avp(subscrfrom)"); uac_replace_to("","sip:$avp(voicemail)@$sel(cfg_get.voicemail.srv_ip): $sel(cfg_get.voicemail.srv_port)"); remove_hf("Authorization");
$ru = "sip:" + $avp(voicemail) + "@" + $sel(cfg_get.voicemail.srv_ip) + ":" + $sel(cfg_get.voicemail.srv_port); route(RELAY); } } else { handle_subscribe(); t_release(); } } exit;
192.168.34.226 is the sip device, 192.168.32.40 kamailio, 192.168.32.41 the voicemailserver.
Initial request: U 192.168.34.226:5852 -> 192.168.32.40:5060 SUBSCRIBE sip:grandstream@sip.local SIP/2.0. From: "Daniel" sip:grandstream@sip.local;tag=67d8f67065827fe2. To: sip:grandstream@sip.local.
Gets rewritten to: U 192.168.32.40:5060 -> 192.168.32.41:5060 SUBSCRIBE sip:0880100782@192.168.32.41:5060 SIP/2.0. From: "Daniel" sip:0880100782@sip.local;tag=67d8f67065827fe2. To: sip:0880100782@192.168.32.41:5060.
The response gets relayed to the endpoint and MWI will light up since there is a message.
But next subscribe update from the endpoint triggers the "decline FROM replacing in sequential request" error and thus the subscribe send to voicemail is the original to/from: U 192.168.32.40:5060 -> 192.168.32.41:5060 SUBSCRIBE sip:0880100782@192.168.32.41:5060 SIP/2.0. From: "Daniel" sip:grandstream@sip.local;tag=67d8f67065827fe2. To: sip:grandstream@sip.local;tag=as324de8f3.
Resulting in a 404 since the to/from are not the real peername on the voicemail server. How do I force Kamailio to rewrite the from/to without doing this manually for a requests/responses (restore_mode none)? The easy way out of this problem would be to have a 1 to 1 relation for the Kamailio subscribers and voicemail peers. But uac_replace should work (somehow).
Attached is a full capture of the subscribe/notify. Running 3.3.2+squeeze from http://deb.kamailio.org/kamailio/. Machine is also running topoh module (192.168.0.1).
Hello,
On 11/27/12 4:38 PM, Daniel Tryba wrote:
I'm trying to get the MWI indicator on endpoints to work by redirecting the SUBSCRIBE to the voicemail server (asterisk) using usc_replace_(to|from). This works fine for the initial request but the next subscribe will fail since the to/from don't get rewritten, which is indicated by the error: ERROR: uac [replace.c:250]: decline FROM replacing in sequential request in auto mode (has TO tag)
in auto mode, the From/To will be updated automatically for requests within dialog. So just relay the subscribe if it has To tag, don't call the function to update the header.
Cheers, Daniel
This occurs when the modparam "uac","restore_mode" is manual or auto. When set to none the redirect will be correct but all responses have to be rewritten manually (I'm a beginner and I don't want to do this just yet). And since uac has knowledge about this having being rewritten, sending the original from/to looks like like a bug to me (more probable a misconfiguration/omission of something crucial withing dialog responses :)
Changes to the (default debian package) config, in route route[PRESENCE] in if(is_method("SUBSCRIBE"))
if( is_method("SUBSCRIBE")) { if(search_hf("Event", "message-summary", "a")) { if (!www_authenticate("$fd", "subscriber")) { www_challenge("$fd", "1"); exit; }
if(avp_db_query("SELECT value FROM usr_preferences WHERE username='$au'
and attribute='voicemail' ORDER BY value limit 1")) { $avp(voicemail)=$avp(i:1);
$avp(subscrfrom)=$fu; avp_subst("$avp(subscrfrom)", "/sip:.*@/sip:$avp(voicemail)@/"); uac_replace_from("$avp(subscrfrom)"); uac_replace_to("","sip:$avp(voicemail)@$sel(cfg_get.voicemail.srv_ip):
$sel(cfg_get.voicemail.srv_port)"); remove_hf("Authorization");
$ru = "sip:" + $avp(voicemail) + "@" + $sel(cfg_get.voicemail.srv_ip) +
":" + $sel(cfg_get.voicemail.srv_port); route(RELAY); } } else { handle_subscribe(); t_release(); } } exit;
192.168.34.226 is the sip device, 192.168.32.40 kamailio, 192.168.32.41 the voicemailserver.
Initial request: U 192.168.34.226:5852 -> 192.168.32.40:5060 SUBSCRIBE sip:grandstream@sip.local SIP/2.0. From: "Daniel" sip:grandstream@sip.local;tag=67d8f67065827fe2. To: sip:grandstream@sip.local.
Gets rewritten to: U 192.168.32.40:5060 -> 192.168.32.41:5060 SUBSCRIBE sip:0880100782@192.168.32.41:5060 SIP/2.0. From: "Daniel" sip:0880100782@sip.local;tag=67d8f67065827fe2. To: sip:0880100782@192.168.32.41:5060.
The response gets relayed to the endpoint and MWI will light up since there is a message.
But next subscribe update from the endpoint triggers the "decline FROM replacing in sequential request" error and thus the subscribe send to voicemail is the original to/from: U 192.168.32.40:5060 -> 192.168.32.41:5060 SUBSCRIBE sip:0880100782@192.168.32.41:5060 SIP/2.0. From: "Daniel" sip:grandstream@sip.local;tag=67d8f67065827fe2. To: sip:grandstream@sip.local;tag=as324de8f3.
Resulting in a 404 since the to/from are not the real peername on the voicemail server. How do I force Kamailio to rewrite the from/to without doing this manually for a requests/responses (restore_mode none)? The easy way out of this problem would be to have a 1 to 1 relation for the Kamailio subscribers and voicemail peers. But uac_replace should work (somehow).
Attached is a full capture of the subscribe/notify. Running 3.3.2+squeeze from http://deb.kamailio.org/kamailio/. Machine is also running topoh module (192.168.0.1).
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
On Friday 30 November 2012 09:42:11 Daniel-Constantin Mierla wrote:
I'm trying to get the MWI indicator on endpoints to work by redirecting the SUBSCRIBE to the voicemail server (asterisk) using usc_replace_(to|from). This works fine for the initial request but the next subscribe will fail since the to/from don't get rewritten, which is indicated by the error: ERROR: uac [replace.c:250]: decline FROM replacing in sequential request in auto mode (has TO tag)
in auto mode, the From/To will be updated automatically for requests within dialog. So just relay the subscribe if it has To tag, don't call the function to update the header.
The only difference is that there is no error in syslog since the uac_* commands aren't executed a second time. The second subscribe will not be rewritten when restore mode is either manual or auto if uac_* are conditional:
if(!has_totag()) { uac_replace_from("$avp(subscrfrom)"); uac_replace_to("","sip:$avp(voicemail)@$sel(cfg_get.voicemail.srv_ip): $sel(cfg_get.voicemail.srv_port)"); }
Rewriting/restoring the from header works for INVITEs and responses where essentially the same thing happens (for the From).
Hello,
On 11/30/12 3:42 PM, Daniel Tryba wrote:
On Friday 30 November 2012 09:42:11 Daniel-Constantin Mierla wrote:
I'm trying to get the MWI indicator on endpoints to work by redirecting the SUBSCRIBE to the voicemail server (asterisk) using usc_replace_(to|from). This works fine for the initial request but the next subscribe will fail since the to/from don't get rewritten, which is indicated by the error: ERROR: uac [replace.c:250]: decline FROM replacing in sequential request in auto mode (has TO tag)
in auto mode, the From/To will be updated automatically for requests within dialog. So just relay the subscribe if it has To tag, don't call the function to update the header.
The only difference is that there is no error in syslog since the uac_* commands aren't executed a second time. The second subscribe will not be rewritten when restore mode is either manual or auto if uac_* are conditional:
if(!has_totag()) { uac_replace_from("$avp(subscrfrom)"); uac_replace_to("","sip:$avp(voicemail)@$sel(cfg_get.voicemail.srv_ip): $sel(cfg_get.voicemail.srv_port)"); }
Rewriting/restoring the from header works for INVITEs and responses where essentially the same thing happens (for the From).
Can you get a ngrep of the first and second SUBSCRIBE? It will help to troubleshoot and see what could be the issue.
Cheers, Daniel
On Tuesday 04 December 2012 17:49:43 Daniel-Constantin Mierla wrote:
The only difference is that there is no error in syslog since the uac_* commands aren't executed a second time. The second subscribe will not be rewritten when restore mode is either manual or auto if uac_* are conditional:
Can you get a ngrep of the first and second SUBSCRIBE? It will help to troubleshoot and see what could be the issue.
Those were attached to my mail that started this thread: http://lists.sip-router.org/pipermail/sr-users/2012-November/075839.html
But it might be better if I create a simple config that reproduces my problem. I'll try to find the time to create one tomorrow.
My current workaround is to have the username on woth Kamailio and Asterisk to be the same, but it might be useful to have multiple Kamailio subscribers with the same mailbox, so this should work with uac rewriting.
On 12/4/12 6:43 PM, Daniel Tryba wrote:
On Tuesday 04 December 2012 17:49:43 Daniel-Constantin Mierla wrote:
The only difference is that there is no error in syslog since the uac_* commands aren't executed a second time. The second subscribe will not be rewritten when restore mode is either manual or auto if uac_* are conditional:
Can you get a ngrep of the first and second SUBSCRIBE? It will help to troubleshoot and see what could be the issue.
Those were attached to my mail that started this thread: http://lists.sip-router.org/pipermail/sr-users/2012-November/075839.html
I see it now -- first time I read only the top of the message, replying to the part related to the error messages.
Quick look over the sources, I can't see a reason of not changing the headers. Can you set debug=3 and then give the log messages printed when the re-SUBSCRIBE is processed?
Cheers, Daniel
But it might be better if I create a simple config that reproduces my problem. I'll try to find the time to create one tomorrow.
My current workaround is to have the username on woth Kamailio and Asterisk to be the same, but it might be useful to have multiple Kamailio subscribers with the same mailbox, so this should work with uac rewriting.
On Tuesday 04 December 2012 19:09:18 Daniel-Constantin Mierla wrote:
Quick look over the sources, I can't see a reason of not changing the headers. Can you set debug=3 and then give the log messages printed when the re-SUBSCRIBE is processed?
Attached is a fairly minimal .cfg (depends on mysql for subscriber data and changes to voicemail.srv_(ip|port)). Lines of interest are 780:801. Any username will be rewritten to test (which is a sip and voicemail user on the asterisk voicemail server).
subscribe.txt contains the 2 sequential subscriptions from the sip device connected to kamailio. First attempt works perfect, the second one fails.
Can't tell if anything useful is logged if uac_* is optional by checking has_to_tag(). See log.txt