Discussion:
[SR-Users] Foward REGISTER to all dispatcher members
Kees Meijs - SIGNET B.V.
2014-09-15 06:33:00 UTC
Permalink
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?

Thanks in advance!

Best regards,
Kees
Daniel-Constantin Mierla
2014-09-15 09:46:16 UTC
Permalink
Hello,
Post by Kees Meijs - SIGNET B.V.
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
Loading...