[SR-Users] Foward REGISTER to all dispatcher members

Daniel-Constantin Mierla miconda at gmail.com
Mon Sep 15 11:46:16 CEST 2014


Hello,

On 15/09/14 08:33, Kees Meijs - SIGNET B.V. wrote:
> Dear list members,
>
> Currently I'm using the dispatcher module to distribute traffic 
> towards media servers (being Asterisk, in my case). I'd like to 
> forward REGISTER requests to all (active) dispatcher members, e.g. 
> using a short and simple while loop.
>
> Could someone please give me some pointers towards the right 
> direction? Is it for example possible to use the MI di_list 
> functionality for iterating over all the members?
you can call ds_select_dst() for register request. The first selected 
gateway is in dst_uri ($du), so that can be simply relayed.

Then you can access the rest of the destination via $avp(name) you sent 
to dst_avp parameter:

- 
http://kamailio.org/docs/modules/stable/modules/dispatcher.html#dispatcher.p.dst_avp

In a while loop, you can append branches to register before relaying:

while($avp(name)!=$null) {
    ... # appends branch, etc..
    $avp(name) = $null);
}
Iirc, also first selected destination is in this avp list, so you may  
need to skip first entry.

Cheers,
Daniel

-- 
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Next Kamailio Advanced Trainings 2014 - http://www.asipto.com
Sep 22-25, Berlin, Germany




More information about the sr-users mailing list