Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Asterisk - Meetme - 3 way calls - Command Not Permitted on a dead channel

Posted on 2010-09-07
4
Medium Priority
?
2,259 Views
Last Modified: 2013-12-21
Hi,

We simulate 3-way calls using Asterisk and Meetme where when the caller places a call, we use Asterisk manager console to open a MeetMe conference, push the caller in a conference room, at the same time we call the other 2 parties and when they answer we bring them into the conference room.

So far so good. However when the 2 other parties hang up, we want Asterisk to force hanging up the caller as well. To do so, we use an AGI file that we called "hangup_check.agi" which checks for how many active parties are still on the line when someone hangs up. If we go below 2, we issue a hangup command.

$agi->hangup($_SERVER['argv'][1]);

For some strange reason that command issues the following error:

<SIP/192.168.0.191-b7304798>AGI Rx << HANGUP 1283882113.258
<SIP/192.168.0.191-b7304798>AGI Tx >> 511 Command Not Permitted on a dead channel

I even tried to hang up the "agi_channel" of the caller's active call and it gives the same error...
We use Asterisk 1.6.1.0

Any clue?
<SIP/192.168.0.191-b7304798>AGI Tx >> agi_request: e911/hangup_check.agi
<SIP/192.168.0.191-b7304798>AGI Tx >> agi_channel: SIP/192.168.0.191-b7304798
<SIP/192.168.0.191-b7304798>AGI Tx >> agi_language: en
<SIP/192.168.0.191-b7304798>AGI Tx >> agi_type: SIP
<SIP/192.168.0.191-b7304798>AGI Tx >> agi_uniqueid: 1283882114.259
<SIP/192.168.0.191-b7304798>AGI Tx >> agi_version: 1.6.1.0
<SIP/192.168.0.191-b7304798>AGI Tx >> agi_callerid: 627376
<SIP/192.168.0.191-b7304798>AGI Tx >> agi_calleridname: 911gateway
<SIP/192.168.0.191-b7304798>AGI Tx >> agi_callingpres: 0
<SIP/192.168.0.191-b7304798>AGI Tx >> agi_callingani2: 0
<SIP/192.168.0.191-b7304798>AGI Tx >> agi_callington: 0
<SIP/192.168.0.191-b7304798>AGI Tx >> agi_callingtns: 0
<SIP/192.168.0.191-b7304798>AGI Tx >> agi_dnid: unknown
<SIP/192.168.0.191-b7304798>AGI Tx >> agi_rdnis: unknown
<SIP/192.168.0.191-b7304798>AGI Tx >> agi_context: conference_check
<SIP/192.168.0.191-b7304798>AGI Tx >> agi_extension: h
<SIP/192.168.0.191-b7304798>AGI Tx >> agi_priority: 1
<SIP/192.168.0.191-b7304798>AGI Tx >> agi_enhanced: 0.0
<SIP/192.168.0.191-b7304798>AGI Tx >> agi_accountcode:
<SIP/192.168.0.191-b7304798>AGI Tx >> agi_threadid: -1218430064
<SIP/192.168.0.191-b7304798>AGI Tx >> agi_arg_1: 1283882113.258
<SIP/192.168.0.191-b7304798>AGI Tx >> agi_arg_2: 1
<SIP/192.168.0.191-b7304798>AGI Tx >> agi_arg_3: 1283882186

Open in new window

0
Comment
Question by:devteam
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 32

Accepted Solution

by:
DrDamnit earned 1000 total points
ID: 33621558
Your AGI script is looking at the SIP channel that is created when one of the "other" parties was using. When they hangup, that channel goes *poof* and no longer exists.

You need to add a function in your AGI that checks to see if the channel still exists once you get down below two. Or... checks to see if those channels are dead, and then issue the hangup command as a "I don't know what else to do" methodology. Kind of an .... "On Fail Goto" statement.

