[asterisk-users] Logs for Call generated by Manager API

Lee Jenkins lee at datatrakpos.com
Fri Mar 14 12:51:52 CDT 2008


sanjay.rajdev at featherstoneinformatics.com wrote:
> Is there way to get the logs of the call generated by Manager API, or is there some other way to achieve same scenario so that I can get the status of the call generated by me.
> 
> 
> Actually I have a scenario where I have to call customers and play a message, I do not want to send messages to Manager to generate all the calls at once, I just want to monitor the status of the call placed by me, so that I do not place more than 2 or 3 calls at the same time, hence not consuming all the available line on the Asterisk Server, leaving some lines for other people too. 
> 
> 
> Please help.
> 
> Regards,
> Sanjay.
> 

I could have sworn I heard/read of a settings that setts the maximum number of 
calls for AMI.  I could very well be wrong though.

I think you'll have to track the number that you called in the Originate command 
against Events specific to dialing like NewState and Hangup events.

I'm been doing quite a bit of work with the AMI lately, but I'm still learning 
so take this with a grain of salt.

Anyway, you could track the events as they come in.  For instance,

Event: Newstate
Privilege: call,all
Channel: SIP/axVoice-08f9d168
State: Up
CallerID: 3023815555
CallerIDName: <unknown>
Uniqueid: 1205515775.1003

You can check this event to see if the CallerID matches the number that you 
called.  If so, then store the Channel variable and/or Uniqueid variable to 
match against other events that do not provide the CallerID.  But now you know 
the number and the channel/Uniqueid the call is being made on.

Hangup Event:

Event: Hangup
Privilege: call,all
Channel: SIP/axVoice-08f9d168
Uniqueid: 1205515775.1003
Cause: 16
Cause-txt: Normal Clearing

Here's what you're looking for.  From what I can tell, the Hangup event will 
always fire if there is a NewState event which makes sense since the call is 
"Live" or "up".  Here we can take the channel variable and match it against our 
application's internal cache of "active" or "attempting" calls and decrement the 
count or free object references to ongoing attempts and then fire off another 
originate command.

I'm sure someone more knowledgeable will pipe in and correct me where I'm wrong.

HIH though.

-- 
Warm Regards,

Lee

"Everything I needed to learn in life, I learned selling encyclopedias door to 
door."



More information about the asterisk-users mailing list