Misc. Dialplan Tools bridgecall
From FreeSWITCH Wiki
Contents |
Description
Provides the ability to bridge two endpoints. Generally used to route an incoming call to one or more endpoints.
Multiple endpoints can be dialed simultaneously or sequentially using the comma and pipe delimiters, respectively. See below.
Usage
bridge <target_endpoint>[,<target_endpoint>][|<target_endpoint>]
Example
From the Dialplan
Bridge an incoming call to an external sip address or termination provider.
<action application="bridge" data="sofia/sip/9998881111@sip.yourprovider.com"/>
Bridge the incoming call to extension 100 and 101. The '%' is used instead of the @ to indicate that the endpoints are registered locally. Separate multiple endpoints with a comma. The ${sip_profile} variable is defined in freeswitch.xml.
<action application="bridge" data="sofia/sip/100%${sip_profile},sofia/sip/101%${sip_profile}"/>
To dial to multiple contacts, all at once:
<action application="bridge" data="sofia/sip/1010@sip.yourprovider.com,sofia/sip/1011@sip.yourprovider.com"/>
One at a time:
<action application="bridge" data="sofia/sip/1010@sip.yourprovider.com|sofia/sip/1011@sip.yourprovider.com"/>
Options
You can set different options to modify the behavior of the call. Be sure to set the option before executing the application. Here are some examples:
Timeout
Call time out in seconds.
<action application="set" data="call_timeout=20"/>
No Media Mode
No media mode is an SDP Passthrough feature that permits two endpoints that can see each other (no funky NAT's) to connect their media sessions directly while FreeSWITCH maintains control of the SIP signaling. This is useful if you have two end-points that need to use a codec that is currently not supported in FreeSWITCH (video) or if you are using FreeSWITCH in a high performance walled garden network and want to minimize the RTP handling FreeSWITCH is doing to maximize call traffic.
Before executing the bridge action you must set the "bypass_media" flag to true.
<action application="set" data="bypass_media=true"/>
- See also: Bypass Media Overview
- See also: bypass_media in Channel Variables to change media handling by FS
Setting Outgoing CallerID
If you are using FreeSWITCH as a PBX you may want to control the outgoing CallerID that is sent to the PSTN or your SIP provider. Your SIP Provider will most likely require you use a specific CallerID number (or a userid instead). The following example sets them before executing the bridge action.
<action application="set" data="effective_caller_id_name=John Freeswitch"/> <action application="set" data="effective_caller_id_number=1234567"/>
Sending Ringback
You may want to simulate ringback to your internal users while you dial a provider, or you may need to force a ringback back upstream when you are dialing multiple extensions and cannot determine what call treatment you will need to provide yet. In order to accomplish this, you need to set a chanvar before going to the bridge application.
<action application="set" data="ringback=${us-ring}"/>
Note that you can use another ring than ${us-ring}, but it would have to be defined in your configuration.
Calling multiple destinations
By using commas to separate the addresses, bridgecall will dial them simultaneously. Using pipes, it'll dial one at a time.
If you need to set different channel variables for each destination, you may prefix the destinations with [] and the variables inside the brackets. Example:
<action application="bridge" data="[origination_caller_id_number=1234]sofia/blah/blah,[origination_caller_id_number=55555]sofia/blah/blah"/>
Implementing Failover
Failover for your outbound gateway is easy to implement at bridge time using the | separator:
<action application="bridge" data="sofia/gateway/primary/blah|sofia/gateway/secondary/blah"/>
Using the ping parameter on the gateway will allow FreeSWITCH to determine a gateway has failed which allows the bridge to go to the secondary immediately rather than waiting for a timeout.
Special channels
error
You can bridge the call to the error channel in order to specify a hangup cause.
<action application="bridge" data="error/user_busy" />
user
Since FreeSWITCH has a user directory, you can save how to reach every user in the user's directory entry by saving it in its "dial-string" parameter. When dialing using the user channel, it will lookup the dial-string and dial it instead. For example:
<action application="bridge" data="user/bob@domain" />
could be expanded into
<action application="bridge" data="sofia/sip/100%${sip_profile},sofia/sip/101%${sip_profile}"/>
Note: if the user has no dial-string, the domain's is used instead.