If your AGI is written in PHP or Perl you can post it here, and I'll check it for you.
0
 
LVL 1

Author Comment

by:devteam
ID: 33744784
Ok, here's how it all works:

Snippet 1 to 3 are the dial plan.

Call comes in and triggers Snippet 1.

in 911main.agi, it will trigger at one point a PHP file which calls the Asterisk Manager (Snippet 4). That will initiate conference_init from the dial plan (Snippet 2) which will call conf_leg_calling.agi which will dial out 2 persons.

When they pick up, the context 'conference_check' is called (From snippet 4), we check if we need to apply initial mute and then we conference the person in (Snippet 5).

When they hang up, it executes the hangup operation from Snippet 3 (hangup_check.agi). That will dynamically check how many users are left in the conference and if 1 person is left would issue a hangup command (Snippet 6).

That's when we get a "Command Not Permitted on a dead channel".
Snippet 1:
;for each calls
exten => _XXX!,1,Answer
exten => _XXX!,n,Ringing
exten => _XXX!,n,Set(cdr_start_time=${EPOCH})
exten => _XXX!,n,AGI(e911/911main.agi)
exten => _XXX!,n(not_call),Hangup

exten => i,1,Hangup
exten => t,1,Hangup
exten => T,1,Hangup
 
exten => h,1,Set(cdr_end_time=${EPOCH})
exten => h,n,AGI(e911/911cdr.agi,${UNIQUEID})
exten => h,n,Hangup


Snippet 2:
[conference_init]
exten => init,1,AGI(e911/conf_leg_calling.agi,${SID},${LEG_ID}); try to init one leg of conference from a list
exten => init,n,Hangup

exten => checking,1,AGI(e911/hangup_check.agi,${SID},${LEG_ID},${EPOCH})
exten => checking,n,Hangup

exten => h,1,Hangup


Snippet 3:
[conference_check]
exten => s,1,AGI(e911/conference_check.agi,${SID},${LEG_ID}); conference if caller online else hangup
exten => s,n,Hangup

exten => i,1,Hangup
exten => t,1,Hangup
exten => T,1,Hangup
 
exten => h,1,AGI(e911/hangup_check.agi,${SID},${LEG_ID},${EPOCH})
exten => h,n,Hangup


Snippet 4:
$call = $asm->send_request('Originate',
        array('Channel' => 'Local/init@conference_init',
        'Context' => 'conference_check',
        'Exten' => 's',
        'Priority' => 1,
        'Timeout' => 120000,
        'Callerid' => '911gateway',
        'Variable' => 'SID=' . $_SERVER['argv'][1] . ',LEG_ID=' . $_SERVER['argv'][2],
        'Async' => 'true'));


Snippet 5:
...
$agi->exec('MeetMe', $_SERVER['argv'][1] . ',dqx' . $sMute);


Snippet 6:
$agi->hangup($_SERVER['argv'][1]); // The argument is the unique ID..

Open in new window

0
 
LVL 1

Author Comment

by:devteam
ID: 33744801
We had a fix by using the MeetmeAdmin command to kick all users out of the conference...

But now we're switching to using ConfBridge which doesn't have a kick command :).. I guess we will need to hangup the proper way !!!

With ConfBridge we also get this Command not allowed on dead channel warning.! Back to square 1!!
$agi->exec('MeetmeAdmin', $_SERVER['argv'][1] . ',K');

Open in new window

0
 
LVL 1

Author Closing Comment

by:devteam
ID: 34002797
Dead question.
0

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Zaptel people (www.zaptel.com) got kind of annoyed with the fact that they were getting bombarded with searches for the zaptel driver system for Asterisk (not to mention they own the trademark on zaptel). So, they kindly requested that Digium ch…
Hey there Heard about jingle, the add on for XMPP that enables point to point audio between two XMPP clients. No server config necessary. Actually quite a cool feature. However, how good is it if you can not use those voice capabilities to do a P…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question