Redirecting calls in AMI to a MeetMe room

Hi

My situation goes like this:
I’m using AMI to originate calls. The command I use looks like this:

Action: Originate
Application: Dial
Data: SIP/Provider/[number of recipient]
Channel: SIP/Provider/[number of caller]
ActionID: 1

After sending this command the phone rings at the caller side, after he answers the recipients phone rings and when he answers a conversation begins.

Question is what do I do when I want another person to join the conversation ?

I can originate a call to the 3rd person and move him to a MeetMe room using the following command:

Action: Originate
Application: MeetMe
Data: 100
Channel: SIP/Provider/[number of 3rd person]
ActionID: 2

However, I have no idea how to redirect the 2 original persons to that room.
I do know their channel name if it helps.

nobody ever uses Asterisk like this ?

I am not 100% sure that you can split apart the native bridging created by the Dial application. You may be able to, but you would definitely need to test.

Assuming you can redirect both legs of call which was setup by Dial, you would simply issue an AMI Redirect command. One “Redirect” for each channel. You would redirect them to a context/extension/priority which would, in turn, drop them into the same MeetMe conference as the third party.

If asterisk terminates one of the parties when you redirect, which it may, you will need to set up the initial call differently. Perhaps issuing 2 Originate commands and dropping them both into the appropriate MeetMe from the get-go.

We’re using Asterisk 1.4.26.1 and we do split the two native channels and transfer each to the meetme room using Redirect with Channel and ExtraChannel. As mentioned above, that’s the way to do it. It will mess with CDR’s a bit and the guys at Digium have developed a patch to fix that.

You can google “asterisk redirect cdr” to find a link to that patch.

Do you need to setup a dial plan for that ?
… for each MeetMe room ?

Yes. Just create a context that takes the channels into the same meetme room. We use dynamic meetme conferences and the extension number that the channel is routed to is used as the meetme conference id.

care to post an example ?

Not a problem… it really doesn’t have to be anything complicated. Something like this would work:

[meetme]
exten => h,1,Hangup
exten => _X.,1,Answer
exten => _X.,n,Wait(1)
exten => _X.,n,MeetMe(${EXTEN}|1dFqAx)
exten => _X.,n,Hangup

I added that to the dial plan, when I try to perform a redirect like this:

Action: Redirect
Exten: 101
Context: meetme
Priority: 1
ActionID: test123
Channel: [caller channel]
ExtraChannel: [recipient channel]

I get:

Response: Success
ActionID: test123
Message: Dual Redirect successful

however it hangs up on me after a couple of events:

Event: Newchannel
Privilege: call,all
Channel: AsyncGoto/SIP/Provider-02424940
ChannelState: 6
ChannelStateDesc: Up
CallerIDNum:
CallerIDName:
AccountCode:
Uniqueid: 1252232157.10

Event: Masquerade
Privilege: call,all
Clone: SIP/Provider-02424940
CloneState: Up
Original: AsyncGoto/SIP/Provider-02424940
OriginalState: Up

Event: Rename
Privilege: call,all
Channel: SIP/Provider-02424940
Newname: SIP/Provider-02424940
Uniqueid: 1252231975.9

Event: Rename
Privilege: call,all
Channel: AsyncGoto/SIP/Provider-02424940
Newname: SIP/Provider-02424940
Uniqueid: 1252232157.10

Event: Rename
Privilege: call,all
Channel: SIP/Provider-02424940
Newname: AsyncGoto/SIP/Provider-02424940
Uniqueid: 1252231975.9

Event: Newchannel
Privilege: call,all
Channel: AsyncGoto/SIP/Provider-02415510
ChannelState: 6
ChannelStateDesc: Up
CallerIDNum:
CallerIDName:
AccountCode:
Uniqueid: 1252232157.11

Event: Masquerade
Privilege: call,all
Clone: SIP/Provider-02415510
CloneState: Up
Original: AsyncGoto/SIP/Provider-02415510
OriginalState: Up

Event: Rename
Privilege: call,all
Channel: SIP/Provider-02415510
Newname: SIP/Provider-02415510
Uniqueid: 1252231968.8

Event: Rename
Privilege: call,all
Channel: AsyncGoto/SIP/Provider-02415510
Newname: SIP/Provider-02415510
Uniqueid: 1252232157.11

Event: Rename
Privilege: call,all
Channel: SIP/Provider-02415510
Newname: AsyncGoto/SIP/Provider-02415510
Uniqueid: 1252231968.8

Event: Newexten
Privilege: dialplan,all
Channel: SIP/Provider-02424940
Context: meetme
Extension: 101
Priority: 1
Application: Answer
AppData:
Uniqueid: 1252232157.10

Event: Newexten
Privilege: dialplan,all
Channel: SIP/Provider-02424940
Context: meetme
Extension: 101
Priority: 2
Application: Wait
AppData: 1
Uniqueid: 1252232157.10

Event: Newexten
Privilege: dialplan,all
Channel: SIP/Provider-02415510
Context: meetme
Extension: 101
Priority: 1
Application: Answer
AppData:
Uniqueid: 1252232157.11

