Mordechay Kaganer
2013-Aug-22 14:43 UTC
[asterisk-users] How to get the original SIP result code
B.H. Hello, i'm using AMI Originate action (with async=true) to send outgoing calls to a SIP trunk (using asterisk-java library to connect to AMI). The problem is that in case of failed originate, OriginateResponse event is returning only the reason code which is sometimes not sufficient to determine the real cause of failure. Also, there's no way to link between the channel that was trying to dial and failed and the original Originate request, because OriginateResponse is issued only after the failed channel was hang up. Only successful OriginateResponse will contain the unique id of the established channel. Is there any way that my AMI application can get the original SIP response of the failed Originate action? I'm using Asterisk 1.8.22 and slightly tweaked asterisk-java ( https://blogs.reucon.com/asterisk-java/) 1.0.0. -- ????? ?????? ???? ???? ???? ?????? ??????? ?????????! ???? NOW! Moshiach is coming very soon, prepare yourself! ??? ?????? ?????? ?????? ??? ????? ????? ???! -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20130822/9a6c1020/attachment.htm>
Gopalakrishnan N
2013-Aug-22 23:03 UTC
[asterisk-users] How to get the original SIP result code
You can use AMI Commands and run sip set debug from that you have to capture the response code. http://www.voip-info.org/wiki/view/Asterisk+Manager+API+Action+Command Regards, On Thu, Aug 22, 2013 at 10:43 PM, Mordechay Kaganer <mkaganer at gmail.com>wrote:> B.H. > > Hello, i'm using AMI Originate action (with async=true) to send outgoing > calls to a SIP trunk (using asterisk-java library to connect to AMI). > > The problem is that in case of failed originate, OriginateResponse event > is returning only the reason code which is sometimes not sufficient to > determine the real cause of failure. Also, there's no way to link between > the channel that was trying to dial and failed and the original Originate > request, because OriginateResponse is issued only after the failed channel > was hang up. Only successful OriginateResponse will contain the unique id > of the established channel. > > Is there any way that my AMI application can get the original SIP response > of the failed Originate action? > > I'm using Asterisk 1.8.22 and slightly tweaked asterisk-java ( > https://blogs.reucon.com/asterisk-java/) 1.0.0. > > > -- > ????? ?????? ???? ???? ???? ?????? ??????? ?????????! > ???? NOW! > Moshiach is coming very soon, prepare yourself! > ??? ?????? ?????? ?????? ??? ????? ????? ???! > > -- > _____________________________________________________________________ > -- Bandwidth and Colocation Provided by http://www.api-digital.com -- > New to Asterisk? Join us for a live introductory webinar every Thurs: > http://www.asterisk.org/hello > > asterisk-users mailing list > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20130823/1e37d267/attachment.htm>
Gareth Blades
2013-Aug-23 08:21 UTC
[asterisk-users] How to get the original SIP result code
On 22/08/13 15:43, Mordechay Kaganer wrote:> B.H. > > Hello, i'm using AMI Originate action (with async=true) to send > outgoing calls to a SIP trunk (using asterisk-java library to connect > to AMI). > > The problem is that in case of failed originate, OriginateResponse > event is returning only the reason code which is sometimes not > sufficient to determine the real cause of failure. Also, there's no > way to link between the channel that was trying to dial and failed and > the original Originate request, because OriginateResponse is issued > only after the failed channel was hang up. Only successful > OriginateResponse will contain the unique id of the established channel. > > Is there any way that my AMI application can get the original SIP > response of the failed Originate action? > > I'm using Asterisk 1.8.22 and slightly tweaked asterisk-java > (https://blogs.reucon.com/asterisk-java/) 1.0.0. >You could dial a local channel instead and have that then go on and dial the destination. You will then be able to retrieve the sip response using something like :- [localdial] exten => _X.,1,Set(ddi=${CUT(EXTEN,,1)}) exten => _X.,n,Set(carrier=${CUT(EXTEN,,2)}) exten => _X.,n,Set(dialtime=${EPOCH}) exten => _X.,n,Set(_MASTERCHANNEL=${CHANNEL}) exten => _X.,n,Dial(SIP/${ddi}@${carrier}) exten => _X.,n,Set(SIPcause=${MASTER_CHANNEL(HASH(SIP_CAUSE,${CDR(dstchannel)}))}, Responsetime=$[${EPOCH}-${dialtime}]) exten => _X.,n,Set(SIPcode=${CUT(SIPcause," ",2)}) However you will need to set "storesipcause=yes" in your sip.conf for this to work. It is known to have a performance hit. A better way would be to upgrade Asterisk and use hangup handlers. The documentation on how to do this in Asterisk 11 is poor and often wrong. I have written a blog about how we set it up as we use the feature all the time. http://gblades.blogspot.co.uk/2013/07/how-to-get-sip-response-code-in.html -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20130823/2541849f/attachment.htm>