<html><body><span style="font-family:Verdana; color:#000000; font-size:10pt;">Disclaimer: I'm not familiar with all the mods of FS, There may be one that does this already.&nbsp; There are probably many ways to do this, I am just offering one that works well for me.<br><br>Item #1 - Findout the callee #.&nbsp;&nbsp; "destination_number" can be set to several different things based on the gateway configuration (forced override with an extension) and may or may not start with a "+" so the example below may not work.&nbsp; To make matters worse, different gateways set fields differently when they hand off the call.&nbsp; The most reliable I've found is "rdnis" or "sip_to_user" , however if you know you are going to stay with one gateway, you can relay on the oddities of the way they are configured.&nbsp; I had to write something relatively generic, so I moved all processing to a script (see #3 below)<br><br>Item #2 - Find the caller ID. This is located in "caller_id_number", but remember in your processing that caller ID may be
"anonymous", "restricted", "unknown" or some other word when dealing with blocked/private numbers.&nbsp; You cannot looks for just numbers.<br><br>Item #3 - Routing.&nbsp; As I mentioned I have 100s of numbers across many gateways, so I needed a way to route the calls to the right places AND know which gateway the call came in on, so I can bridge the call out the same gateway.&nbsp; I handled this by creating a small DB table (using postgreSQL) and connecting using LUA and luasql.&nbsp; The table has three fields: number, gateway, and extension to route to.&nbsp; In my public.xml I list all the places a call can be routed to and the last entry is a unconditional transfer to the "switchboard" script.&nbsp; The switchboard script matches "rdnis" and "sip_to_user" to find the callee and then performs a lookup for the extension to route to.<br><br>If you would like a copy of my switchboard script I can provide it to you in a PM.<br>-pete<br><br>
<blockquote webmail="1" style="border-left: 2px solid blue; margin-left: 8px; padding-left: 8px; font-size: 10pt; color: black; font-family: verdana;">
<div   >
-------- Original Message --------<br>
Subject: Re: [Freeswitch-users] Multiple DIDs per SIP trunk (how to<br>
configure?)<br>
From: Vladimir Rodionov &lt;vladrodionov@gmail.com&gt;<br>
Date: Wed, August 05, 2009 6:57 pm<br>
To: freeswitch-users@lists.freeswitch.org<br>
<br>
No, it is more like static routing. I need my <b>script program</b> be invoked when somebody dial in. That is it. One script for all inbound DIDs. Suppose I have thousand of them.&nbsp; I think I know how to accomplish this but I am not sure yet.<br> <br> in my dialplan I need to define:<br> <br> <pre><font size="4">&lt;!-- Launch a JavaScript application if dialed in--&gt;<br>   &lt;extension name="ProviderABC"&gt;<br>    &lt;condition field="source" expression="mod_sofia"/&gt;<br>    <b>&lt;condition field="destination_number" expression="^1NXXNXXXXXX$"&gt;</b><br>
     &lt;action application="javascript" data="/usr/local/freeswitch/scripts/myapp.js"/&gt;<br>    &lt;/condition&gt;<br>   &lt;/extension&gt;</font><br></pre> <br> In provider configuration:<br> <br> <pre><font size="4">&lt;gateway name="voicepulse"&gt;<br>           &lt;!--/// account username *required* ///--&gt;<br>           &lt;param name="username" value="your-username"/&gt;<br>           &lt;!--/// auth realm: *optional* same as gateway name, if blank ///--&gt;<br>
           &lt;param name="realm" value="<a href="http://nyc.voicepulse.com" target="_blank" mce_href="http://nyc.voicepulse.com">nyc.voicepulse.com</a>"/&gt;<br>           &lt;!--/// account password *required* ///--&gt;<br>           &lt;param name="password" value="your-password"/&gt;<br>
           &lt;!--/// extension for inbound calls: *optional* same as username, if blank ///--&gt;<br><b>           </b> <b>&lt;param name="extension" value="1NXXNXXXXXX"/&gt; </b><br>           &lt;!--/// proxy host: *optional* same as realm, if blank ///--&gt;<br>
           &lt;param name="proxy" value="<a href="http://nyc.voicepulse.com" target="_blank" mce_href="http://nyc.voicepulse.com">nyc.voicepulse.com</a>"/&gt;<br>           &lt;!--/// expire in seconds: *optional* 3600, if blank ///--&gt;<br>           &lt;param name="expire-seconds" value="600"/&gt;<br>
<br>           &lt;param name="register" value="true"/&gt;<br>         &lt;/gateway&gt;</font></pre> <br>Something like this, yes? I can use regular expressions in destination_number?<br><br>Q: There is object Session in JavaScript, Lua. Is Session.destination == destination_number from incoming call? It is not clear for me from what I have read so far.<br> <br>TIA,<br><br>-Vladimir Rodionov<br><br><div class="gmail_quote">On Wed, Aug 5, 2009 at 6:26 PM, Seven Du <font dir="ltr">&lt;<a onclick="return true;if(window.location==top.location){Popup.composeWindow('pcompose.php?sendto=dujinfang%40gmail.com');}else{top.Popup.composeWindow('pcompose.php?sendto=dujinfang%40gmail.com');}; return false;" href="mailto:dujinfang@gmail.com" target="_blank" mce_href="mailto:dujinfang@gmail.com">dujinfang@gmail.com</a>&gt;</font> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> mod_easyroute?<br><br><div class="gmail_quote">2009/8/6 Vladimir Rodionov <font dir="ltr">&lt;<a onclick="return true;if(window.location==top.location){Popup.composeWindow('pcompose.php?sendto=vladrodionov%40gmail.com');}else{top.Popup.composeWindow('pcompose.php?sendto=vladrodionov%40gmail.com');}; return false;" href="mailto:vladrodionov@gmail.com" mce_href="mailto:vladrodionov@gmail.com" target="_blank">vladrodionov@gmail.com</a>&gt;</font><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> <div><div></div><div class="h5"> Hi, everybody<br><br>This is a newbie question: Suppose I have XX (variable dynamic number) DIDs assigned to one sip trunk (from VOIP provider ABC ). All calls coming from VOIP provider ABC MUST be routed to the same lua/js/whatever script. Is it possible in FS? If yes, how everything should be configuered? Dialplan, sip gateway? One more question: suppose it is doeable as I hope then how can I get in my script CalleeID (not a CallerID)? Basicaly, <br> <br>I want to acomplish the following:<br><br>1. Avoid re-configuring FS every time I got new bunch of DIDs assigned/released from/to my Voip provider.<br>2. Have a way of extracting CalleeID in my script.<br><br>TIA,<br> <font color="#888888"> <br>Vladimir Rodionov<br><br> </font><br></div></div>_______________________________________________<br> FreeSWITCH-users mailing list<br> <a onclick="return true;if(window.location==top.location){Popup.composeWindow('pcompose.php?sendto=FreeSWITCH-users%40lists.freeswitch.org');}else{top.Popup.composeWindow('pcompose.php?sendto=FreeSWITCH-users%40lists.freeswitch.org');}; return false;" href="mailto:FreeSWITCH-users@lists.freeswitch.org" mce_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" mce_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" mce_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" mce_href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br> <br></blockquote></div><br> <br>_______________________________________________<br> FreeSWITCH-users mailing list<br> <a onclick="return true;if(window.location==top.location){Popup.composeWindow('pcompose.php?sendto=FreeSWITCH-users%40lists.freeswitch.org');}else{top.Popup.composeWindow('pcompose.php?sendto=FreeSWITCH-users%40lists.freeswitch.org');}; return false;" href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank" mce_href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br> <a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" mce_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" mce_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" mce_href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br> <br></blockquote></div><br> <hr>_______________________________________________<br>
FreeSWITCH-users mailing list<br>
FreeSWITCH-users@lists.freeswitch.org<br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank" mce_href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank" mce_href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank" mce_href="http://www.freeswitch.org">http://www.freeswitch.org</a><br>

</div>
</blockquote></span></body></html>