|
Home Resources Products
Developers |
Main • Callfork
Call ForkerThis module is used to route a call to multiple alternative targets. The first target that answers will be connected with the caller while the other calls are abandoned. A call fork is implemented by connecting the incoming call to a fork master. For each target a fork slave is created that generates a call.execute message to create the outgoing call leg. Once one of the outgoing calls answers all other active slaves are disconnected with a reason of "pickup" and the incoming call leg is connected directly to the answered outgoing one, finishing the forking process. To use as a fallback routing module you should add in regexroute or your routing module something like: fork sip/sip:1@host1 | h323/2@host2 | sip/sip:3@host3;stoperror=busy in regexroute.conf this will look like this: ^.*$=fork sip/sip:\0@host1 | h323/\0@host2 | sip/sip:\0@host3;stoperror=busy
fork sip/sip:1@host1 h323/2@host2 sip/sip:3@host3;stoperror=busy in regexroute.conf this will look like this: ^.*$=fork sip/sip:\0@host1 h323/\0@host2 sip/sip:\0@host3;stoperror=busy
Timed advanceStarting with Yate 2.2 it is possible to proceed to the next group of targets based on a timer. This is accomplished using a special separator target that still starts with a pipe character:
If you have something like fork sip/sip:1@host1 |next=3000 sip/sip:2@host2 will start calling initailly 1@host1 and after 3 seconds of no answer will also start calling 2@host2 Jump out of a forkStarting with Yate 3 (SVN Rev 3310 - 2010-05-11) is it possible to jump out of a fork and continue the call without the fork master.
Once the |exec target is reached all remaining targets will be attempted sequentially until call.execute returns true. Example: fork sip/sip:1@host1 sip/sip:2@host2 |exec=20000 queue/desk wave/play/queue_full.au If the SIP targets do not answer in 20 seconds the fork is terminated and will try to send the incoming call to queue/desk. If that queue does not exist or the call cannot be queued it will end up connected to an announcement. ParametersThe following parameters of the call.execute message are understood by this module:
IMPORTANT: All parameters apply to all branches of a forked call. You cannot set parameters specific to one target.
Other parameters (except "callto") are forwarded to the outgoing calls. ConfigurationThere is no configuration file for this module. All parameters are taken from the call.execute message. ExampleA standard line for regexroute.conf will look like: ^1$=fork sip/sip:1@host1 h323/2@host2 | sip/sip:3@host3;stoperror=busy That means when someone is calling extension 1 the call will proceed as follows:
A demo query to return same from a database would be: SELECT 'fork sip/sip:1@host1 h323/2@host2 | sip/sip:3@host3' AS location, 'busy' AS stoperror (assuming you have result=location in register.conf) Call forking when additional parameters have to be suppliedUnfortunately routing a call to more than one target doesn't work if per-target parameters must be set. This excludes fork routing to registered accounts as they each need a different "line" parameter. A workaround would be to catch and alter each individual call.execute message like this:
[default]
^.*$=fork $(rotate,$idx001, sip/\0@fwd, sip/\0@other, ...)
[extra]
call.execute=80
[call.execute]
${callto}^\([a-zA-Z0-9]\+\)/\([0-9]\+\)@\([a-zA-Z0-9_-]\+\)$=return;callto=\1/\2;
line=\3
This will turn any proto/user@acct into proto/user and set line=acct. The account name must contain only letters, digits, underscores and dashes. In particular a dot cannot be allowed as it would make impossible to discriminate regular domain names or IP addresses. To apply more complex changes you can jump to computed contexts like:
[call.execute]
${callto}^\([a-zA-Z0-9]\+\)/\([0-9]\+\)@\([a-zA-Z_-]\+\)$=goto exec_\3;
callto=\1/\2;line=\3
[exec_fwd]
.*=return;caller=xxx
[exec_other]
.*=return;caller=yyy;callername=It's me!
For round-robin with fallback you would need something like: ^.*$=fork $(rotate,$idx001,| sip/\0@fwd,| sip/\0@other,| ...) You should consider adding a maxcall parameter (maximum time until answer in milliseconds) so that unresponsive gateways can be skipped. For round-robin without fallback you would need something like: ^.*$=$(index,$idx001,sip/\0@fwd,sip/\0@other,...) Please see Routing for more examples of round-robin and/or fallback routing. Forking a call routed by a different moduleSometimes you have to modify a call that is routed by another module like regfile. This is impossible using the call.route message but there is the option of altering the parameters of the call.execute message. An example of implementing dropping call into voicemail would be:
[extra]
call.execute=80
[call.execute]
; can't fork an already forked call or calls to scripts (IVR and such)
${callto}^fork=return
${callto}^external=return
; but fork all other calls to the original and the leave mail script (after 30s)
.*=return;callto=fork ${callto} | external/nodata/leavemail.php;maxcall=30000
If the original called resource doesn't answer in 30 seconds the call will be routed to voicemail. Providing fake ringback tone while fallback calling through different gateways
^1$=fork earlymedia sip/sip:1@host1 h323/2@host2 | sip/sip:3@host3;
stoperror=busy;maxcall=20000
[extra]
call.execute=80
[call.execute]
${callto}^earlymedia$=return;callto=tone/ring;fork.calltype=persistent;
fork.autoring=true;fork.automessage=call.progress
The persistent tone/ring will not prevent moving over to call sip/sip:3@host3 but will persist and provide fake early media until the call is answered or finally fails. Another solution is to use the fork.fake to set the fake early media. ^1$=fork sip/sip:1@host1;fork.fake=tone/ring |
3 May 2010: 8 March 2010: 6-7 February 2010: 2 Nov 2009: 6 Aug 2008: 4 Aug 2008: 10 Jul 2008: Feb 2008: 21 Jan 2008: 3 September: 14 August: 16 April: 25 September: 25 September: 11 July 2006: 10 July 2006: June 1st 2006: |