Loopback 1 2 – Route Audio Between Applications Across

broken image


Skip to end of metadataGo to start of metadata

0. About

Bridge a new channel to the existing one (Actually bridge the audio between two sessions). 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.

mod_dptools: bridge VS uuid_bridge

(uuid_bridge is documented in mod_commands.)

1. Usage

Loopback Audio Program

Loopback 2 0 0 – Route Audio Between Applications Available Version Read the Migration Guide for instructions on upgrading to LoopBack 3.0. The Release Notes provide a comprehensive reference for all the changes between 2.x and 3.x. Fancy collaborating on a track with other musicians around the globe? Digital Musician Net runs as a VST 2 plug-in inside many host applications, transfers audio and MIDI data in real time, and even lets you see your collaborator via a two-way video link. Digital Musician Net already runs on both Mac and PC platforms. Router isis redistribute rip route-map 1 redistribute iso-igrp remote route-map 1! Route-map 1 permit match ip address 1 match clns address 2 set metric 5 set level level-2! Access-list 1 permit 192.168.0.0 0.0.255.255 clns filter-set 2 permit 49.0001.0002.

2. Examples

Endpoint examples expressed as API commands: Master of typing 3 5 5 – learn touch typing.

Simple endpoint:

Multiple endpoints simultaneously (call blast) -- no limit to concurrency, first one to answer wins

Loopback 2

Multiple endpoints sequential -- no limit to failover number

Setting Variables for the B-leg simple example using brackets:

Setting Variables for the B-leg thread-global using braces:

Setting Variables for the B-leg with enterprise originate for multiple threads:

2.1 Dialplan Examples

Bridge an incoming call to an external SIP address or termination provider.

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.

To dial multiple contacts all at once:

To dial multiple contacts one at a time:

To bridge an incoming call to an external SIP address or termination provider on the fly which requires authentication without having to create gateways entries:

Extra parameters: for instance, if you are dipping to get an LRN lookup:

or

or

will result in:

However, you will also get 12135551212;rn=12135550000;npdi=yes in the To: parameter. Thus, to get rid of that you can append the carat (^) as follows:

3. 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:

3.1 Timeout

The maximum number of seconds to wait for an answer state from a remote endpoint.

3.2 No Media Mode

See full discussion at Bypass Media Overview.

No media mode is an SDP Passthrough feature that permits two endpoints that can see each other (no funky N.A.T.) 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.

When set, the media (RTP) from the originating endpoint is sent directly to the destination endpoint and vice versa. The signaling (SIP) for both endpoints still goes through FreeSWITCH, but the media is point-to-point.

Before executing the bridge action you must set the 'bypass_media' flag to true.

bypass_media must only be set on the A leg of a call, for example:

3.3.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 to use a specific CallerID number (or a userid instead). The following example sets them before executing the bridge action. See more about caller ID privacy options.

3.4 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.

Note that you can use another ring than ${us-ring}, but it would have to be defined in your configuration (typically in vars.xml).

3.5 Calling multiple destinations

By using commas to separate the addresses, bridge will dial them simultaneously. Using pipes, it'll dial one at a time. Use :_: to separate multiple destinations to be dialled in a multi-threaded manner (this is referred to as 'Enterprise Origination') - this gives more flexibility (and avoids the 'Only calling the first element in the list in this mode' warning)

If you need to set different channel variables for each destination, you may prefix the destinations with [] and the variables inside the brackets. Example:

Note: by default when bridging, the first endpoint to provide media (as opposed to actually answering) will win, and the other endpoints will stop ringing. For internal endpoints, this usually doesn't matter. However, in the case of cell phone providers, any custom music that plays for the caller while ringing counts as media. In some cases, the ringing sound itself is media. If your bridge command includes a cell phone number and your internal endpoints stop ringing as soon as the cell phone starts, you will need to enable the 'ignore_early_media' option:

3.6 Implementing Failover

Failover for your outbound gateway is easy to implement at bridge time using the | separator:

Setting the options ping parameter on the gateway in the sip_profiles definition will allow FreeSWITCH to determine a gateway has failed ahead of time which allows the bridge to go to the secondary immediately rather than waiting for a timeout during call setup.

3.7 Call Camping

See Call Camping.

4. Special channels

These special channels are specified where a normal endpoint would be specified, such as sofia, but provide customized treatment of a call.

4.1 error

You can bridge the call to the error channel in order to specify a hangup cause.

4.2 gateway

When dialing using the gateway channel, it will use the authentication details specified in the sip_profiles definition if challenged.

4.3 group

The group special channel will dynamically create a dial string to reach all endpoints defined as part of a group in the directory by using the 'group_call' function.

This is the same as:

4.4 loopback

Loopback creates a pseudo-endpoint that starts a new pass through the specified dialplan, but can cause unusable CDR entries as a result. Do not use unless there is no other option, but expect to spend time troubleshooting it.

This example searches the inherited dialplan for extension 1000 in the inherited context.

Loopback is evil and should only be used as a last resort, when no other approach is possible. - anthm

For more info look at Loopback endpoint

4.5 user

[ Note: This section was imported directly from the old wiki and must be edited to the rest of the text under 'user' to remove redundancies. ]

If the dial-string param is set for a user or a domain you can bridge a call to the user endpoint without going through a profile. The default dial-string param in the example config files for FreeSWITCH has the following syntax:

When this param is set on the destination user you can bridge to it this way:


