[OpenSIPS-Users] local_route not being called

Muhammad Shahzad shaheryarkh at gmail.com
Thu Jul 25 20:29:31 CEST 2013


There are many circumstances, for example,

1. You are using loadbalancer / dispatcher module, which send SIP keep
alive requests (e.g. OPTIONS or INFO message) to destination to determine
that are still available.
2. You are using media proxy / rtpproxy with media timeouts enabled, so if
media proxy / rtpproxy does not receives rtp and timeout occurs, it
triggers a BYE requests to end the call. Which you many want to track in
local_route to do accounting etc.
3. You are using dialog module with "B" flag enabled in create_dialog
method, which will result in BYE request to end points when dialog timeouts
(same way as above).
4. You are using B2BUA or topo-hiding  setup, which will result in all SIP
request duplicated but with somewhat different headers / parameters to send
to destination. All those messages will appear in local route where you can
do their accounting etc.

OpenSIPS does not generates any reply on its own, unless in special
circumstances, e.g.

1. It sends 100 Trying when you do t_relay, However, you can force opensips
NOT to send this reply automatically by specifying it a parameter to this
method.
2. It sends 408 upon T2 timer timeout for destination. You can track it in
reply_route to do whatever you want in that situation.

You can generate your own replies overriding the reply that is actually
received from destination in reply_route, or even from route block if you
do not want to (or you can not send to) an incoming request to a
destination at all.

Have a look at tutorials for more information,

http://www.opensips.org/Documentation/Tutorials

Thank you.




On Thu, Jul 25, 2013 at 6:08 PM, Jason Caulfield <opensips at jcpd.biz> wrote:

