Question

I am developing a C#.NET Windows Application using Asterisk.NET Library. In my application NewState Event is triggered even when I originate the call (when it rings the source). I want only incoming calls to be shown as "Somebody is calling". Now it shows even for self-ringing calls (when originating),,, How can I check and avoid Originated calls from Newstate Event. Please Help..

Was it helpful?

Solution

Simplest way:

1) create originate with

Channel: Local/1234@dialout

and

Set: id=1
Set: otherinfo="nice call"

2) create dialplan like this

[dialout]
exten =>_X.,1,UserEvent(CatchMe,number: ${EXTEN}, db_id: ${id}, otherinfo: ${otherinfo})
exten =>_X.,2,Dial(SIP/${EXTEN}@outtrunk,,)

Same will work for inbound!!!

But also you can check other events, not NewState(which is VERY common).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top