Asterisk Manager and Originate

I’ve written a program that runs as a proxy and receives requests to originate calls. In the “simple example”; I receive a request; send it to Asterisk via the Asterisk Manager session I’ve enabled and the call goes out – every time.

However, when I start to add load things don’t work quite so well. It is like some of the originate requests “get lost” although I’ve successfully written them to the port…

In some cases I get back an Originate Successfully queued and in a couple cases I get back an Originate Failed and in some cases I don’t get a response.

Right now I am simply firing off a bunch of originates and then go look for event responses. Should I be waiting for the Event Response to the Action ID passed in before processing the next Originate message? Can Asterisk get confused if it receives to many Originate commands in “short order”?

any insight would be greatly appreciated.

Cheers,
Scott

I think you need to use the async parameter of the Originate request.

Action: Originate 
Channel: SIP/blah/6666661212
Context: default 
Exten: 101 
Priority: 1 
Callerid: 5555551212
Async: true

Thanks, that async option did solve my first problem. It brings me to a follow-up question though.

Let’s say I have 2 out going lines and I submit 6 originate requests. The first two go out fine but the the 3rd one fails because it receives a Hangup event with:
Cause: 34
Cause-txt: Circuit/channel congestion

and the CDR received has a disposition of FAILED.

Is there any way to manage this in Asterisk to define the number of outbound connections or somehow wait until there isn’t channel congestion?

Thanks again,
Scott

Thanks, that async option did solve my first problem. It brings me to a follow-up question though.

Let’s say I have 2 out going lines and I submit 6 originate requests. The first two go out fine but the the 3rd one fails because it receives a Hangup event with:
Cause: 34
Cause-txt: Circuit/channel congestion

and the CDR received has a disposition of FAILED.

Is there any way to manage this in Asterisk to define the number of outbound connections or somehow wait until there isn’t channel congestion?

Thanks again,
Scott

i am not sure there is any built in queue mechanism. i am doing something similar, but i maintain a state engine at the proxy level to determine how many calls i have up and if i need to wait to initiate the next originate.

Hey thanks! that is kind of what I thought. I’ll go down that road.

Cheers,
Scott