[asterisk-app-dev] ARI - Can't use same channel id

Phil Mickelson phil at cbasoftware.com
Sat Sep 27 19:52:15 CDT 2014


tl;dr:  Make sure you always use a unique channel id if you are specifying
what the channel id is when you create the channel.

I just ran into a problem that took me all day to solve.  It may be in the
docs somewhere but I haven't seen it explicitly.  However, once it dawned
on me why it was failing it was obvious.  Since Asterisk does the exact
same thing.

I was attempting to make a call out from a program I've written using ARI.
The endpoint phone rang just fine.  However, other than knowing I made the
call, I had no way of knowing it started.  I do get the ChannelDestroyed
stasis message if the no one answers the phone.  This was specifically what
I was looking for.

However, when I tried to test the second time it didn't work.  The phone
would ring, but I wouldn't get the stasis message saying it didn't answer.

I looked everywhere.  I couldn't find anyone else with the same problem.
It didn't make any sense since Asterisk was telling me from the console
program that the channel was being destroyed.

Since I can't get the auto channel id I have to specify one.  And, I do
that by combining the caller id and a table row number.  If I attempt to
make multiple calls without creating a new row (which I do for the same
customer) then I end up using the same channel id.  If I exit the customer
call I was on and start over again (thereby creating a new row in the
table) the channel destroy message would show up in the stasis message.
But, again, only once.

Eight hours later, it finally dawned on me that this is why Asterisk
creates a new channel id each time a channel is created automatically.  I
thought it had to do with logging or billing, etc.

So, create a new channel id each time, just to be sure.  Just like
Asterisk, all you have to do is add a number to the end.  Anything that
makes it unique will work.

In closing, I would like to say how much fun I'm having (other than today)
working with your new ARI.  It is FANTASTIC!!  Thank you so much for
creating it.  I look forward to all the things I can do with it.

Regards,
Phil Mickelson
CBA Software, LLC
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-app-dev/attachments/20140927/0f86baed/attachment.html>


More information about the asterisk-app-dev mailing list