Re: [Freeswitch-users] Multiple DIDs per SIP trunk (how to configure?)
Pete, Thank you for script. I can not find find channel variables rdnis, sip_to_user and all others which start with sb on wiki page http://wiki.freeswitch.org/wiki/Channel_Variables Are they undocumented? -Vladimir Rodionov On Wed, Aug 5, 2009 at 8:45 PM, Pete Mueller p...@privateconnect.comwrote: Disclaimer: I'm not familiar with all the mods of FS, There may be one that does this already. There are probably many ways to do this, I am just offering one that works well for me. Item #1 - Findout the callee #. 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. To make matters worse, different gateways set fields differently when they hand off the call. 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. I had to write something relatively generic, so I moved all processing to a script (see #3 below) 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. You cannot looks for just numbers. Item #3 - Routing. 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. I handled this by creating a small DB table (using postgreSQL) and connecting using LUA and luasql. The table has three fields: number, gateway, and extension to route to. 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. The switchboard script matches rdnis and sip_to_user to find the callee and then performs a lookup for the extension to route to. If you would like a copy of my switchboard script I can provide it to you in a PM. -pete Original Message Subject: Re: [Freeswitch-users] Multiple DIDs per SIP trunk (how to configure?) From: Vladimir Rodionov vladrodio...@gmail.com Date: Wed, August 05, 2009 6:57 pm To: freeswitch-users@lists.freeswitch.org No, it is more like static routing. I need my *script program* be invoked when somebody dial in. That is it. One script for all inbound DIDs. Suppose I have thousand of them. I think I know how to accomplish this but I am not sure yet. in my dialplan I need to define: !-- Launch a JavaScript application if dialed in-- extension name=ProviderABC condition field=source expression=mod_sofia/ *condition field=destination_number expression=^1NXXNXX$* action application=javascript data=/usr/local/freeswitch/scripts/myapp.js/ /condition /extension In provider configuration: gateway name=voicepulse !--/// account username *required* ///-- param name=username value=your-username/ !--/// auth realm: *optional* same as gateway name, if blank ///-- param name=realm value=nyc.voicepulse.com/ !--/// account password *required* ///-- param name=password value=your-password/ !--/// extension for inbound calls: *optional* same as username, if blank ///-- * * *param name=extension value=1NXXNXX/ * !--/// proxy host: *optional* same as realm, if blank ///-- param name=proxy value=nyc.voicepulse.com/ !--/// expire in seconds: *optional* 3600, if blank ///-- param name=expire-seconds value=600/ param name=register value=true/ /gateway Something like this, yes? I can use regular expressions in destination_number? 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. TIA, -Vladimir Rodionov On Wed, Aug 5, 2009 at 6:26 PM, Seven Du dujinf...@gmail.com wrote: mod_easyroute? 2009/8/6 Vladimir Rodionov vladrodio...@gmail.com Hi, everybody 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, I want to acomplish the following: 1. Avoid re-configuring FS every time I got new bunch of DIDs assigned/released from/to my Voip provider. 2. Have a way of extracting CalleeID in my script. TIA, Vladimir Rodionov
Re: [Freeswitch-users] Multiple DIDs per SIP trunk (how to configure?)
Thanks, I will give it it a try and let you know. On Wed, Aug 5, 2009 at 8:40 PM, Michael Collins m...@freeswitch.org wrote: On Wed, Aug 5, 2009 at 8:57 PM, Vladimir Rodionov vladrodio...@gmail.comwrote: No, it is more like static routing. I need my *script program* be invoked when somebody dial in. That is it. One script for all inbound DIDs. Suppose I have thousand of them. I think I know how to accomplish this but I am not sure yet. Have the external profile be used only for provider ABC, or define a new profile. Then in the profile have the calls go to a specific context. You could have something like this in the sip profile definition: param name=context value=abc_calls/ Then create a dialplan context called abc_calls that handles all inbound calls. Create a file in conf/dialplan/ called abc_calls.xml: include context name=abc_calls extension name=abc_calls condition field=destination_number expression=^(.*)$ action application=lua data=myscript.lua/ /condition /extension /context /include Essentially you're just creating a SIP profile and a dialplan context that are servicing your VoIP provider. You can add other profiles/contexts for other providers if need be. Let us know how it goes... -MC ___ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org ___ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Re: [Freeswitch-users] Multiple DIDs per SIP trunk (how to configure?)
mod_easyroute? 2009/8/6 Vladimir Rodionov vladrodio...@gmail.com Hi, everybody 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, I want to acomplish the following: 1. Avoid re-configuring FS every time I got new bunch of DIDs assigned/released from/to my Voip provider. 2. Have a way of extracting CalleeID in my script. TIA, Vladimir Rodionov ___ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org ___ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Re: [Freeswitch-users] Multiple DIDs per SIP trunk (how to configure?)
No, it is more like static routing. I need my *script program* be invoked when somebody dial in. That is it. One script for all inbound DIDs. Suppose I have thousand of them. I think I know how to accomplish this but I am not sure yet. in my dialplan I need to define: !-- Launch a JavaScript application if dialed in-- extension name=ProviderABC condition field=source expression=mod_sofia/ *condition field=destination_number expression=^1NXXNXX$* action application=javascript data=/usr/local/freeswitch/scripts/myapp.js/ /condition /extension In provider configuration: gateway name=voicepulse !--/// account username *required* ///-- param name=username value=your-username/ !--/// auth realm: *optional* same as gateway name, if blank ///-- param name=realm value=nyc.voicepulse.com/ !--/// account password *required* ///-- param name=password value=your-password/ !--/// extension for inbound calls: *optional* same as username, if blank ///-- * * *param name=extension value=1NXXNXX/ * !--/// proxy host: *optional* same as realm, if blank ///-- param name=proxy value=nyc.voicepulse.com/ !--/// expire in seconds: *optional* 3600, if blank ///-- param name=expire-seconds value=600/ param name=register value=true/ /gateway Something like this, yes? I can use regular expressions in destination_number? 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. TIA, -Vladimir Rodionov On Wed, Aug 5, 2009 at 6:26 PM, Seven Du dujinf...@gmail.com wrote: mod_easyroute? 2009/8/6 Vladimir Rodionov vladrodio...@gmail.com Hi, everybody 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, I want to acomplish the following: 1. Avoid re-configuring FS every time I got new bunch of DIDs assigned/released from/to my Voip provider. 2. Have a way of extracting CalleeID in my script. TIA, Vladimir Rodionov ___ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org ___ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org ___ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Re: [Freeswitch-users] Multiple DIDs per SIP trunk (how to configure?)
On Wed, Aug 5, 2009 at 8:57 PM, Vladimir Rodionov vladrodio...@gmail.comwrote: No, it is more like static routing. I need my *script program* be invoked when somebody dial in. That is it. One script for all inbound DIDs. Suppose I have thousand of them. I think I know how to accomplish this but I am not sure yet. Have the external profile be used only for provider ABC, or define a new profile. Then in the profile have the calls go to a specific context. You could have something like this in the sip profile definition: param name=context value=abc_calls/ Then create a dialplan context called abc_calls that handles all inbound calls. Create a file in conf/dialplan/ called abc_calls.xml: include context name=abc_calls extension name=abc_calls condition field=destination_number expression=^(.*)$ action application=lua data=myscript.lua/ /condition /extension /context /include Essentially you're just creating a SIP profile and a dialplan context that are servicing your VoIP provider. You can add other profiles/contexts for other providers if need be. Let us know how it goes... -MC ___ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org