[OpenSIPS-Users] A Dynamic List of Gateways

Ali Pey alipey at gmail.com
Thu Aug 30 16:48:33 CEST 2012


Hi Shaheen,

Does the external system have the list of gateways in a DB of any sort? In
another word, can you lookup the list of gateways with a SQL query?

You can use avops module to do a db query to retrieve the list of gateways
in the desired order and route the calls in that order. Other than that,
Perl would be your best friend here.

Regards,
Ali Pey


On Thu, Aug 30, 2012 at 10:09 AM, Shaahin Madani
<shaahin.madani at gmail.com>wrote:

> Hi Bogdan and Brett,
>
> Thanks for your replies. The issue here is that my OpenSIPS simply does
> not have the list of gateways, that is the gateways are *not* available in
> the dr_gateways table. For every INVITE request, the list of gateways
> must be dynamically built, and only afterwards the actual dynamic routing
> can take place. The logic behind building the list of gateways relies on a
> totally separate database.
> To sum it up, I would say the desired scenario would resemble the steps
> below:
>
> 1) OpenSIPS receives an INVITE
> 2) OpenSIPS asks an external system (e.g. the Perl script) for the
> gateways available for this specific INVITE request
> 3) A list of gateways is returned to OpenSIPS (based on some black-box
> logic)
> 4) OpenSIPS dynamically routes the INVITE to the specified gateways,
> prioritising based on cost, time, or ...
>
> I wonder whether in step (3) the list can actually be returned to OpenSIPS
> for further processing in the script, or both steps (3) and (4) must be
> implemented in the Perl script. Anyway, that is the desired scenario, which
> must be changed according to the limitations. Any guidance would be much
> appreciated.
>
> Regards,
> Shaahin
>
>
> On Thu, Aug 30, 2012 at 11:10 PM, Brett Nemeroff <brett at nemeroff.com>wrote:
>
>> You haven't really said why the drouting module won't work. Why do you
>> say the system won't know the gateway list itself? Where is this
>> complicated business logic?
>>
>> Chances are between memcache and db queries you can do what you want. If
>> you want to use drouting to store the gateway list, but not use the
>> dr_rules logic, you can sort of do that as well, but you'll have to play
>> tricks with what rules you use.
>>
>> Also if the gateway's IPs are changing and the dr_gateways/dr_carriers
>> tables don't meet your needs, you could always use the attrs column or even
>> the gw_id_avp/rule_id_avp/carrier_id_avp to simply look something else up
>> and just ignore (read: rewrite on your own) the destination.
>>
>> I'm not sure how you are proposing to use your perl module. I wouldn't
>> use the exec module for any realtime in call lookups *ever* (and I'm a big
>> perl fan). The perl module is pretty cool, but I don't think it's
>> maintained and you won't get the best performance from it I don't think
>> (would love to hear other's opinions here).
>>
>> Maybe if you told us a little bit about your complicated business logic,
>> we may be able to provide more guidance?
>> -Brett
>>
>>
>> On Thu, Aug 30, 2012 at 7:07 AM, Shaahin Madani <shaahin.madani at gmail.com
>> > wrote:
>>
>>>
>>> I understand that forwarding calls to a certain gateway can be achieved
>>> using the rewritehostport(…) function; and that
>>> prefix-/caller-/group-/time-/priority-based dynamic routing can be
>>> addressed using the DROUTING module. However, in my system what
>>> actually is “dynamic” is the gateway list itself, which is therefore not a
>>> subset of the dr_gateways table. In fact, OpenSIPS has no idea about
>>> the list of gateways due to the complex business-logic involved. The
>>> dynamic gateway list, nevertheless, needs to be treated identical to an
>>> ordinary one, i.e. prefix, time and priority of gateways must be considered.
>>>
>>>
>>>
>> _______________________________________________
>> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20120830/d01ca18c/attachment.htm>


More information about the Users mailing list