login | register
Sat 17 of May, 2008 [10:19 UTC]

voip-info.org

Search with Google
Search this site with Google. Results may not include recent changes.
 
Google Ads
Shoutbox
  • Juan Ortega, Thu 15 of May, 2008 [10:33 UTC]: Hi everybody, I'm Juan, an ITCom student, and I need to know what basic elements I need to create a VoIP network. Can anybody helpme, please?,Thank you very much
  • gineta, Wed 14 of May, 2008 [03:58 UTC]: any here not fine the configuration of firewall juniper -screem for VOIP asterisk????
  • Anoop Prabhakaran, Tue 13 of May, 2008 [12:16 UTC]: I am developing Asterisk IVR, Whenever i make a internation call to the IVR system, the DTMF is not getting detected properly, this happens only for the first time, second call onwards system works fine. why this is happening
  • joe, Mon 12 of May, 2008 [04:27 UTC]: Is there an opensource browser based softphone, or a system like Busta where everything is not manages through their website?
  • Nick Barnes, Fri 09 of May, 2008 [11:36 UTC]: Christopher - yesterday I tried an Asterisk install on a CentOS 5.1 box with stock GUI and it all worked fine. Sorry I can't help.
  • aero, Fri 09 of May, 2008 [08:20 UTC]: can someone help me out on this, i tried to play some sound files on my asterisk box and this is the error message i got. WARNING[4429]: format_wav.c:169 check_header: Unexpected freqency 22050 May 8 11:17:39 WARNING[4433]: codec_gsm.c:194 gsmtolin_fra
  • Christopher Faust, Thu 08 of May, 2008 [14:15 UTC]: I beleive that I may have to change something in the xserver configuration. Please advise
  • Christopher Faust, Thu 08 of May, 2008 [14:14 UTC]: Everything was perfect. In the bios I have increased the memory allocated Still receive input not supported on my display.
  • Christopher Faust, Thu 08 of May, 2008 [14:13 UTC]: This would not be my main box. I am doing some testing to see if I can install zaptel and asterisk 1.4 on a full centos 5.1 box with development software Its bizzare, because before I went through the asterisk and zaptel installation everything was perfe
  • Nick Barnes, Thu 08 of May, 2008 [13:44 UTC]: Christopher - I can't see any way in which an Asterisk installation would muck your GUI, but remember that it is advised not to use a GUI on an Asterisk box anyway.
Server Stats
  • Execution time: 0.40s
  • Memory usage: 2.20MB
  • Database queries: 33
  • GZIP: Disabled
  • Server load: 0.51

Asterisk manager experience

Working with the manager API and its limitations


After battling with the Asterisk Manager interface(and getting it to pretty
much do everything I want to do with it) I thought I'd share my experiences
with those who are developing or are thinking of developing applications
using it.

First here's a list of some of the things the manager interface will let you do:

  • Dial a call from any extension/resource to any other extension/resource,
some examples:
  • initiate a call from a sip phone to external zap line
  • initiate a call from an extension number to an external iax extension
  • initiate a call from within a meetme room to a zap channel
  • Redirect ANY live call to ANY destination, some examples:
    • take a live SIP call from whereever it is connected and send it to a meetme room
    • take a zap call from a meetme room and send it to an extension
    • take a ANY call and redirect it to an outside Zap channel
    • as an alternative to parking, just dump a call to a long background sound file or MoH and then retrieve it later by redirecting their channel somewhere else
  • Hangup any live channel whether it be SIP, Zap, IAX, H323, etc...
  • Hangup individual channels within a meetme conference
  • Initiate a recording(and stop it too) of any live Zap channel at any time(with custom filename)
  • Get the status of voicemail in any mailbox
  • Get the status of an extension
  • - Get data from commands such as "show channels"
  • Get data on Queues
  • Get data on IAX peers


