[Freeswitch-users] Bandwidth Dialplan for inbound calls

James Mortensen james.mortensen at synclio.com
Tue Sep 17 04:58:03 MSD 2013


I wanted to update this thread so that others may be helped by it.  I went
into vars.xml and changed the external profile ports from 5080 and 5081 to
5060 and 5061.  I set the internal ports to 5070 and 5071. I don't believe
internal are being used, but I may be wrong about that.

After making this change, I could get inbound calls from Bandwidth.com,
make outbound calls through Bandwidth.com, and dial from extension 1000 to
another peer at extension 1001.  This is Chrome to PSTN, PSTN to Chrome,
and Chrome to Chrome!

I realize external profiles are for configuration like Bandwidth or other
external entities, so I feel like I have that part setup, so my next step
may be to configure Bandwidth so that the inbound calls terminate at port
5080 instead so I can put the ports back to their defaults. I'm assuming
the FreeSWITCH team has some logical reason for using ports 5080 instead of
5060, but I'm still not 100% sure I understand that part. All I know is it
works.

I've read on the mailing list and other places that swapping the ports
helped people, and one other person suggested putting the Bandwidth gateway
configuration under internal instead, but since the wiki docs say to keep
these gateway configurations in the external profile, I'm thinking that's
probably the safer thing to do.

Since I'm new to FreeSWITCH, I'm taking all the security stuff to heart to
avoid toll fraud.  So I just tried dialing out using a user not listed in
the configuration.  I got back a 403 Forbidden, so I'm assuming that means
anonymous dialing is protected and that things are configured correctly.....

Also, I registered with the default user and confirmed I cannot dial out
through my gateway.  I also removed users 1000-1019 from the directory and
changed the default password to something other than 1234, which is a nice
Spaceballs reference by the way! :) Seems like things are good to go!

I'm hoping the confusion I faced here will help others get through this,
and if there's a way I can get an account on the FreeSWITCH wiki, I'm happy
to help make some tweaks to the documentation to help others who may be
confused, since my confusion is still fresh in my mind, and I know where
the trouble spots are in the documentation! :)

Thanks for the help!

James Mortensen



On Mon, Sep 16, 2013 at 2:28 PM, James Mortensen <
james.mortensen at synclio.com> wrote:

