I'm having some trouble getting the channel status with an AGI script. #!/usr/bin/perl use Asterisk::AGI; $AGI = new Asterisk::AGI; my %input = $AGI->ReadParse(); $AGI->channel_status('Zap/1-1'); I am now stuck, and don't know how to get the return codes: -1 There is no channel that matches the given <channelname> 0 Channel is down and available 1 Channel is down, but reserved 2 Channel is off hook 3 Digits (or equivalent) have been dialed 4 Line is ringing 5 Remote end is ringing 6 Line is up 7 Line is busy Any help is always appreciated. --------------------------------- Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20030821/47b06e46/attachment.htm
On Thu, 21 Aug 2003, jerk face wrote:> I'm having some trouble getting the channel status with an AGI script. > > #!/usr/bin/perl > > use Asterisk::AGI; > $AGI = new Asterisk::AGI; > > my %input = $AGI->ReadParse(); > > $AGI->channel_status('Zap/1-1'); > > I am now stuck, and don't know how to get the return codes:Well assuming that you are using version 0.08 of asterisk-perl (because channel_status previously only worked on the current channel before then), then all you need to do is: $status = $AGI->channel_status('Zap/1-1'); and $status will contain the return value James
I'd like to use the AGI command "CHANNEL STATUS" to check the status of a channel. However, the dial() command doesn't return -1 until after the call has hung up. If that's the case, how is channel status supposed to return statuses like: <status> values: 0 Channel is down and available 1 Channel is down, but reserved 2 Channel is off hook 3 Digits (or equivalent) have been dialed 4 Line is ringing 5 Remote end is ringing 6 Line is up 7 Line is busy If dial() doesn't return -1 until after the call is complete, it doesn't seem possible to me that you can check '4 Line is ringing' for example. Doug
> I'd like to use the AGI command "CHANNEL STATUS" to check the statusof a> channel. However, the dial() command doesn't return -1 until after the > call has hung up. If that's the case, how is channel status supposedto> return statuses like: > > <status> values: > 0 Channel is down and available > 1 Channel is down, but reserved > 2 Channel is off hook > 3 Digits (or equivalent) have been dialed > 4 Line is ringing > 5 Remote end is ringing > 6 Line is up > 7 Line is busy > > If dial() doesn't return -1 until after the call is complete, itdoesn't> seem possible to me that you can check '4 Line is ringing' forexample.> > DougDoug, I get the distinct impression that CHANNEL STATUS is to be used independently of the dial() app. At least that's what I see when I read up on AGI, CHANNEL STATUS and dial(). Can you post a snip of the dialplan you've got? I'd like to tinker around with it. Thanks, MC
MC, But.... the channel status command is documented as an AGI command itself. If you look at http://www.voip-info.org/wiki-Asterisk+AGI, you'll see the 'channel status' command listed there as an AGI command. I can't post my dial plan, as I don't really have one. Well, I do, and it looks like this: exten => _X.,1,AGI(router.py) Everything is being controlled from the script. The script calls the dial() command. Problem is that dial() doesn't return a -1 (or anything) until after the call is complete. That makes it a BIT tough to check the status of a call. If dial() doesn't return until after the call completes, it means the channel status AGI command is a waste of time. Doug. -----Original Message----- From: Michael Collins [mailto:mcollins@fcnetwork.biz] Sent: Monday, February 27, 2006 1:36 PM To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: RE: [Asterisk-Users] AGI Channel Status> I'd like to use the AGI command "CHANNEL STATUS" to check the statusof a> channel. However, the dial() command doesn't return -1 until after the > call has hung up. If that's the case, how is channel status supposedto> return statuses like: > > <status> values: > 0 Channel is down and available > 1 Channel is down, but reserved > 2 Channel is off hook > 3 Digits (or equivalent) have been dialed > 4 Line is ringing > 5 Remote end is ringing > 6 Line is up > 7 Line is busy > > If dial() doesn't return -1 until after the call is complete, itdoesn't> seem possible to me that you can check '4 Line is ringing' forexample.> > DougDoug, I get the distinct impression that CHANNEL STATUS is to be used independently of the dial() app. At least that's what I see when I read up on AGI, CHANNEL STATUS and dial(). Can you post a snip of the dialplan you've got? I'd like to tinker around with it. Thanks, MC _______________________________________________ --Bandwidth and Colocation provided by Easynews.com -- Asterisk-Users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
MC, I think I worked out that I need to use ${DIALSTATUS} anyway. Don't really see what 'channel status' is for... -----Original Message----- From: Douglas Garstang Sent: Monday, February 27, 2006 1:48 PM To: 'Asterisk Users Mailing List - Non-Commercial Discussion' Subject: RE: [Asterisk-Users] AGI Channel Status MC, But.... the channel status command is documented as an AGI command itself. If you look at http://www.voip-info.org/wiki-Asterisk+AGI, you'll see the 'channel status' command listed there as an AGI command. I can't post my dial plan, as I don't really have one. Well, I do, and it looks like this: exten => _X.,1,AGI(router.py) Everything is being controlled from the script. The script calls the dial() command. Problem is that dial() doesn't return a -1 (or anything) until after the call is complete. That makes it a BIT tough to check the status of a call. If dial() doesn't return until after the call completes, it means the channel status AGI command is a waste of time. Doug. -----Original Message----- From: Michael Collins [mailto:mcollins@fcnetwork.biz] Sent: Monday, February 27, 2006 1:36 PM To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: RE: [Asterisk-Users] AGI Channel Status> I'd like to use the AGI command "CHANNEL STATUS" to check the statusof a> channel. However, the dial() command doesn't return -1 until after the > call has hung up. If that's the case, how is channel status supposedto> return statuses like: > > <status> values: > 0 Channel is down and available > 1 Channel is down, but reserved > 2 Channel is off hook > 3 Digits (or equivalent) have been dialed > 4 Line is ringing > 5 Remote end is ringing > 6 Line is up > 7 Line is busy > > If dial() doesn't return -1 until after the call is complete, itdoesn't> seem possible to me that you can check '4 Line is ringing' forexample.> > DougDoug, I get the distinct impression that CHANNEL STATUS is to be used independently of the dial() app. At least that's what I see when I read up on AGI, CHANNEL STATUS and dial(). Can you post a snip of the dialplan you've got? I'd like to tinker around with it. Thanks, MC _______________________________________________ --Bandwidth and Colocation provided by Easynews.com -- Asterisk-Users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
> MC, > > I think I worked out that I need to use ${DIALSTATUS} anyway. Don'treally> see what 'channel status' is for... >Doug, I think the channel status might be more useful for incoming calls, or possibly to monitor specific channels other than the 'current' channel. I can't think of a reason to do this off the top of my head, although I suppose if you had an AGI script that needed to check the status of one or more channels that you could use 'channel status' for this purpose. You are right though - if dial() doesn't return any progress info while the dial is taking place then it is pointless to check the status of the channel - it's either dialing or it isn't! -MC
Hi, I have developed a custom agi and connect to it by placing a call through a sip phone. The agi issues the "STREAM FILE" command from a number of places in code to play out prerecorded messages. The problem is if the agi tries to play a file, using the STREAM FILE command, after the caller has dropped the call, the agi crashes midway. After issuing a "agi debug" command on the console here is what I observed. 1. Whenever a caller drops a call no interrupt is fired from asterisk to the agi to notify a hangup event. This prevents me from taking precautionary measures before issuing any command. 2. Even after the caller has dropped the call, I still see an active channel (verified using the "show channels" command). This is probably due to the fact that the agi is still connected. 3. When I send the STREAM FILE command from my agi this is what is shown on the asterisk console: AGI Rx << STREAM FILE file1 "#" 0 Mar 6 23:50:22 WARNING[5978]: file.c:583 ast_readaudio_callback: Failed to write frame AGI Tx >> 200 result=-1 endpos=6400 Spawn extension ........ exited non-zero on 'SIP/101-6600' As I understand, when asterisk receives the STREAM FILE command its has no channel to play it to and hence the warning is issued. Asterisk does send a -1 result but straight away kills the agi process ( I deduce this from the last line) which causes the agi to crash. Now I am totally clueless on how to handle such erroneous conditions. Any help will be appreciated. Thanks, Danish -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20060306/dfbb8858/attachment.htm