Asterisk - Detect answer via sip trunk

1.3k Views Asked by At

I have a SIp trunk and I want to make an outgoing call to a external analog number and play a message when the other side answers it. The problem is that the message be played as soon as it finish dialing the number, without waiting to answer. Between SIP extensions works fine but not for outgoing external calls. Any help?

Details: The call is initiated from the CLI (for simplicity)

CLI> Originate Sip/MySipTrunk/destinationNumber extension 6789@from-sip

in the dial plan:

[from-sip]

ext => 6789.1, answer ()

ext => 6789,n, Playback (demo-congrats)

ext => 6789.n, hangup ()

Thanks....

3

There are 3 best solutions below

0
On

You need setup answer detection on hardware used for dialout.

You also can write tone detection application, but that require guru level of knowledge and c/c++ programming experience.

There are no tone detect app in default asterisk install.

If detection is ok, issue can be with incorrect order in your "dialler". You can try switch order of call(first callout, not call ext) to be ok.

ps create dialling application require more then advanced level in asterisk. there are alot of other issues in this field.

0
On

I think there is an issue with your SIP trunk provider. I'm pretty sure there is 200 OK quite immediately after INVITE and then fake ringing in RTP audio.

0
On

not sure whether this was answered. but I see . btn your extension and answer application on the first line.

ext => 6789,1, answer ()

ext => 6789,n, Playback (demo-congrats)

ext => 6789,n, hangup