Event: Newexten
Privilege: dialplan,all
Channel: SIP/Provider-02415510
Context: meetme
Extension: 101
Priority: 2
Application: Wait
AppData: 1
Uniqueid: 1252232157.11

Event: Unlink
Privilege: call,all
Channel1: AsyncGoto/SIP/Provider-02415510
Channel2: AsyncGoto/SIP/Provider-02424940
Uniqueid1: 1252231968.8
Uniqueid2: 1252231975.9
CallerID1: (null)
CallerID2: (null)

Event: VarSet
Privilege: dialplan,all
Channel: AsyncGoto/SIP/Provider-02415510
Variable: ANSWEREDTIME
Value: 176
Uniqueid: 1252231968.8

Event: VarSet
Privilege: dialplan,all
Channel: AsyncGoto/SIP/Provider-02415510
Variable: DIALEDTIME
Value: 189
Uniqueid: 1252231968.8

Event: Hangup
Privilege: call,all
Channel: AsyncGoto/SIP/Provider-02424940
Uniqueid: 1252231975.9
CallerIDNum:
CallerIDName:
Cause: 16
Cause-txt: Normal Clearing

Event: VarSet
Privilege: dialplan,all
Channel: AsyncGoto/SIP/Provider-02415510
Variable: DIALSTATUS
Value: ANSWER
Uniqueid: 1252231968.8

Event: Dial
Privilege: call,all
SubEvent: End
Channel: AsyncGoto/SIP/Provider-02415510
UniqueID: 1252231968.8
DialStatus: ANSWER

Event: Hangup
Privilege: call,all
Channel: AsyncGoto/SIP/Provider-02415510
Uniqueid: 1252231968.8
CallerIDNum:
CallerIDName:
Cause: 16
Cause-txt: Normal Clearing

Event: Newexten
Privilege: dialplan,all
Channel: SIP/Provider-02415510
Context: meetme
Extension: 101
Priority: 3
Application: MeetMe
AppData: 101|1dFqAx
Uniqueid: 1252232157.11

Event: Newexten
Privilege: dialplan,all
Channel: SIP/Provider-02415510
Context: meetme
Extension: h
Priority: 1
Application: Hangup
AppData:
Uniqueid: 1252232157.11

Event: VarSet
Privilege: dialplan,all
Channel: SIP/Provider-02415510
Variable: RTPAUDIOQOS
Value: ssrc=1460519518;themssrc=463109880;lp=0;rxjitter=0.001783;rxcount=779;txjitter=0.000519;txcount=291;rlp=0;rtt=0.022000
Uniqueid: 1252232157.11

Event: Hangup
Privilege: call,all
Channel: SIP/Provider-02415510
Uniqueid: 1252232157.11
CallerIDNum:
CallerIDName:
Cause: 16
Cause-txt: Normal Clearing

Event: Newexten
Privilege: dialplan,all
Channel: SIP/Provider-02424940
Context: meetme
Extension: 101
Priority: 3
Application: MeetMe
AppData: 101|1dFqAx
Uniqueid: 1252232157.10

Event: Newexten
Privilege: dialplan,all
Channel: SIP/Provider-02424940
Context: meetme
Extension: h
Priority: 1
Application: Hangup
AppData:
Uniqueid: 1252232157.10

Event: VarSet
Privilege: dialplan,all
Channel: SIP/Provider-02424940
Variable: RTPAUDIOQOS
Value: ssrc=1854403486;themssrc=1285761473;lp=4294967291;rxjitter=0.001834;rxcount=690;txjitter=0.000610;txcount=293;rlp=0;rtt=0.018000
Uniqueid: 1252232157.10

Event: Hangup
Privilege: call,all
Channel: SIP/Provider-02424940
Uniqueid: 1252232157.10
CallerIDNum:
CallerIDName:
Cause: 16
Cause-txt: Normal Clearing

Any idea why it hangs up ?

I’m not sure why you’re getting the hangup.

We experienced hangups when redirecting channels, but it was a different scenario. When we redirected a live channel from a queue set to ‘record’ (in FreePBX) to an extension set to record ‘on-demand’, the caller would be disconnected. However, when we set the extension for ‘record always’ then the hangup issue went away. I assumed it was something to do with recording and some recording flag was left in the wrong state.

FYI - we’re using 1.4.26.1 right now. You might try the most basic scenario (originate a call from an extension to the meetme room, then 2 extensions, then try the redirect) and see if you can get it to work at all, then get progressively more complicated until it breaks.

I have an even simpler scenario - I am not trying to connect a 3rd channel to the meet me room, just redirect the 2 existing channels from an originate+dial action.

How do you set an extension to record always ?

It’s a FreePBX thing.

To try something simpler, you might try first to originate a call to the meetme room from an extension that isn’t a live channel. The phone will ring at the extension and when they pickup they’ll be in the meetme room.

First, isolate that this dialplan context works and the meetme config works.

Then attempt redirecting just one or the other of the 2 channels into the meetme room.

You should also bring up the console from command line and watch the events during the redirect. You might get a clue as to why they’re disconnecting.