Freeswitch IVR Originate
From FreeSWITCH Wiki
Contents |
IVR originate data syntax
Call a normal channel
Default pattern for originating calls:
endpoint_name/endpointdata
Originating by profile:
sofia/${profile_name}/1234@domain.com
Or by gateway(the sofia/gateway/ has special meaning make sure you include it when dialing via a gateway):
sofia/gateway/${gateway_name}/1234
Mutiple destinations in outbound calls
This means any dialstring may contain a '|' and/or ',' separated list of call urls. The "|" calls one call at a time, the "," calls multiple calls simultaniously.
The example below will call 2 locations and connects the first to answer
<extension name="3002">
<condition field="destination_number" expression="^3002$">
<action application="bridge" data="iax/guest@somebox/1234,sofia/test-int/1000@somehost"/>
</condition>
</extension>
And this example will first call 1 location and if that results in a failure, try 2 at once on the next go
<extension name="3002">
<condition field="destination_number" expression="^3002$">
<action application="bridge" data="sofia/test-int/3920@10.3.3.104|sofia/test-int/3910@10.3.3.104,sofia/test-int/3920@10.3.3.104"/>
</condition>
</extension>
Answer confirmation
It is possible to map a certain key as required indication of an accepted call. You may also supply a filename to play possibly instructing the call recipient to press the desired key etc...
The example below will call 2 locations playing prompt.wav to any who answer and completing the call to the first offhook recipient to dial "4"
<extension name="3002">
<condition field="destination_number" expression="^3002$">
<action application="set" data="call_timeout=60"/>
<action application="set" data="group_confirm_file=/path/to/prompt.wav"/>
<action application="set" data="group_confirm_key=4"/>
<action application="bridge" data="iax/guest@somebox/1234,sofia/test-int/1000@somehost"/>
</condition>
</extension>
The following is the equivalent but the confirm data is passed via the bridge parameters (This is for situations where there is no originating channel to set variables on). It can also be used from the Freeswitch command line with the dial string in double quotes (e.g. the originate command).
<extension name="3002">
<condition field="destination_number" expression="^3002$">
<action application="bridge" data="{group_confirm_file=/path/to/prompt.wav,group_confirm_key=4,call_timeout=60} iax/guest@somebox/1234,sofia/test-int/1000@somehost"/>
</condition>
</extension>
This logic should be permitted in anything that establishes an outgoing call with switch_ivr_originate(). That means even in the originate api command you can call multiple targets and send whoever answers first to an extension that calls more multiple targets. You should be able to do the same in the mod_conference dial and dynamic conference features.
exec in answer confirm
now in the key portion you can say 'exec' and in the file portion say '<application> <args>' if the channel is not hungup when that application ends it's the winner so you can run an ivr on the channels to determine who gets the call
<extension name="3002">
<condition field="destination_number" expression="^3002$">
<action application="set" data="call_timeout=60"/>
<action application="set" data="group_confirm_key=exec"/>
<action application="set" data="group_confirm_file=javascript test.js"/>
<action application="bridge" data="sofia/test-int/1000@domain.com,sofia/test-int/1001@mydomain.com"/>
</condition>
</extension>
