How to put a cell phone number as exten in AsterNet

2.1k Views Asked by At

I'm trying to call a cell phone number after i hangup on an internal fixed phone, but it doesn't work, i don't know what is going on... This is the code that i was trying with, but it doesn'work. The fixed phone is called like it should, but the cell phone isn't...

var host = "somehost";
Int32 port = someport;
var user = "someuser";
var password = "somepassword";
var manager = new ManagerConnection(host, port, user, password);
manager.Login();

var originateAction = new OriginateAction();
var originateResponse = new ManagerResponse();

originateAction.Channel = "SIP/1040";
originateAction.CallerId = "1040";
originateAction.Context = "from-pstn";
originateAction.Exten = "SIP/CH_CABLECOM_BSL_OUT/somephonenumber";
originateAction.Priority = "1";
originateAction.Timeout = 30000;
originateAction.Async = true;

originateResponse = manager.SendAction(originateAction);
1

There are 1 best solutions below

1
On

I solved it. What needs to be done is to edit the extensions.conf on asterisk server and add a context. So just add to extensions.conf this->

[outbound-context]
exten => _.,1,Dial(SIP/{NAME OF YOUR PROVIDER HERE}/${EXTEN})

and originateAction needs to look like this:

originateAction.Channel = "SIP/1040";
originateAction.CallerId = "1040";
originateAction.Context = "outbound-context";
originateAction.Exten = "somephonenumber";
originateAction.Priority = "1";
originateAction.Timeout = 30000;
originateAction.Async = true;

originateResponse = manager.SendAction(originateAction);

And that's all there is to it