[OpenSIPS-Users] 3 Questions about dispatcher module

Bogdan-Andrei Iancu bogdan at voice-system.ro
Thu Jul 22 16:56:58 CEST 2010


Hi Peter,

Peter P GMX wrote:
> Hello,
>
> we want to use the dispatcher module for a very simple load balancing
> with hash over callid or round robin (we have also tried the
> load-balancer module but have problems when we want to use it for
> generating 302 redirects).
>
> I have read that the dispatcher module "can be used as a stateless load
> balancer, having no guarantee of fair distribution". However googling
> around I have seen that nevertheless can handle
> invites,progress,ringing,cancels,byes etc. correctly.
>
> Question #1:
> Can I use e.g.
>   if (method=="REGISTER" || method=="INVITE" || method=="CANCEL") {
>     ds_select_dst("2", "0");
>     forward();
>   }
> for this kind of routing in order to ensure that all messages belonging
> to one call are always routed to the same destination?
>   
yes, that is correct, but include all methods (like ACK, BYE, UPDATE, 
PRACK, REFER, etc)
> Question #2:
> When using dispatcher with a database table for the proxies and gateways
> we would like to disable certain proxies on the fly via the database by
> an external application. Do we have to reload parts of OpenSIPS in order
> to make the dispatcher module become aware of it? How can we do that?
>   
just use the "ds_set_state" MI command to enable/disable destinations at 
runtime - see 
http://www.opensips.org/html/docs/modules/1.6.x/dispatcher.html#id262730.

For more complex changes, use the "ds_reload" to reload the entire table.
> Question #3:
> We would like to send back "302 redirect" for Invites, which are coming
> from external gateways. Thus external gateways can directly communicate
> with the proxy. How can we use the information (hostname, port etc) from
> "ds_select_dst" in order to send back a 302 redirect message. I know it
> is somehow stored in an AVP, but I have no example how the get the host
> and port part out of it. Can you provide an example?
>   
use ds_select_domain() to get the RURI changed and simply do a 
sl_send_reply("302","Redirected"); -> RURI will be automatically copied 
as Contact in 30x reply.

Regards,
Bogdan
> Best regards
> Peter
>
>
>
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>   


-- 
Bogdan-Andrei Iancu
OpenSIPS Bootcamp
20 - 24 September 2010, Frankfurt, Germany
www.voice-system.ro




More information about the Users mailing list