Asterisk Originate Command With clid


#1

Hi everyone!

I need to make call using asterisk originate command with src, dst , clid parameters.

Thank you in advance.
With regards, Sophia.


#2

That’s only directly supported by by the AMI action. For the dialplan application, you will need to make the A leg channel a local channel. I assume src means the A leg, as, there is no source channel for Originate; all calls are initiated from Asterisk.


#3

Thanks David for your Response. But I also tried AMI action. Below is my code:

$in = "Action: Originate\r\n";
$in .= "ActionID: ABC-100\r\n\r\n";
$in .= "Channel: SIP/123xxxxxx\r\n\r\n";
$in .= "Exten: 11xx\r\n\r\n";
$in .= "Context: default\r\n\r\n";
$in .= "Priority: 1\r\n\r\n";
$in .= "Timeout: 30000\r\n\r\n";
$in .= "Callerid: 123xxxxxx\r\n\r\n";

This code is displaying the error “Channel not specified”.


#4

That’s because the request only consists of:

Action: Originate
ActionID: ABC-100

You will presumably also get an invalid request error for each of

Channel:…
Exten:…
Context: …
Priority:…
Timeout:…
and
CallerID: …

As none of these requests contain an Action line.


#5

Thank you so much David. I am done with it. Thanks for your support. :slight_smile:


#6

Hi,

Call connection with clid is working fine for extension. But I’m facing one more issue if I want to connect call from random number instead of extension like .call file concept.

Below is my AMI code:-
$originateRequest = “Action: Originate\r\n”;
$originateRequest .= “Channel: SIP/TN/xxxxxxxxxx\r\n”;
$originateRequest .= “Callerid: yyyyyyyyyy\r\n”;
$originateRequest .= “Exten: zzzzzzzzzz\r\n”;
$originateRequest .= “Context: context\r\n”;
$originateRequest .= “Priority: 1\r\n”;
$originateRequest .= “Async: yes\r\n\r\n”;

Thank you in advance.
With regards, Sophia.


#7

I assume TN is the sip.conf section name for your ITSP.

In any case, you weren’t using extensions, as understood by Asterisk, in your previous examples. You might have had a degenerate case where the device name is the same as the primary extension used to access it.

To literally use extensions, use Local channels, e.g. Local/extension@internal_phones_context

Obviously Local/extension@default will work for local devices, but you shouldn’t be using the default context for potentially chargeable calls.


#8

Thank you so much David. It’s working.