AGI Sample

Hello,

I’m trying to make outbound calls. I mean I’m trying to call my cell phone…
I set 2000,2001,2002 extensions in sip.conf.

And I set in extensions.conf file:
[OutboundContext]
exten => 2000,1,Dial(2000,20)
exten => 2001,1,Dial(2001,20)
exten => 2002,1,Dial(2002)

exten => _X.,1,Dial(SIP/${EXTEN}@OutboundContext)

I set in my code(C# code but I think it doens’t matter…)

MyAction oc = new MyAction();

oc.Context = “OutboundContext”;
oc.Priority = 1;
oc.Channel = “SIP/2002”;
oc.Exten = “05301234567”;//My Cell Phone

Does it correct? I mean which is better to use 2000,2001,… extensions to make call?
Or following is better?

oc.Context = “OutboundContext”;
oc.Priority = 1;
oc.Channel = “SIP/05301234567@OutboundContext”;
oc.Exten = “05301234567”;//My Cell Phone

I didn’t understand well.
Can you clarify this.
Thanks

Dial needs a technology in every address, at least as documented (although sip.conf may make the address look like it ends in the extension number, it is not really an extension number).

Your second originate makes the PSTN number call itself.

Why do you need third party control in an AGI application? Where you need it, most people would use call files. Basically what are you really trying to do.

With using call files, all the events work fine?
I need Answer and Hangup events.