Asterisk n-way call HOWTO
Created by: serg_b,Last modification on Fri 16 of Mar, 2007 [03:14 UTC] by JustRumours
Here I will attempt to describe how to make n-way calls from 2-way calls.
First, You need trunk version of Asterisk.
All work done by two applications: MeetMe and ChannelRedirect. You need Zaptel driver to have MeetMe working.
Question: For Asterisk 1.4 do wee need to replace 'ChannelRedirect' as used below with 'ManagerRedirect' as in bug/patch 6508?
Here is dialplan example:
[default]
exten => _XXX,1,Set(DYNAMIC_FEATURES=nway-start)
exten => _XXX,n,Dial(SIP/${EXTEN})
[dynamic-nway]
exten => _XXX,1,Answer
exten => _XXX,n,Set(CONFNO=${EXTEN})
exten => _XXX,n,Set(MEETME_EXIT_CONTEXT=dynamic-nway-invite)
exten => _XXX,n,Set(DYNAMIC_FEATURES=)
exten => _XXX,n,MeetMe(${CONFNO},pdMX)
exten => _XXX,n,Hangup
[dynamic-nway-invite]
exten => 0,1,Read(DEST,dial,,i)
exten => 0,n,Set(DYNAMIC_FEATURES=nway-inv#nway-noinv)
exten => 0,n,Dial(Local/${DEST}@dynamic-nway-dest,,g)
exten => 0,n,Set(DYNAMIC_FEATURES=)
exten => 0,n,Goto(dynamic-nway,${CONFNO},1)
exten => i,1,Goto(dynamic-nway,${CONFNO},1)
[dynamic-nway-dest]
exten => _XXX,1,Dial(SIP/${EXTEN})
[macro-nway-start]
exten => s,1,Set(CONFNO=${FindFreeConf()})
exten => s,n,ChannelRedirect(${BRIDGEPEER},dynamic-nway,${CONFNO},1)
exten => s,n,Read(DEST,dial,,i)
exten => s,n,Set(DYNAMIC_FEATURES=nway-inv#nway-noinv)
exten => s,n,Dial(Local/${DEST}@dynamic-nway-dest,,g)
exten => s,n,Set(DYNAMIC_FEATURES=)
exten => s,n,Goto(dynamic-nway,${CONFNO},1)
[macro-nway-ok]
exten => s,1,ChannelRedirect(${BRIDGEPEER},dynamic-nway,${CONFNO},1)
[macro-nway-notok]
exten => s,1,SoftHangup(${BRIDGEPEER})
Note, You need to provide FindFreeConf() function (or any other way) to get free Conference number.
And, to make all this work, here is features.conf:
[applicationmap]
nway-start => *0,caller,Macro,nway-start
nway-inv => **,caller,Macro,nway-ok
nway-noinv => *#,caller,Macro,nway-notok
First, You need trunk version of Asterisk.
All work done by two applications: MeetMe and ChannelRedirect. You need Zaptel driver to have MeetMe working.
Question: For Asterisk 1.4 do wee need to replace 'ChannelRedirect' as used below with 'ManagerRedirect' as in bug/patch 6508?
Here is dialplan example:
[default]
exten => _XXX,1,Set(DYNAMIC_FEATURES=nway-start)
exten => _XXX,n,Dial(SIP/${EXTEN})
[dynamic-nway]
exten => _XXX,1,Answer
exten => _XXX,n,Set(CONFNO=${EXTEN})
exten => _XXX,n,Set(MEETME_EXIT_CONTEXT=dynamic-nway-invite)
exten => _XXX,n,Set(DYNAMIC_FEATURES=)
exten => _XXX,n,MeetMe(${CONFNO},pdMX)
exten => _XXX,n,Hangup
[dynamic-nway-invite]
exten => 0,1,Read(DEST,dial,,i)
exten => 0,n,Set(DYNAMIC_FEATURES=nway-inv#nway-noinv)
exten => 0,n,Dial(Local/${DEST}@dynamic-nway-dest,,g)
exten => 0,n,Set(DYNAMIC_FEATURES=)
exten => 0,n,Goto(dynamic-nway,${CONFNO},1)
exten => i,1,Goto(dynamic-nway,${CONFNO},1)
[dynamic-nway-dest]
exten => _XXX,1,Dial(SIP/${EXTEN})
[macro-nway-start]
exten => s,1,Set(CONFNO=${FindFreeConf()})
exten => s,n,ChannelRedirect(${BRIDGEPEER},dynamic-nway,${CONFNO},1)
exten => s,n,Read(DEST,dial,,i)
exten => s,n,Set(DYNAMIC_FEATURES=nway-inv#nway-noinv)
exten => s,n,Dial(Local/${DEST}@dynamic-nway-dest,,g)
exten => s,n,Set(DYNAMIC_FEATURES=)
exten => s,n,Goto(dynamic-nway,${CONFNO},1)
[macro-nway-ok]
exten => s,1,ChannelRedirect(${BRIDGEPEER},dynamic-nway,${CONFNO},1)
[macro-nway-notok]
exten => s,1,SoftHangup(${BRIDGEPEER})
Note, You need to provide FindFreeConf() function (or any other way) to get free Conference number.
And, to make all this work, here is features.conf:
[applicationmap]
nway-start => *0,caller,Macro,nway-start
nway-inv => **,caller,Macro,nway-ok
nway-noinv => *#,caller,Macro,nway-notok
How this works:
When You speak with other party, press *0 (macro nway-start is executed). Called party is immediately transferred to free conference, and You get dialtone to enter number of party You want to invite. After call established and You talk to third user, You can press ** to invite him to conference and *# to hangup call and return to conference. From conference any user can invite anyone else by pressing 0 (all other steps are same as for *0)See also
- Asterisk cmd ChannelRedirect
- app_bridge in bug/patch 5841 - similar to bristuff Steal
- New in Asterisk 1.4: app_ManagerRedirect: Break a bridged call and send called party to some context|exten|priority; see example here
- Asterisk cmd pickup
Comments
333res_features.c :1478 ast_bridge_call : Bridge failed on channels
When i try to add a person in the established call,
the first person redirected in the confernce room (OK) i dial the number of the second personne i talk with him (OK) when i try to accept him(**)
i have a hangup and the 2 other party can talk in the conférence room
the same think was reproduced when i refused to invite him!
this error was genereted when i passed a normal call first and try to invite other party :"
res_features.c:1478 ast_bridge_call: Bridge failed on channels SIP/XXXXXXXXXXXXXXX and AsyncGoto/SIP/XXXXXXXXXXXXXXX <ZOMBIE>
"
if confernece established and one of the party try to invite some one there is no probleme!!!
Help please
333Macro not intended for use in applicationmap?
"The applicationmap is not intended to be used for all Asterisk applications ... It does *not* make sense to use any application which has any concept of dialplan flow. Examples of this would be things like Macro ..."
However Macro is used in nway-start and the other features entries, so is this reliable? It seems to contradict the advice in features.conf, or do I misunderstand (which is entirely possible!)?
333app_channelredirect.c:112 asyncgoto_exec: ChannelRedirect failed
Executing s@macro-nway-start:1 Set("SIP/1001-09458580", "CONFNO=210511") in new stack
— Executing s@macro-nway-start:2 ChannelRedirect("SIP/1001-09458580", "SIP/kesh-0945c4e8|dynamic-nway|210511|1") in new stack
Jun 27 21:05:11 WARNING4671: app_channelredirect.c:112 asyncgoto_exec: ChannelRedirect failed for SIP/kesh-0945c4e8
== Spawn extension (macro-nway-start, s, 2) exited non-zero on 'SIP/1001-09458580' in macro 'nway-start'
— Executing s@macro-nway-start:3 Read("SIP/1001-09458580", "DEST|dial||i") in new stack
— User entered '1002'
333little addition
[dynamic-nway]
exten => _XXX,1,Answer
exten => _XXX,n,Set(CONFNO=${EXTEN})
exten => _XXX,n,Set(MEETME_EXIT_CONTEXT=dynamic-nway-invite)
exten => _XXX,n,Set(DYNAMIC_FEATURES=)
exten => _XXX,n,AGI(conf.agi,adduser)
exten => _XXX,n,MeetMe(${CONFNO},pdMX)
exten => h,1,DeadAGI(conf.agi,deluser)
and change:
[macro-nway-start]
exten => s,1,AGI(conf.agi,findfree)
exten => s,n,Set(CONFNO=${FREE_CONF})
...
conf.agi script written in perl and requires Asterisk::AGI
it's very simple script, so don't expect too much from it
http://files.9i.ru/asterisk/conf.agi
You only need to adjust starting number (look in script).
333n-way with 1.2.9.1
For 1.2.9.1 You can get it here: http://files.9i.ru/asterisk/app_asyncgoto.c
It's name AsyncGoto instead of ChannelRedirect.
Save it to apps/
To compile it, edit apps/Makefile and add app_asyncgoto.so to APPS=
PS: I'm not sure it will not crash Your asterisk. So, use at Your own risk.
Oh, You will need also different version of app_read to provide dialtone.
You can get it here: http://files.9i.ru/asterisk/app_read.c
333Possible to do n-way call with Asterisk 1.2.9.1?
333Why SVN trunk?