[SR-Users] Trying to understand the interal workings of Dispatcher and timers

Daniel-Constantin Mierla miconda at gmail.com
Mon Dec 16 14:01:55 CET 2013


Hello,

On 11/12/13 16:21, Grant Bagdasarian wrote:
>
> Hello,
>
> I'm trying to understand how the dispatcher module works and how the 
> timers in the TM module influence the behavior.
>
> My architecture looks like this:
>
> UA1 ---- SBC1 ---- Kamailio ----- SBC2 ---- FreeSWITCH App Server(x2)
>
> What I got so far:
>
> 1)UA1 sends an INVITE to SBC1, which bridges the call between the UA1 
> and Kamailio
>
> 2)INVITE is received by Kamailio.
>
> 3)Kamailio looks in its dispatcher table to dispatch the INVITE to its 
> destination
>
> 4)Kamailio rewrites the $du value to that of the SBC2
>
> 5)Kamailio rewrites the request-uri and sends the INVITE to the 
> destination in $du.
>
> 6)SBC2 is a FreeSWITCH instance which bridges the call (does not 
> answer). It only responds back with a 100 TRYING
>
> 7)SBC2 tries to contact the endpoint (FS App Server 1) in the 
> request-uri, but the destination does not respond because it is 
> unavailable.
>
> 8)Kamailio keeps waiting for a final reply.
>
> 9)The fr_inv_timer is set to 5000 on startup
>
> 10)Once the timer hits, Kamailio executes the route set in t_failure_route
>
> 11)The failure route looks like this:
>
> if(t_is_expired()) { ... }
>
>                 if (t_is_canceled()) { ... }
>
>                 if(t_check_status("500") || t_branch_timeout() || 
> !t_branch_replied()) {
>
>                                 ....
>
>                 }
>
> 12)Kamailio enters the third if block in which the next domain is 
> selected and the $du is rewritten again to that of SBC2
>
> 13)A new INVITE is generated and sent to its destination (FS App 
> Server 2) through SBC2. Nothing is sent back to SBC1 yet, because 
> Kamailio handles the failover here.
>
> Is this correct?
>
> Are there any other timers which are fired which I missed, or does the 
> fr_inv_timer have nothing to do with this?
>
> If Kamailio is supposed to load balance between FS App Server 1 and 2 
> using the Round-Robin algorithm, does it in case of an unreachable 
> first destination take the next destination in the route set?
>
fr_inv_timer is more like ringing time. fr_timer is how long to try 
until there is a reaction from next hop.

In case on round robin, next destination is selected if you do it in the 
failure route with ds_next_domain() or ds_next_dst().

Cheers,
Daniel

-- 
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20131216/00950bc4/attachment.html>


More information about the sr-users mailing list