[Freeswitch-users] Dynamic specify the outbound GW within source code

fieldpeak fieldpeak at gmail.com
Fri Jan 20 09:07:27 MSK 2012


Avi,

Can you please give any advise, thanks !

Cheers,
Charles

2012/1/9 fieldpeak <fieldpeak at gmail.com>

> Hi Avi,
>
> Thanks so much for your kindly reply.
>
> Actually, now i'm using mod_nibble for billing, i write a function
> "check_billing_before_routing" in nibble_state_handler, in this
> func("check_billing_before_routing"), it will call an external command,
> this command will query the backend database if the caller has enough money
> to contiue the call, the mod_nibblebill will contiue the call or hangup the
> call according to the result of the external command. i have realize all
> above, it works well.
>
> switch_state_handler_table_t nibble_state_handler = {
>     /* on_init */ NULL,
>     /* on_routing */ check_billing_before_routing, /* Need to add a check
> here for anything in their account before routing */
>     /* on_execute */ sched_billing,     /* Turn on heartbeat for this
> session and do an initial account check */
>     /* on_hangup */ process_hangup,     /* On hangup - most important
> place to go bill */
>     /* on_exch_media */ NULL,
>     /* on_soft_exec */ NULL,
>     /* on_consume_med */ NULL,
>     /* on_hibernate */ NULL,
>     /* on_reset */ NULL,
>     /* on_park */ NULL,
>     /* on_reporting */ NULL,
>     /* on_destroy */ NULL
> };
>
> For PSTN call, i use dial plan below, "1.2.3.4" is the PSTN-GW
>
>
> <extension name="CallToPSTN" >
>    <condition field="destination_number" expression="^(0\d+)$" >
>        <action application="bridge" data="sofia/internal/$1 at 1.2.3.4" />
>    </condition>
> </extension>
>
> Now, as we add one more PSTN-GW for outbound call, and the FS have to
> route call to the specific GW accoring to result of the external command
> (the external command will return the IP address of GW as well),
>
> i can think out the FS own function like
> "switch_channel_set_variable(channel, "caller_id_number")" can configure
> the value of variable, however, what variable should i use for this case,
> could you please advise, thank you very much!
>
> Regards,
> Charels
>
> 2012/1/8 Avi Marcus <avi at avimarcus.net>
>
>> I'm not quite sure of the use case. Do any of these help?
>> 1) specify a server, not an IP, and then let DNS determine where it goes.
>> 2) use a small lua script to set the channel variable based on whatever
>> you need - an sql query, some logic.. and then use that variable in the
>> bridge string.
>>
>> Those help? If not, please explain more what problem you are trying to
>> solve.
>>
>> -Avi
>>
>>
>> On Sun, Jan 8, 2012 at 3:34 PM, fieldpeak <fieldpeak at gmail.com> wrote:
>>
>>> Dear friends,
>>>
>>> i have FS for PSTN outbound call using below dial plan,
>>>
>>> <extension name="CallToPSTN" >
>>>    <condition field="destination_number" expression="^(0\d+)$" >
>>>        <action application="bridge" data="sofia/internal/$1 at 1.2.3.4" />
>>>    </condition>
>>> </extension>
>>>
>>> While, now i need dynamically specify the outbound GW’s IP address
>>> according to the return result of the external command before routing in
>>> the source code , e.g. if the external command return FS the IP address of
>>> OB GW 6.7.8.9, then
>>>
>>> <action application="bridge" data="sofia/internal/$1 at 6.7.8.9" />
>>>
>>> however, i don't know which function i should call within the source
>>> code to realize it, could anybody help to advise,
>>>
>>> P.S. i know there is existing module “mod_xml_curl” can realize similar
>>> function, however, I could not use it for this case…
>>>
>>>
>>> thanks a lot!
>>>
>>> Regards,
>>> Charles
>>>
>>> _________________________________________________________________________
>>> Professional FreeSWITCH Consulting Services:
>>> consulting at freeswitch.org
>>> http://www.freeswitchsolutions.com
>>>
>>> 
>>> 
>>>
>>> Official FreeSWITCH Sites
>>> http://www.freeswitch.org
>>> http://wiki.freeswitch.org
>>> http://www.cluecon.com
>>>
>>> FreeSWITCH-users mailing list
>>> FreeSWITCH-users at lists.freeswitch.org
>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>>> http://www.freeswitch.org
>>>
>>>
>>
>> _________________________________________________________________________
>> Professional FreeSWITCH Consulting Services:
>> consulting at freeswitch.org
>> http://www.freeswitchsolutions.com
>>
>> 
>> 
>>
>> Official FreeSWITCH Sites
>> http://www.freeswitch.org
>> http://wiki.freeswitch.org
>> http://www.cluecon.com
>>
>> FreeSWITCH-users mailing list
>> FreeSWITCH-users at lists.freeswitch.org
>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>> http://www.freeswitch.org
>>
>>
>
>
> --
> Regards,
> Charles
>
>


-- 
Regards,
Charles
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20120120/a5153a27/attachment.html 


Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list