When you use the user channel the user is pulled from your domain in your directory then the main domain is searched for a tag. If that is not found it searches in the for a tag. If a tag is located, it looks for the param 'dial-string' as the originate string to use for that user. The special variables ${dialed_user} and ${dialed_domain} are available in this string for expansion based on the user and domain specified.

for instance if all calls are sip you could set the dial-string in your whole domain as

Applications

Multiple endpoints sequential -- no limit to failover number

Setting Variables for the B-leg simple example using brackets:

Setting Variables for the B-leg thread-global using braces:

Setting Variables for the B-leg with enterprise originate for multiple threads:

2.1 Dialplan Examples

Bridge an incoming call to an external SIP address or termination provider.

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.

To dial multiple contacts all at once:

To dial multiple contacts one at a time:

To bridge an incoming call to an external SIP address or termination provider on the fly which requires authentication without having to create gateways entries:

Extra parameters: for instance, if you are dipping to get an LRN lookup:

or

or

will result in:

However, you will also get 12135551212;rn=12135550000;npdi=yes in the To: parameter. Thus, to get rid of that you can append the carat (^) as follows:

3. 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:

3.1 Timeout

The maximum number of seconds to wait for an answer state from a remote endpoint.

3.2 No Media Mode

See full discussion at Bypass Media Overview.

No media mode is an SDP Passthrough feature that permits two endpoints that can see each other (no funky N.A.T.) 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.

When set, the media (RTP) from the originating endpoint is sent directly to the destination endpoint and vice versa. The signaling (SIP) for both endpoints still goes through FreeSWITCH, but the media is point-to-point.

Before executing the bridge action you must set the 'bypass_media' flag to true.

bypass_media must only be set on the A leg of a call, for example:

3.3.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 to use a specific CallerID number (or a userid instead). The following example sets them before executing the bridge action. See more about caller ID privacy options.

3.4 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.

Note that you can use another ring than ${us-ring}, but it would have to be defined in your configuration (typically in vars.xml).

3.5 Calling multiple destinations

By using commas to separate the addresses, bridge will dial them simultaneously. Using pipes, it'll dial one at a time. Use :_: to separate multiple destinations to be dialled in a multi-threaded manner (this is referred to as 'Enterprise Origination') - this gives more flexibility (and avoids the 'Only calling the first element in the list in this mode' warning)

If you need to set different channel variables for each destination, you may prefix the destinations with [] and the variables inside the brackets. Example:

Note: by default when bridging, the first endpoint to provide media (as opposed to actually answering) will win, and the other endpoints will stop ringing. For internal endpoints, this usually doesn't matter. However, in the case of cell phone providers, any custom music that plays for the caller while ringing counts as media. In some cases, the ringing sound itself is media. If your bridge command includes a cell phone number and your internal endpoints stop ringing as soon as the cell phone starts, you will need to enable the 'ignore_early_media' option:

3.6 Implementing Failover

Failover for your outbound gateway is easy to implement at bridge time using the | separator:

Setting the options ping parameter on the gateway in the sip_profiles definition will allow FreeSWITCH to determine a gateway has failed ahead of time which allows the bridge to go to the secondary immediately rather than waiting for a timeout during call setup.

3.7 Call Camping

See Call Camping.

4. Special channels

These special channels are specified where a normal endpoint would be specified, such as sofia, but provide customized treatment of a call.

4.1 error

You can bridge the call to the error channel in order to specify a hangup cause.

4.2 gateway

When dialing using the gateway channel, it will use the authentication details specified in the sip_profiles definition if challenged.

4.3 group

The group special channel will dynamically create a dial string to reach all endpoints defined as part of a group in the directory by using the 'group_call' function.

This is the same as:

4.4 loopback

Loopback creates a pseudo-endpoint that starts a new pass through the specified dialplan, but can cause unusable CDR entries as a result. Do not use unless there is no other option, but expect to spend time troubleshooting it.

This example searches the inherited dialplan for extension 1000 in the inherited context.

Loopback is evil and should only be used as a last resort, when no other approach is possible. - anthm

For more info look at Loopback endpoint

4.5 user

[ Note: This section was imported directly from the old wiki and must be edited to the rest of the text under 'user' to remove redundancies. ]

If the dial-string param is set for a user or a domain you can bridge a call to the user endpoint without going through a profile. The default dial-string param in the example config files for FreeSWITCH has the following syntax:

When this param is set on the destination user you can bridge to it this way:


When you use the user channel the user is pulled from your domain in your directory then the main domain is searched for a tag. If that is not found it searches in the for a tag. If a tag is located, it looks for the param 'dial-string' as the originate string to use for that user. The special variables ${dialed_user} and ${dialed_domain} are available in this string for expansion based on the user and domain specified.

for instance if all calls are sip you could set the dial-string in your whole domain as

Be aware that the user channel should not be used along with forked dialing. Instead use the following in your data= for the bridge:

Loopback 1 2 – Route Audio Between Applications Across Two


Tumbleweed express download free. 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 stored in the extension's directory entry and dial it instead.

If the user has no dial-string, the default dial-string specified in the directory entry for the channel's domain is used instead.

If you want to route to many user channels, you will have to separate them by :_: as opposed to the comma ',' to generate an originate command for each user.

Note again: You have to be careful with whitespace here generally. For some reason, FS will see user [bob@domain ] and NOT [bob@domain] which will make it not find the user, if you try to be fancy like for example this:

So be careful about formatting.

5. See Also

  • Loopback endpoint — a special user channel for very specialized purposes
  • Channel variables — dicsusses how channel variables, especially loopback_bowout, can be set and how they affect this command

Loopback 2






broken image