[Freeswitch-users] Routing inbound call to multiple extentions

Todd Bailey toddb at toddbailey.net
Mon Jul 9 21:08:05 MSD 2012


I think what is missing in this wiki is it doesn't explicitly state what
file(s) and in what folder(s) needs to be edited.



here is an extract of the section that I suspect is what I need to
follow

Groups

A group is a logical collection of users that FreeSWITCH can use to
bridge calls in a serial or parallel fashion, depending on the arguments
to the group_call application. Using groups is optional -- you can put
your users straight into the domain section if you desire.

This is specially useful if you use mod_xml_curl to provide the user
directory to FreeSWITCH and want to group some users in a logical
structure. The following group '200' groups four users. It's interesting
to notice the "dial-string" param, which is used to bridge the calls to
those users. Users 1000 and 1001 will use the default "dial-string"
while user 2014 uses a loopback channel so FreeSWITCH can actually query
the dialplan to figure out how to reach that user (this also works for
external numbers through OpenZAP and gateways):

type="pointer" is a pointer so you can have the same user in multiple
groups. It basically means to keep searching for the user in the
directory.

<document type="freeswitch/xml">
 <section name="directory">
   <domain name="sip.example.com">
     <users>
       <user id="1000">
         <params>
           <param name="dial-string" value="{presence_id=${dialed_user}@
${dialed_domain}}${sofia_contact(${dialed_user}@${dialed_domain})}"/>
         </params>
         <variables>
           <variable name="user_context" value="default"/>
         </variables>
       </user>
       <user id="1001">
         <params>
           <param name="dial-string" value="{presence_id=${dialed_user}@
${dialed_domain}}${sofia_contact(${dialed_user}@${dialed_domain})}"/>
         </params>
         <variables>
           <variable name="user_context" value="default"/>
         </variables>
       </user>
     </users>
     <groups>
       <group name="200">
         <users>
           <user id="2014">
             <params>
               <param name="dial-string"
value="loopback/2014/default/XML"/>
             </params>
             <variables>
               <variable name="user_context" value="default"/>
             </variables>
           </user>
           <user id="1000" type="pointer"/>
           <user id="1001" type="pointer"/>
         </users>
       </group>
     </groups>
   </domain>
 </section>
</document>

The dialplan for the above group can be defined like this:

     <extension name="Group 200">
       <condition field="destination_number" expression="200">
         <action application="set" data="hangup_after_bridge=true"/>
         <action application="set" data="continue_on_fail=true"/>
         <action application="set"
data="originate_continue_on_timeout=true"/>
         <action application="set" data="call_timeout=15"/>
         <action application="bridge" data="${group_call(200@
${domain_name}+F)}"/>
         <action application="transfer" data="200 XML default"/>
         <action application="hangup"/>
       </condition>
     </extension>

The extension 200 will ring all the users defined in the user directory
for group 200 in a serial fashion (specified by the +F argument, if you
want to ring all the users at once use the +A argument) for 15 seconds,
then it will transfer the call to the same group again so the call will
ring the group infinitely.

To explain the variables set prior to the bridge:

The hangup_after_bridge is set to true for this effect: if the bridge is
successfully answered and the B-leg later hangs up, the A-leg will also
be hung up.

The continue_on_fail is set to true for this: if the bridge fails,
dialplan execution will continue and the transfer will be executed.

The originate_continue_on_timeout is set to true for this: if the
bridge's dial string specifies several destinations separated by the
"|" (this is for failover), the bridge will time out on an unanswered
destination and will attempt the next specified destination. Without
originate_continue_on_timeout set to true, the bridge will time out on
the first destination it tries and the bridge itself will fail. (In the
example above, the bridge string is generated by group_call with the +F
option; this specifies a dial string with all the group's destinations
separated by "|". So originate_continue_on_timeout needs to be set to
true for serial calling behavior.)

The call_timeout is set so that the bridge attempt to a destination that
goes unanswered will time out. NOTE: If the destination sends early
media, the bridge will be answered (pre-answered) and will NOT time out!
To time out a bridge attempt to a destination sending early media, set
ignore_early_media to true.

The dialplan for user 2014, which in this example happens to be
terminated through a gateway defined via mod_lcr, can be defined like
this:

     <extension name="Extension 2014">
       <condition field="destination_number" expression="2014">
         <action application="lcr" data="2014"/>
         <action application="set" data="dialed_ext=${lcr_auto_route}"/>
         <action application="export" data="dialed_ext=
${lcr_auto_route}"/>
         <action application="set" data="hangup_after_bridge=true"/>
         <action application="set" data="call_timeout=120"/>
         <action application="bridge" data="${lcr_auto_route}"/>
         <action application="hangup"/>
       </condition>
     </extension>




On Mon, 2012-07-09 at 01:49 -0700, Stanislav Sinyagin wrote:
> http://wiki.freeswitch.org/wiki/XML_User_Directory_Guide




Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list