[asterisk-users] How to use 'Transfer' to send calls to another asterisk?

Joshua Colp jcolp at digium.com
Thu Oct 11 14:42:10 CDT 2012


Deepesh D wrote:
> If C1 dials S1 and then S1 dials S2 to transfer the call then S1 still
> remains in the loop till the call is finished. What I wanted to do is
> to reduce the number of calls on S1, so as soon as S1 receives a call
> from C1 it redirects the call to S2 using 'Transfer' application and
> exits from the loop, the call should now be handled by S2

With some crafty configuration you can achieve this using Transfer. With 
promiscredir disabled Asterisk will not follow the SIP URI in the 302 
response sent back as a result of calling Transfer. The call reenters 
the dialplan at the user portion of the URI passed back and executes 
dialplan as normal. By prefixing the user portion with a unique 
identifier you can write dialplan that strips the prefix and then dials 
out to S2.

Flow being:

C1 executes Dial(SIP/${EXTEN}@S1) (matched using _1NXXNXXXXXX)
S1 executes Transfer(002${EXTEN}) (matched using _1NXXNXXXXXX)
C1 executes Dial(SIP/${EXTEN:3}@S2) (matched using _0021NXXNXXXXXX)

So simply:
C1 calls S1
S1 decides to send it to S2, but wants to tell C1 to do it directly
S1 sends back a SIP message saying hey call 00218005551212 instead
C1 matches the number to the dialplan which explicitly calls out through S2
S2 receives the call and life is good

* Note: This requires control over both C1 and S1, you can't just do it 
to every random system calling.

If you don't get the finer details of this just experiment with the 
general idea and configuration option I mentioned. It won't hurt.

Cheers,

-- 
Joshua Colp
Digium, Inc. | Senior Software Developer
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at:  www.digium.com  & www.asterisk.org



More information about the asterisk-users mailing list