Avi,<br><br>Can you please give any advise, thanks !<br><br>Cheers,<br>Charles<br><br><div class="gmail_quote">2012/1/9 fieldpeak <span dir="ltr">&lt;<a href="mailto:fieldpeak@gmail.com">fieldpeak@gmail.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi <span style="font-family:Verdana,Arial,Helvetica,sans-serif"><span style="font-size:small">Avi,<br><br>Thanks so much for your kindly reply.<br>
<br>Actually, now i&#39;m using mod_nibble for billing, i write a function &quot;check_billing_before_routing&quot; in nibble_state_handler, in this func(&quot;check_billing_before_routing&quot;), 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. <br>

<br>switch_state_handler_table_t nibble_state_handler = {<br>    /* on_init */ NULL,<br>    /* on_routing */ check_billing_before_routing, /* Need to add a check here for anything in their account before routing */<br>    /* on_execute */ sched_billing,     /* Turn on heartbeat for this session and do an initial account check */<br>

    /* on_hangup */ process_hangup,     /* On hangup - most important place to go bill */<br>    /* on_exch_media */ NULL,<br>    /* on_soft_exec */ NULL,<br>    /* on_consume_med */ NULL,<br>    /* on_hibernate */ NULL,<br>

    /* on_reset */ NULL,<br>    /* on_park */ NULL,<br>    /* on_reporting */ NULL, <br>    /* on_destroy */ NULL<br>};<br><br>For PSTN call, i use dial plan below, &quot;1.2.3.4&quot; is the PSTN-GW<div class="im"><br><br>
&lt;extension name=&quot;CallToPSTN&quot; &gt;<br>
   &lt;condition field=&quot;destination_number&quot; expression=&quot;^(0\d+)$&quot; &gt;<br>       &lt;action application=&quot;bridge&quot; data=&quot;sofia/internal/$<a href="mailto:1@1.2.3.4" target="_blank">1@1.2.3.4</a>&quot; /&gt;<br>

   &lt;/condition&gt;<br>&lt;/extension&gt;<br><br></div>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), <br>

<br>i can think out the FS own function like &quot;switch_channel_set_variable(channel, &quot;caller_id_number&quot;)&quot; can configure the value of variable, however, what variable should i use for this case, could you please advise, thank you very much!<br>

<br>Regards,<br>Charels<br></span></span><div class="HOEnZb"><div class="h5"><br><div class="gmail_quote">2012/1/8 Avi Marcus <span dir="ltr">&lt;<a href="mailto:avi@avimarcus.net" target="_blank">avi@avimarcus.net</a>&gt;</span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">I&#39;m not quite sure of the use case. Do any of these help?<div>1) specify a server, not an IP, and then let DNS determine where it goes.</div><div>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.</div>



<div><br></div><div>Those help? If not, please explain more what problem you are trying to solve.</div><div><br clear="all"><div dir="ltr"><span style="font-family:Verdana,Arial,Helvetica,sans-serif"><span style="font-size:small">-Avi</span></span></div>




<br><br><div class="gmail_quote"><div><div>On Sun, Jan 8, 2012 at 3:34 PM, fieldpeak <span dir="ltr">&lt;<a href="mailto:fieldpeak@gmail.com" target="_blank">fieldpeak@gmail.com</a>&gt;</span> wrote:<br></div>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>

<p class="MsoNormal"><span style="color:#1f497d">Dear
friends,<br>
<br>
i have FS for PSTN outbound call using below dial plan, <br>
<br>
</span>&lt;extension name=&quot;CallToPSTN&quot; &gt;<br>
   &lt;condition field=&quot;destination_number&quot;
expression=&quot;^(0\d+)$&quot; &gt;<br>
       &lt;action application=&quot;bridge&quot;
data=&quot;sofia/internal/$1@<span style="background:yellow">1.2.3.4</span>&quot;
/&gt;<br>
   &lt;/condition&gt;<br>
&lt;/extension&gt;<span style="color:#1f497d"><br>
<br>
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 <span style="background:#ffff33">6.7.8.9</span>, then <br>
<br>
&lt;action application=&quot;bridge&quot; data=&quot;sofia/internal/$1@<span style="background:#ffff33">6.7.8.9</span>&quot; /&gt;<br>
<br>
however, i don&#39;t know which function i should call within the source code to
realize it, could anybody help to advise, </span></p>

<p class="MsoNormal"><span style="color:#1f497d"><span>P.S. </span>i know there is existing module “mod_xml_curl”
can realize similar function, however, I could not use it for this case…</span></p>

<p class="MsoNormal"><span style="color:#1f497d"> </span></p>

<span style="color:#1f497d">thanks a
lot!<br><br>Regards,<br>Charles<br>
</span>
<br></div></div>_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
<a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a><br>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br></div></div>
<br>_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
<a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a><br>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br><br clear="all"><br></div></div><span class="HOEnZb"><font color="#888888">-- <br>Regards,<br>Charles<br><br>
</font></span></blockquote></div><br><br clear="all"><br>-- <br>Regards,<br>Charles<br><br>