Sponsor: VoiceMeUp - Corporate & Wholesale VoIP Services

VoIP Mailing List Archives
Mailing list archives for the VoIP community
 SearchSearch 

[Freeswitch-users] Multiple DIDs per SIP trunk (how to configure?)


 
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> freeSWITCH Users
View previous topic :: View next topic  
Author Message
vladrodionov at gmail.com
Guest





PostPosted: Wed Aug 05, 2009 8:12 pm    Post subject: [Freeswitch-users] Multiple DIDs per SIP trunk (how to confi Reply with quote

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
Back to top
dujinfang at gmail.com
Guest





PostPosted: Wed Aug 05, 2009 8:33 pm    Post subject: [Freeswitch-users] Multiple DIDs per SIP trunk (how to confi Reply with quote

mod_easyroute?

2009/8/6 Vladimir Rodionov <vladrodionov@gmail.com (vladrodionov@gmail.com)>
Quote:
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 (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

Back to top
vladrodionov at gmail.com
Guest





PostPosted: Wed Aug 05, 2009 9:06 pm    Post subject: [Freeswitch-users] Multiple DIDs per SIP trunk (how to confi Reply with quote

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:

Quote:
<!-- Launch a JavaScript application if dialed in--> <extension name="ProviderABC"> <condition field="source" expression="mod_sofia"/> <condition field="destination_number" expression="^1NXXNXXXXXX$">
<action application="javascript" data="/usr/local/freeswitch/scripts/myapp.js"/> </condition> </extension>

In provider configuration:

Quote:
<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="1NXXNXXXXXX"/> <!--/// 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 <dujinfang@gmail.com (dujinfang@gmail.com)> wrote:
Quote:
mod_easyroute?

2009/8/6 Vladimir Rodionov <vladrodionov@gmail.com (vladrodionov@gmail.com)>
Quote:

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 (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 (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

Back to top
msc at freeswitch.org
Guest





PostPosted: Wed Aug 05, 2009 10:50 pm    Post subject: [Freeswitch-users] Multiple DIDs per SIP trunk (how to confi Reply with quote

On Wed, Aug 5, 2009 at 8:57 PM, Vladimir Rodionov <vladrodionov@gmail.com (vladrodionov@gmail.com)> wrote:
Quote:
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
Back to top
pete at privateconnect...
Guest





PostPosted: Wed Aug 05, 2009 10:50 pm    Post subject: [Freeswitch-users] Multiple DIDs per SIP trunk (how to confi Reply with quote

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

Quote:
-------- Original Message --------
Subject: Re: [Freeswitch-users] Multiple DIDs per SIP trunk (how to
configure?)
From: Vladimir Rodionov <vladrodionov@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:

Quote:
<!-- Launch a JavaScript application if dialed in--> <extension name="ProviderABC"> <condition field="source" expression="mod_sofia"/> <condition field="destination_number" expression="^1NXXNXXXXXX$">
<action application="javascript" data="/usr/local/freeswitch/scripts/myapp.js"/> </condition> </extension>

In provider configuration:

Quote:
<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="1NXXNXXXXXX"/> <!--/// 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 <dujinfang@gmail.com (dujinfang@gmail.com)> wrote:
Quote:
mod_easyroute?

2009/8/6 Vladimir Rodionov <vladrodionov@gmail.com (vladrodionov@gmail.com)>
Quote:

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 (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 (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

Back to top
vladrodionov at gmail.com
Guest





PostPosted: Thu Aug 06, 2009 11:13 am    Post subject: [Freeswitch-users] Multiple DIDs per SIP trunk (how to confi Reply with quote

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 <pete@privateconnect.com (pete@privateconnect.com)> wrote:
Quote:
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

Quote:
-------- Original Message --------
Subject: Re: [Freeswitch-users] Multiple DIDs per SIP trunk (how to
configure?)
From: Vladimir Rodionov <vladrodionov@gmail.com (vladrodionov@gmail.com)>
Date: Wed, August 05, 2009 6:57 pm
To: freeswitch-users@lists.freeswitch.org (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:

Quote:
<!-- Launch a JavaScript application if dialed in--> <extension name="ProviderABC">
<condition field="source" expression="mod_sofia"/> <condition field="destination_number" expression="^1NXXNXXXXXX$">
<action application="javascript" data="/usr/local/freeswitch/scripts/myapp.js"/> </condition> </extension>

In provider configuration:

Quote:
<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="1NXXNXXXXXX"/> <!--/// 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 <dujinfang@gmail.com (dujinfang@gmail.com)> wrote:
Quote:
mod_easyroute?

2009/8/6 Vladimir Rodionov <vladrodionov@gmail.com (vladrodionov@gmail.com)>
Quote:

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 (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 (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 (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 (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

Back to top
vladrodionov at gmail.com
Guest





PostPosted: Thu Aug 06, 2009 11:16 am    Post subject: [Freeswitch-users] Multiple DIDs per SIP trunk (how to confi Reply with quote

Thanks, I will give it it a try and let you know.

On Wed, Aug 5, 2009 at 8:40 PM, Michael Collins <msc@freeswitch.org (msc@freeswitch.org)> wrote:
Quote:


On Wed, Aug 5, 2009 at 8:57 PM, Vladimir Rodionov <vladrodionov@gmail.com (vladrodionov@gmail.com)> wrote:
Quote:
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 (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

Back to top
Display posts from previous:   
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> freeSWITCH Users All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

VoiceMeUp - Corporate & Wholesale VoIP Services