Incoming call DID

Nov 16, 2013 at 1:46 PM
Hi all!

I'm trying to create a simple application in C# which pulls the specific website based on inbound DID number. I'm using Asterisk.NET API and created a form which allows me to connect to Asterisk and get the basic information about the incoming call by utilizing the following code:

private void astCon_NewState(object sender, Asterisk.NET.Manager.Event.NewStateEvent e)
{
textBox1.Text = e.Attributes["connectedlinenum"];
textBox2.Text = e.Attributes["connectedlinename"];
textBox3.Text = e.ChannelStateDesc;
textBox4.Text = e.Channel;
}

How would I be able to get the DID number through which the call was made and reached my extension?

According to the asterisk main forum it should be "The ${EXTEN} value is including in the Extension: parameter of the Newexten AMI event, which is generated for each new priority executed in the dialplan"

Thank you in advance
Nov 18, 2013 at 7:49 PM
If you want information about the extension, you're using the event wrong. you're looking at (from your example) the NewState event, but you want NewExten event. NewState is fired when a channel state changes. NewExten fires when a new extension is reached.
Nov 18, 2013 at 8:09 PM
Skrusty,

this particular piece of code:
private void astCon_NewExten(object sender, Asterisk.NET.Manager.Event.NewExtenEvent e)
        {
            listBox1.Items.Add(e.Extension.ToString());
        }
Adds a bunch of "s", "vmx", "s-BUSY", "dstring", "zap2dahdi" strings and also adds some strings with extension which was dialed.

But I would like to capture the DID number, not the extension.