> Hello,
>
> I've gone through the dialplan documentation several times and am having
> trouble getting inbound calls from the PSTN to land on my extension 1000.
>  I've followed the example here as best I can, but what I'm seeing are 482
> Request Merged and Bandwidth continuing to hammer the server with INVITE
> after INVITE.
>
> I've verified the firewall is open and can make outbound calls and calls
> between two Chrome browsers, but seem to have trouble setting up the
> dialplan for PSTN to Chrome.
>
> sip_profiles/external/bandwidth.com.xml:
>
> <include>
>    <gateway name="bandwidth.com">
>      <param name="username" value="your user name"/>
>      <param name="password" value="your password"/>
>      <param name="from-user" value="fromuser"/>
>      <param name="from-domain" value="67.X.X.X"/>
>      <param name="proxy" value="67.X.X.X"/>
>      <param name="expire-seconds" value="600"/>
>      <param name="register" value="false"/>
>      <param name="retry_seconds" value="30"/>
>      <param name="extension" value=""/>
>      <param name="context" value="public"/>
>      <param name="avp" value="true"/>
>    </gateway>
> </include>
>
>
> /dialplan/public/bandwidth.com.xml:
>
> The way I understand this is that I match the number **being called in the
> public context** and then that is transferred to the default context.  The
> number I'm calling is 503389xxxx and in my INVITE it shows as +1503389xxxx.
>  I've tried matching the destination number as XXXxxxxxxx, 503389xxxx, and
> \+1(5033896xxx) but I get the same result every time. Can someone please
> explain how to tell which extension context my calls are going through?
> Putting the console in DEBUG mode doesn't show me how these patterns are
> being matched...
>
> <include>
>   <extension name="bandwidth.com inbound">
>     <condition field="context" data="public"/>
>     <!-- The following line detects the e164 format on incoming calls -->
>     <!-- Note: The leading '+' needs to be escaped by adding a '\' before
> it -->
>     <condition field="destination_number" expression="^(XXXxxxxxxx)$">
>       <action application="set" data="domain_name=$${domain}"/>
>       <action application="transfer" data="$1 XML default"/>
>     </condition>
>   </extension>
>
> </include>
>
>
> /dialplan/default/bandwidth.com.xml:
>
> In the default context, you first see my outbound config, which works like
> a charm. But the second block, taken from Example 9 in the documentation,
> is something I don't quite understand. I'm pattern matching a 10 digit
> number, which is what I'm calling... I've tried matching this to
> XXXxxxxxxx, 503389xxxx and \+1503389xxxx with no change....
>
> <include>
> <extension name="bandwidth.com Outbound 9.10d">
>    <!-- The following line detects outbound calls with a 9 as a dropped
> prefix -->
>    <!-- The line after changes the 10 digit number into 11 digit with a
> leading '+' -->
>    <condition field="destination_number" expression="^9(\d{10})$">
>        <action application="bridge" data="sofia/gateway/bandwidth.com/+1$1
> "/>
>    </condition>
> </extension>
>
>    <!--
> http://wiki.freeswitch.org/wiki/Dialplan_XML#Example_9:_Routing_DID_to_an_extension-->
>      <extension name="Local_Extensioi2">
>      <condition field="destination_number" expression="^(XXXxxxxxxx)$">
>        <action application="set" data="dialed_ext=$1"/>
>      </condition>
>      <condition field="destination_number"
> expression="^${caller_id_number}$">
>        <action application="set"
> data="voicemail_authorized=${sip_authorized}"/>
>        <action application="answer"/>
>        <action application="sleep" data="1000"/>
>        <action application="voicemail" data="check default $${domain}
> ${dialed_ext}"/>
>        <anti-action application="ring_ready"/>
>        <anti-action application="set" data="call_timeout=10"/>
>        <anti-action application="set" data="hangup_after_bridge=true"/>
>        <anti-action application="set" data="continue_on_fail=true"/>
>        <anti-action application="bridge" data="USER/1000@$${domain}"/>
>        <anti-action application="answer"/>
>        <anti-action application="sleep" data="1000"/>
>        <anti-action application="voicemail" data="default $${domain}
> ${dialed_ext}"/>
>      </condition>
>    </extension>
> </include>
>
>
> In the logs, I just see looping over and over and over again.  Why is it
> using "internal" instead of "external"?  Why is it showing my 971 callerid
> and not the number I dialed?  Where is the part of the logs that show all
> of the Rexex patterns being parsed to determine what context to use?
>
> freeswitch at ip-10-166-245-111> 2013-09-16 19:40:59.695046 [NOTICE]
> switch_channel.c:1030 New Channel sofia/internal/+1971238yyyy at 67.231.1.115[1902fee8-f2d9-4678-b841-bf59948c4937]
>
> 2013-09-16 19:40:59.695046 [DEBUG] switch_core_session.c:1006 Send signal
> sofia/internal/+1971238yyyy at 67.231.1.115 [BREAK]
>
> 2013-09-16 19:40:59.695046 [DEBUG] switch_core_session.c:1006 Send signal
> sofia/internal/+1971238yyyy at 67.231.1.115 [BREAK]
>
> 2013-09-16 19:40:59.695046 [DEBUG] switch_core_state_machine.c:418
> (sofia/internal/+1971238yyyy at 67.231.1.115) Running State Change CS_NEW
>
> 2013-09-16 19:40:59.695046 [DEBUG] switch_core_state_machine.c:436
> (sofia/internal/+1971238yyyy at 67.231.1.115) State NEW
>
> 2013-09-16 19:40:59.715055 [DEBUG] sofia.c:8003 IP 67.231.4.195 Rejected
> by acl "domains". Falling back to Digest auth.
>
> 2013-09-16 19:40:59.715055 [DEBUG] switch_core_session.c:1006 Send signal
> sofia/internal/+1971238yyyy at 67.231.1.115 [BREAK]
>
> 2013-09-16 19:40:59.715055 [DEBUG] sofia.c:1787 detaching session
> 1902fee8-f2d9-4678-b841-bf59948c4937
>
> 2013-09-16 19:41:00.055048 [NOTICE] switch_channel.c:1030 New Channel
> sofia/internal/+1971238yyyy at 67.231.9.59[3295c812-2f36-4d31-8cd4-ef9bbd5cdbdb]
>
> 2013-09-16 19:41:00.055048 [DEBUG] switch_core_session.c:1006 Send signal
> sofia/internal/+1971238yyyy at 67.231.9.59 [BREAK]
>
> 2013-09-16 19:41:00.055048 [DEBUG] switch_core_session.c:1006 Send signal
> sofia/internal/+1971238yyyy at 67.231.9.59 [BREAK]
>
> 2013-09-16 19:41:00.055048 [DEBUG] switch_core_state_machine.c:418
> (sofia/internal/+1971238yyyy at 67.231.9.59) Running State Change CS_NEW
>
> 2013-09-16 19:41:00.055048 [DEBUG] switch_core_state_machine.c:436
> (sofia/internal/+1971238yyyy at 67.231.9.59) State NEW
>
> 2013-09-16 19:41:00.075081 [DEBUG] sofia.c:8003 IP 67.231.4.195 Rejected
> by acl "domains". Falling back to Digest auth.
>
> 2013-09-16 19:41:00.075081 [DEBUG] switch_core_session.c:1006 Send signal
> sofia/internal/+1971238yyyy at 67.231.9.59 [BREAK]
>
> 2013-09-16 19:41:00.075081 [DEBUG] sofia.c:1787 detaching session
> 3295c812-2f36-4d31-8cd4-ef9bbd5cdbdb
>
> I've poured through the dialplan docs and examples, but I really believe I
> could benefit from some explanation based on the problems I'm facing, which
> I'm sure is just me missing some key piece of insight.
>
> Oh I also just commented out the acl lines in both internal and
> external.xml, which removed the acl warnings, but things still loop.
>
> Thank you!
>
> James Mortensen
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20130916/ead40de7/attachment-0001.html 


Join us at ClueCon 2013 Aug 6-8, 2013
More information about the FreeSWITCH-users mailing list