News from Industry

Handling e164 numbers in FreeSWITCH

TXLAB - Sat, 07/06/2013 - 03:11

SIP clients installed on smartphones may pick up the destination number from the phone book, and it’s sometimes in e.164 format (+[countrycode][localdigits]).

The following piece of XML dialplan transforms such numbers into the standard form that is expected by most PSTN VoIP providers. This example assumes that the FreeSWITCH server is located in Switzerland and +41 is the e.164 prefix for in-land calls. It returns the call to the same context, making the switch traverse the whole context dialplan from the beginning. It makes sense to place this extension at the bottom of a context.

    <extension name="e164_pstn">       <condition field="destination_number" expression="^\+41(\d+)" break="on-true">         <action application="transfer" data="0$1 XML ${context}"/>       </condition>       <condition field="destination_number" expression="^\+(\d+)" break="on-true">         <action application="transfer" data="00$1 XML ${context}"/>       </condition>     </extension>
Filed under: Networking Tagged: freeswitch, pbx, voip

FreeSWITCH: Limiting the number of concurrent calls on multiple SIP accounts

TXLAB - Sun, 06/30/2013 - 02:52

The user has several SIP accounts on a vPBX, and he wants that maximum one call is possible at a time.

The limit application in FreeSWITCH allows to control the number of concurrent calls, but one should be careful with when this limit should be applied. The switch decrements the limit counter automatically when a channel is terminated. But if the limit is executed on a-leg, and b-leg is transferred, the limit counter decreases only when the a-leg finishes the call. As a result, the user may receive a call, transfer it to a new destination and hang up, but the new calls are not coming in because the limit counter is reset when the original call ends.

In order to reset the limit counter after the b-leg is transferred, the limit application needs to be executed on b-leg only. This is possible by exporting the execute_on_answer variable with nolocal modifier.

The example also shows how to retrieve user variables from the XML directory in the calls toward the user.

  <context name="moretti">     <extension name="common_variables" continue="true">       <condition>         <action inline="true" application="set" data="availability_username=moretti"/>       </condition>     </extension>     <extension name="pstn_out">             <condition field="destination_number" expression="^[01]" break="on-false">         <!-- For outbound calls, we only set the limit counters,              but do not limit the call -->         <action application="limit" data="hash ${domain_name} ${availability_username} -1"/>         <action application="set" data="hangup_after_bridge=true"/>         <action application="set" data="continue_on_fail=false"/>       </condition>       <condition>         <action application="bridge" data="${outgw}/${destination_number}"/>       </condition>     </extension>     <extension name="inbound_73x">       <condition field="destination_number" expression="^73(d)$" break="on-false">         <!-- retrieve variables from the user entry in the directory -->         <action application="set" data="directory_userid=70$1@${domain_name}"/>         <action application="set" data="call_timeout=${user_data(${directory_userid} var ring_timeout)}"/>       </condition>       <!-- check the limit -->       <condition field="${cond(${limit_usage(hash ${domain} ${availability_username})} > 0 ? true:false)}"                  expression="^true$" break="on-true">         <action application="hangup"/>       </condition>       <!-- group call to the SIP user and a mobile phone -->       <condition>         <action application="export" data="nolocal:execute_on_answer=limit hash ${domain} ${availability_username} -1"/>         <action application="set" data="ignore_early_media=true"/>         <action application="set" data="transfer_ringback=$${hold_music}"/>         <action application="set" data="hangup_after_bridge=true"/>         <action application="set" data="continue_on_fail=false"/>         <action application="bridge" data="user/${directory_userid},[leg_delay_start=10]${outgw}/0123456789"/>       </condition>     </extension>       </context>
Filed under: Networking Tagged: freeswitch, pbx, sip, voip

Pages

Subscribe to OpenTelecom.IT aggregator

Using the greatness of Parallax

Phosfluorescently utilize future-proof scenarios whereas timely leadership skills. Seamlessly administrate maintainable quality vectors whereas proactive mindshare.

Dramatically plagiarize visionary internal or "organic" sources via process-centric. Compellingly exploit worldwide communities for high standards in growth strategies.

Get free trial

Wow, this most certainly is a great a theme.

John Smith
Company name

Yet more available pages

Responsive grid

Donec sed odio dui. Nulla vitae elit libero, a pharetra augue. Nullam id dolor id nibh ultricies vehicula ut id elit. Integer posuere erat a ante venenatis dapibus posuere velit aliquet.

More »

Typography

Donec sed odio dui. Nulla vitae elit libero, a pharetra augue. Nullam id dolor id nibh ultricies vehicula ut id elit. Integer posuere erat a ante venenatis dapibus posuere velit aliquet.

More »

Startup Growth Lite is a free theme, contributed to the Drupal Community by More than Themes.