> Muhammad,
>
> Thanks for the reply.
>
> I guess I don't understand under which circumstances the TM module would
> send out a request message, presumably an INVITE.
>
> Can you please add clarification.
>
> Thanks,
> Jason
>
>
> On Wed, Jul 24, 2013 at 6:55 PM, Muhammad Shahzad <shaheryarkh at gmail.com>wrote:
>
>> Local route is invoked by opensips when a REQUEST is generated by TM
>> module internally, NOT the replies. See its description for details,
>>
>> http://www.opensips.org/Documentation/Script-Routes-1-9#toc6
>>
>> Thank you.
>>
>>
>>
>>
>> On Wed, Jul 24, 2013 at 11:42 PM, Jason Caulfield <opensips at jcpd.biz>wrote:
>>
>>> Users,
>>>
>>> I am just getting started with opensips.  (version 1.7 from CentOS 6
>>> epel repo)
>>>
>>> Can you please help me understand why in my code (see below) local_route
>>> is not invoked.
>>>
>>> I would expect that local_route would be invoked when a "100 Trying" is
>>> issued, but it is not.
>>>
>>> Below is the config, log out, and network output.
>>>
>>> I am testing it with sipp.
>>>
>>>
>>> Config:
>>>
>>> ####### Global Parameters #########
>>> debug=0
>>> log_stderror=no
>>> log_facility=LOG_LOCAL0
>>> fork=yes
>>> children=12
>>> log_name="TEST"
>>> disable_tcp=yes
>>> port=5060
>>> ###################################
>>>
>>> ####### Modules Section ###########
>>> mpath="/usr/lib/opensips/modules"
>>>
>>> loadmodule "tm.so"
>>> loadmodule "textops.so"
>>> loadmodule "exec.so"
>>>
>>> modparam("tm" , "onreply_avp_mode", 1)
>>> modparam("tm" , "fr_timer", 2)  # Vendor timeout
>>> modparam("tm" , "fr_inv_timer", 2)
>>> modparam("tm" , "enable_stats", 0)
>>> modparam("tm" , "via1_matching", 0)
>>> modparam("tm" , "T1_timer", 500)  # Retransmit interval
>>> modparam("tm" , "T2_timer", 1000)  # Retransmit total duration
>>> ###################################
>>>
>>> ####### Routing Logic #############
>>> route {
>>>         xlog("ROUTE");
>>>         seturi("sip:5555555555 at 10.0.1.27:9003");
>>>         t_relay();
>>> }
>>>
>>> onreply_route {
>>>         xlog("ONREPLY");
>>> }
>>> error_route {
>>>         xlog("ERROR");
>>> }
>>>
>>> local_route {
>>>         xlog("LOCAL");
>>> }
>>> ###################################
>>>
>>>
>>> Log:
>>>
>>> Jul 25 05:34:32 rmps-b TEST[12856]: ROUTE
>>> Jul 25 05:34:32 rmps-b TEST[12855]: ONREPLY
>>> Jul 25 05:34:32 rmps-b TEST[12857]: ONREPLY
>>> Jul 25 05:34:32 rmps-b TEST[12858]: ROUTE
>>> Jul 25 05:34:42 rmps-b TEST[12860]: ROUTE
>>> Jul 25 05:34:42 rmps-b TEST[12861]: ONREPLY
>>>
>>>
>>> Network:
>>>
>>> #
>>> U 10.0.1.27:5060 -> 10.0.1.147:5060
>>> INVITE sip:5555555555 at 10.0.1.147:5060 SIP/2.0.
>>> Via: SIP/2.0/UDP 10.0.1.27:5060;branch=z9hG4bK-10199-4-0.
>>> From: sipp <sip:9123456789 at 10.0.1.27:5060>;tag=10199SIPpTag004.
>>> To: sut <18574921119 at 10.0.1.147:5060>.
>>> Call-ID: 4-10199 at 10.0.1.27.
>>> CSeq: 1 INVITE.
>>> Contact: sip:sipp at 10.0.1.27:5060.
>>> Max-Forwards: 70.
>>> Subject: Performance Test.
>>> Content-Type: application/sdp.
>>> Content-Length:   129.
>>> .
>>> v=0.
>>> o=user1 53655765 2353687637 IN IP4 10.0.1.27.
>>> s=-.
>>> c=IN IP4 10.0.1.27.
>>> t=0 0.
>>> m=audio 6000 RTP/AVP 0.
>>> a=rtpmap:0 PCMU/8000.
>>>
>>> #
>>> U 10.0.1.147:5060 -> 10.0.1.27:5060
>>> SIP/2.0 100 Giving a try.
>>> Via: SIP/2.0/UDP 10.0.1.27:5060;branch=z9hG4bK-10199-4-0.
>>> From: sipp <sip:5555555555 at 10.0.1.27:5060>;tag=10199SIPpTag004.
>>> To: sut <5555555555 at 10.0.1.147:5060>.
>>> Call-ID: 4-10199 at 10.0.1.27.
>>> CSeq: 1 INVITE.
>>> Server: OpenSIPS (1.7.2-tls (i386/linux)).
>>> Content-Length: 0.
>>> .
>>>
>>> #
>>> U 10.0.1.147:5060 -> 10.0.1.27:9003
>>> INVITE sip:5555555555 at 10.0.1.27:9003 SIP/2.0.
>>> Via: SIP/2.0/UDP 10.0.1.147;branch=z9hG4bK580f.8ddd3891.0.
>>> Via: SIP/2.0/UDP 10.0.1.27:5060;branch=z9hG4bK-10199-4-0.
>>> From: sipp <sip:5555555555 at 10.0.1.27:5060>;tag=10199SIPpTag004.
>>> To: sut <5555555555 at 10.0.1.147:5060>.
>>> Call-ID: 4-10199 at 10.0.1.27.
>>> CSeq: 1 INVITE.
>>> Contact: sip:sipp at 10.0.1.27:5060.
>>> Max-Forwards: 70.
>>> Subject: Performance Test.
>>> Content-Type: application/sdp.
>>> Content-Length:   129.
>>> .
>>> v=0.
>>> o=user1 53655765 2353687637 IN IP4 10.0.1.27.
>>> s=-.
>>> c=IN IP4 10.0.1.27.
>>> t=0 0.
>>> m=audio 6000 RTP/AVP 0.
>>> a=rtpmap:0 PCMU/8000.
>>>
>>> #
>>> U 10.0.1.27:9003 -> 10.0.1.147:5060
>>> SIP/2.0 180 Ringing.
>>> Via: SIP/2.0/UDP 10.0.1.147;branch=z9hG4bK580f.8ddd3891.0, SIP/2.0/UDP
>>> 10.0.1.27:5060;branch=z9hG4bK-10199-4-0.
>>> From: sipp <sip:5555555555 at 10.0.1.27:5060>;tag=10199SIPpTag004.
>>> To: sut <5555555555 at 10.0.1.147:5060>;tag=10195SIPpTag014.
>>> Call-ID: 4-10199 at 10.0.1.27.
>>> CSeq: 1 INVITE.
>>> Contact: <sip:10.0.1.27:9003;transport=UDP>.
>>> Content-Length: 0.
>>> .
>>>
>>> #
>>> U 10.0.1.27:9003 -> 10.0.1.147:5060
>>> SIP/2.0 200 OK.
>>> Via: SIP/2.0/UDP 10.0.1.147;branch=z9hG4bK580f.8ddd3891.0, SIP/2.0/UDP
>>> 10.0.1.27:5060;branch=z9hG4bK-10199-4-0.
>>> From: sipp <sip:5555555555 at 10.0.1.27:5060>;tag=10199SIPpTag004.
>>> To: sut <5555555555 at 10.0.1.147:5060>;tag=10195SIPpTag014.
>>> Call-ID: 4-10199 at 10.0.1.27.
>>> CSeq: 1 INVITE.
>>> Contact: <sip:10.0.1.27:9003;transport=UDP>.
>>> Content-Type: application/sdp.
>>> Content-Length:   129.
>>> .
>>> v=0.
>>> o=user1 53655765 2353687637 IN IP4 10.0.1.27.
>>> s=-.
>>> c=IN IP4 10.0.1.27.
>>> t=0 0.
>>> m=audio 6001 RTP/AVP 0.
>>> a=rtpmap:0 PCMU/8000.
>>>
>>> #
>>> U 10.0.1.147:5060 -> 10.0.1.27:5060
>>> SIP/2.0 180 Ringing.
>>> Via: SIP/2.0/UDP 10.0.1.27:5060;branch=z9hG4bK-10199-4-0.
>>> From: sipp <sip:5555555555 at 10.0.1.27:5060>;tag=10199SIPpTag004.
>>> To: sut <5555555555 at 10.0.1.147:5060>;tag=10195SIPpTag014.
>>> Call-ID: 4-10199 at 10.0.1.27.
>>> CSeq: 1 INVITE.
>>> Contact: <sip:10.0.1.27:9003;transport=UDP>.
>>> Content-Length: 0.
>>> .
>>>
>>> #
>>> U 10.0.1.147:5060 -> 10.0.1.27:5060
>>> SIP/2.0 200 OK.
>>> Via: SIP/2.0/UDP 10.0.1.27:5060;branch=z9hG4bK-10199-4-0.
>>> From: sipp <sip:5555555555 at 10.0.1.27:5060>;tag=10199SIPpTag004.
>>> To: sut <5555555555 at 10.0.1.147:5060>;tag=10195SIPpTag014.
>>> Call-ID: 4-10199 at 10.0.1.27.
>>> CSeq: 1 INVITE.
>>> Contact: <sip:10.0.1.27:9003;transport=UDP>.
>>> Content-Type: application/sdp.
>>> Content-Length:   129.
>>> .
>>> v=0.
>>> o=user1 53655765 2353687637 IN IP4 10.0.1.27.
>>> s=-.
>>> c=IN IP4 10.0.1.27.
>>> t=0 0.
>>> m=audio 6001 RTP/AVP 0.
>>> a=rtpmap:0 PCMU/8000.
>>>
>>> #
>>> U 10.0.1.27:5060 -> 10.0.1.147:5060
>>> ACK sip:5555555555 at 10.0.1.147:5060 SIP/2.0.
>>> Via: SIP/2.0/UDP 10.0.1.27:5060;branch=z9hG4bK-10199-4-5.
>>> From: sipp <sip:5555555555 at 10.0.1.27:5060>;tag=10199SIPpTag004.
>>> To: sut <5555555555 at 10.0.1.147:5060>.
>>> Call-ID: 4-10199 at 10.0.1.27.
>>> CSeq: 1 ACK.
>>> Contact: sip:sipp at 10.0.1.27:5060.
>>> Max-Forwards: 70.
>>> Subject: Performance Test.
>>> Content-Length: 0.
>>> .
>>>
>>> #
>>> U 10.0.1.147:5060 -> 10.0.1.27:9003
>>> ACK sip:5555555555 at 10.0.1.27:9003 SIP/2.0.
>>> Via: SIP/2.0/UDP 10.0.1.147;branch=z9hG4bK580f.8ddd3891.2.
>>> Via: SIP/2.0/UDP 10.0.1.27:5060;branch=z9hG4bK-10199-4-5.
>>> From: sipp <sip:5555555555 at 10.0.1.27:5060>;tag=10199SIPpTag004.
>>> To: sut <5555555555 at 10.0.1.147:5060>.
>>> Call-ID: 4-10199 at 10.0.1.27.
>>> CSeq: 1 ACK.
>>> Contact: sip:sipp at 10.0.1.27:5060.
>>> Max-Forwards: 70.
>>> Subject: Performance Test.
>>> Content-Length: 0.
>>> .
>>>
>>> #
>>> U 10.0.1.27:5060 -> 10.0.1.147:5060
>>> BYE sip:5555555555 at 10.0.1.147:5060 SIP/2.0.
>>> Via: SIP/2.0/UDP 10.0.1.27:5060;branch=z9hG4bK-10199-4-7.
>>> From: sipp <sip:5555555555 at 10.0.1.27:5060>;tag=10199SIPpTag004.
>>> To: sut <5555555555 at 10.0.1.147:5060>.
>>> Call-ID: 4-10199 at 10.0.1.27.
>>> CSeq: 2 BYE.
>>> Contact: sip:sipp at 10.0.1.27:5060.
>>> Max-Forwards: 70.
>>> Subject: Performance Test.
>>> Content-Length: 0.
>>> .
>>>
>>> #
>>> U 10.0.1.147:5060 -> 10.0.1.27:9003
>>> BYE sip:5555555555 at 10.0.1.27:9003 SIP/2.0.
>>> Via: SIP/2.0/UDP 10.0.1.147;branch=z9hG4bK280f.81db1714.0.
>>> Via: SIP/2.0/UDP 10.0.1.27:5060;branch=z9hG4bK-10199-4-7.
>>> From: sipp <sip:5555555555 at 10.0.1.27:5060>;tag=10199SIPpTag004.
>>> To: sut <5555555555 at 10.0.1.147:5060>.
>>> Call-ID: 4-10199 at 10.0.1.27.
>>> CSeq: 2 BYE.
>>> Contact: sip:sipp at 10.0.1.27:5060.
>>> Max-Forwards: 70.
>>> Subject: Performance Test.
>>> Content-Length: 0.
>>> .
>>>
>>> #
>>> U 10.0.1.27:9003 -> 10.0.1.147:5060
>>> SIP/2.0 200 OK.
>>> Via: SIP/2.0/UDP 10.0.1.147;branch=z9hG4bK280f.81db1714.0, SIP/2.0/UDP
>>> 10.0.1.27:5060;branch=z9hG4bK-10199-4-7.
>>> From: sipp <sip:5555555555 at 10.0.1.27:5060>;tag=10199SIPpTag004.
>>> To: sut <5555555555 at 10.0.1.147:5060>.
>>> Call-ID: 4-10199 at 10.0.1.27.
>>> CSeq: 2 BYE.
>>> Contact: <sip:10.0.1.27:9003;transport=UDP>.
>>> Content-Length: 0.
>>> .
>>>
>>> #
>>> U 10.0.1.147:5060 -> 10.0.1.27:5060
>>> SIP/2.0 200 OK.
>>> Via: SIP/2.0/UDP 10.0.1.27:5060;branch=z9hG4bK-10199-4-7.
>>> From: sipp <sip:5555555555 at 10.0.1.27:5060>;tag=10199SIPpTag004.
>>> To: sut <5555555555 at 10.0.1.147:5060>.
>>> Call-ID: 4-10199 at 10.0.1.27.
>>> CSeq: 2 BYE.
>>> Contact: <sip:10.0.1.27:9003;transport=UDP>.
>>> Content-Length: 0.
>>>
>>>
>>> Thanks,
>>> Jason
>>>
>>> _______________________________________________
>>> Users mailing list
>>> Users at lists.opensips.org
>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>
>>>
>>
>>
>> --
>> Mit freundlichen Grüßen
>> Muhammad Shahzad
>> -----------------------------------
>> CISCO Rich Media Communication Specialist (CRMCS)
>> CISCO Certified Network Associate (CCNA)
>> Cell: +49 176 99 83 10 85
>> MSN: shari_786pk at hotmail.com
>> Email: shaheryarkh at googlemail.com
>>
>> _______________________________________________
>> Users mailing list
>> Users at lists.opensips.org
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>
>>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>


-- 
Mit freundlichen Grüßen
Muhammad Shahzad
-----------------------------------
CISCO Rich Media Communication Specialist (CRMCS)
CISCO Certified Network Associate (CCNA)
Cell: +49 176 99 83 10 85
MSN: shari_786pk at hotmail.com
Email: shaheryarkh at googlemail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20130725/8cf6733e/attachment-0001.htm>


More information about the Users mailing list