SIP Timeout on bad IPAddress/Port

297 views
Skip to first unread message

frank.of...@caseris.de

unread,
Feb 10, 2010, 11:05:48 AM2/10/10
to UniMRCP
Hello Unimrcp Group,

currently I am investigating why it takes about 32 seconds (under windows) before I get a response on mrcp_application_channel_add when the ipaddress or the port is bad.
I am looking for a way to reduce this time.

The nua_invite function is the place I think I have to change.
So I tried adding NUTAG_RETRY_COUNT or NUTAG_INVITE_TIMER in nua_invite itself or via nua_set_hparams.
Nothing seems to change the behaviour. Via Wireshark I see some "Request: Invite sip:..." and as an answer "ICMP Destination unreachable (Port unreachable)" when I specified a wrong port.

Is there a way to reduce the time SIP needs to return an error?

Best regards,
Frank Offermanns

Arsen Chaloyan

unread,
Feb 12, 2010, 2:43:57 AM2/12/10
to uni...@googlegroups.com
Hello Frank,

First of all, I wanted to mention that your last 3 messages were held
for moderation by Google Groups. Obviously, neither of them contains
suspicious content. I guess non ASCII characters in one of your emails
made not so intellectual analyzers wrongly think that your messages
should be moderated. Although I've responded with "always allow" 3
times in a row, it doesn't seem to help so far...

Now lets proceed with SIP timeouts below

On Wed, Feb 10, 2010 at 8:05 PM, <frank.of...@caseris.de> wrote:
> Hello Unimrcp Group,
>
> currently I am investigating why it takes about 32 seconds (under windows)
> before I get a response on mrcp_application_channel_add when the ipaddress
> or the port is bad.
> I am looking for a way to reduce this time.

Actually, SIP specification defines several request timeouts such as
T1, T2 and T4. Sofia-SIP gracefully supports all of them. 32 seconds
come from T1 * 64, where the default T1 timeout is 500 msec. So
everything is right there.


>
> The nua_invite function is the place I think I have to change.
> So I tried adding NUTAG_RETRY_COUNT or NUTAG_INVITE_TIMER in nua_invite
> itself or via nua_set_hparams.
> Nothing seems to change the behaviour. Via Wireshark I see some "Request:
> Invite sip:..." and as an answer "ICMP Destination unreachable (Port
> unreachable)" when I specified a wrong port.

You should set NTATAG_SIP_T1X64() tag to alter this behavior.
nua_set_params(
sofia_agent->nua,
NUTAG_AUTOANSWER(0),
NUTAG_APPL_METHOD("OPTIONS"),
NTATAG_SIP_T1X64(10000),
SIPTAG_USER_AGENT_STR(sofia_agent->config->user_agent_name),
TAG_END());

Sofia-SIP allows other timeouts to be set either. While I think the
defaults are OK, it'd be reasonable to allow to change SIP timeouts
from unimrcp config if needed.

>
> Is there a way to reduce the time SIP needs to return an error?

Another option is to use TCP instead of UDP for SIP. In this case,
you'll get failure response almost immediately.

Best regards
P.S. If your post doesn't appear in the group in a few minutes, feel
free to ping me directly. I'll force it in :)
>
> Best regards,
> Frank Offermanns
>
> --
> You received this message because you are subscribed to the Google Groups
> "UniMRCP" group.
> To post to this group, send email to uni...@googlegroups.com.
> To unsubscribe from this group, send email to
> unimrcp+u...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/unimrcp?hl=en.
>

--
Arsen Chaloyan
The author of UniMRCP
http://www.unimrcp.org

frank.of...@caseris.de

unread,
Feb 12, 2010, 4:33:19 AM2/12/10
to uni...@googlegroups.com
Hello Arsen,

> First of all, I wanted to mention that your last 3 messages were held
> for moderation by Google Groups. Obviously, neither of them contains
> suspicious content. I guess non ASCII characters in one of your emails
> made not so intellectual analyzers wrongly think that your messages
> should be moderated. Although I've responded with "always allow" 3
> times in a row, it doesn't seem to help so far...

Lotus Notes is not my favorite emailprogramm, but I tried to "convince" it
to work correctly :)
So I hope you don't have to moderate this message.


> You should set NTATAG_SIP_T1X64() tag to alter this behavior.
> nua_set_params(
> sofia_agent->nua,
> NUTAG_AUTOANSWER(0),
> NUTAG_APPL_METHOD("OPTIONS"),
> NTATAG_SIP_T1X64(10000),
> SIPTAG_USER_AGENT_STR(sofia_agent->config->user_agent_name),
> TAG_END());

Perfectly, this is exactly what I wanted, thanks a lot!



> Another option is to use TCP instead of UDP for SIP. In this case,
> you'll get failure response almost immediately.

This works even better.
For now I switched to TCP, which is indeed the fastest way to find invalid
servers.

Thanks a lot for your help.
Best regards,
Frank Offermanns

Arsen Chaloyan

unread,
Feb 16, 2010, 2:31:42 AM2/16/10
to uni...@googlegroups.com
FYI, I've made all the relevant SIP timers (timeouts) configurable in
http://code.google.com/p/unimrcp/source/detail?r=1523

You can alter the behavior from unimrcpclient.xml and
unimrcpserver.xml respectively
<sip-t1>500</sip-t1>
<sip-t2>4000</sip-t2>
<sip-t4>4000</sip-t4>
<sip-t1x64>32000</sip-t1x64>

A user friendly description of SIP (RFC3261) timers can be found here
http://www.dialogic.com/support/helpweb/mg/tn951.aspx

frank.of...@caseris.de

unread,
Feb 17, 2010, 4:03:17 AM2/17/10
to uni...@googlegroups.com
Hello Arsen,

thanks a lot for the fast implementation.
Now we are free to decide to use TCP or UDP if we need a (configurable)
fast response if the server is not available.

Best regards,
Frank Offermanns

Reply all
Reply to author
Forward
0 new messages