1

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);
miken32
  • 42,008
  • 16
  • 111
  • 154
Nikola.Lukovic
  • 1,256
  • 1
  • 16
  • 33

1 Answers1

0

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

Nikola.Lukovic
  • 1,256
  • 1
  • 16
  • 33
  • 1
    The extension is intended to be used to indicate the extension in your context where the call should begin. The way you have it set up is a bit of a hack. You can dial a SIP number like this: `originateAction.Channel = "SIP//sip:+18001231234@domain.com";` – HTTP 501 Oct 03 '16 at 15:48