Second, here are some things you should know if you are going to program for the manager interface:

  • The manager API is not well documented(Yes I know I need to add my notes to the wiki)
  • All connected terminals will receive all "Events" that happen on the Asterisk box
  • Not all Asterisk commands will be accepted with the "Action: Command" action
  • Disconnecting the connection between a remote connected terminal and the Asterisk box will often cause a deadlock (http://bugs.digium.com/bug_view_page.php?bug_id=0000861) <<<--This bug has been reported fixed on 2-07-2004
  • Any form of freeze on the connected terminal will cause a buffer overflow and will also deadlock Asterisk
  • "Status" Actions can yield upto a hundred lines of output depending on how busy your Asterisk machine is.
  • "Ping" and "Show uptime" may not return results in some applications(like perl Net::Telnet)
  • generally for applications where you will be sending under a hundred commands daily, the manager interface will work well and shouldn't cause any crashes/deadlocks.
  • for applications where you could be sending over a thousand manager commands to an Asterisk server from different client machines daily you will almost definitely have at least one crash/deadlock happen per day.
  • you can connect to the asterisk manager interface through any programming language that has a socket IO implementation(C, Python, Perl, PHP, etc...)
  • you can program an AGI to use the manager even(it you really wanted to)


How I solved my crash problem:

I had a problem, I was using the manager interface through over 30 desktop
machines to do a high number of redirect, originate, recording, hangup and
command actions to the tune of over five thousand commands per day. This
lead to upto 4 crashes/deadlocks per day on one of my Asterisk servers.
That's when I started to look hard at a centralized manager queue. After
some initial testing I determined that the best way for me to process all of
these actions was to have a database driven system by which two constantly
running scripts would separately send and parse manager actions and events.
Here's how the steps proceed on an Originate command:

  1. client inserts an Originate record into the queue table (with a unique Callerid value)
  2. action_sender application grabs the new record, submits the action and marks the record as SENT
  3. manager_listen application parses every line of manager output and sends blind UPDATE commands to the database based on the action CallerID field and/or the uniqueid field for a key - in the manager interface the callerid field can be unique to the call as sent into the manager
  4. client can grab the uniqueid and channel values out of the database now that the record has been processed

Under this process there is no risk of losing a manager connection on the
client machine, all manager connections exist on the localhost Asterisk
machine. Also, there is very little lag in processing actions through this
model even on a busy machine.


My suggestions for improving the manager interface:

  • make it more fault tolerant, I can live with the querky API and data formatting, but buffer overflows and not killing inactive connections causing crashes/deadlocks is VERY bad.

  • make a simple manager action file parser(sample.action), something like the sample.call interface except for manager actions, for output you can have the manager generate a sampleaction.out file that would have the output for that specific command on it. Many people that currently use the sample.call format would love to have a simple way to add manager functions to their apps that already generate sample.call files

  • make a transaction-based send-receive protocol, something like the HTTP protocol. This would be a lot more involved than the sample.action idea, but it is probably a step in the right direction for the future of Asterisk (this one isn't my idea, "jayson" is working on thishttp://bugs.digium.com/bug_view_page.php?bug_id=0000123)


Well, that's the end of my rambling for now, hope this helps.

MATT--

A Note About Busy
(Joel Rowbottom, joel <at> enovi <dot> com)

Annoyingly, the Manager API doesn't seem to return 'Busy' at all - instead just giving back a Hangup with no result codes.

See Also



Go back to Asterisk manager API

Created by JustRumours, Last modification by pashah on Wed 06 of Apr, 2005 [04:39 UTC]

Comments Filter

tranfer a call

by Xenon on Monday 20 of March, 2006 [16:52:05 UTC]
Could you comment on what command you would use to do the following: 'take a zap call from a meetme room and send it to an extension'

can u guide me if use jsp to develop the client

by aminshah75 on Tuesday 19 of April, 2005 [07:20:48 UTC]
Very nice article, helped me alot in understanding Manager API.
here is what i am doing.
I want to use JSP client to connect to Asterisk Manager API. This will work same as php might do. What i want to do is to let my jsp client to communicate with Database, so that my asterisk manager api get commands from data base, and response back to the data base. The JSP Client read the data back from data base. Now the Manager API will not crash, but may be over loaded. I can not figure out how to make efficient updates to the data base, so that the transaction between manager api, the data base, and the jsp client happen in real time, with minimum over load.
any suggestion (:idea:)

amin
Edit

Resolving overflows and dropped connections.

by Anonymous on Friday 03 of September, 2004 [00:33:01 UTC]
Would a simple solution to resolve deadlocks be to change asterisk to use UDP rather than TCP connections? This way if a client dropped off at least the asterisk server would not hang trying to send events. The ability to cancel an existing session once a new login for the same auth was used would probably be required in the long term

Please update this page with new information, just login and click on the "Edit" or "Add Comment" button above. Get a free login here: Register Thanks! - support@voip-info.org

Page Changes | Comments

Sponsored by:

Terms of Service Privacy Policy
© 2003-2008 VOIP-Info.org LLC

Powered by bitweaver