Why Anonymously showing in AMI originate command?

I configure AMI, Also I make call from AMI’s originate command but when I give command like this,

Action:Originate
Channel:PJSIP/1101
Context:Long-Distance
Exten:1101
Priority:1

It’s make work but I received call like this sip:anonymously@anonymously.invalid
Why this happening?

What if I have to call like from exten 1101 to 1102, this both extens registered.
Thank you

Edit1:
I change something in my code,

Action:Originate
Channel:PJSIP/1106
Context:Long-Distance
Exten:1101
Priority:1

Its first make call to 1106 as Anonymously then 1101.

Why Anonymously is come in between why not direct 1106 to 1101?

You did not provide a caller id when originating the call to 1106.

Action:Originate
Channel:PJSIP/1106
Context:Long-Distance
Exten:1101
Priority:1
CallerID:1106

Hey man, I give like this but still not happening anything different.

Let me explain the scenario, When I double enter after Originate script then It’s made the first call to 1106 as anonymous@anonymous.invalid When I picked up/ Answer call to that, its ring to 1102 as 1106@192.168.1.4 and When I answer that call I can communicate bidirectionally.

But still, on another device screen, I see caller name anonymous.

Hey did you understand my point? Or anything I should add for more details.

When you use originate, you create two channels. In your case you create a call to PJSIP/1106 this call originates from within asterisk, and without running any kind of dial plan beforehand it just plain dials PJSIP/1106. If you want to control variables, you can use the Local/1106@someContext form to dial instead.

[someContext]
exten => 1106,1,Set(CallerID(num)=1106)
 same => n,Set(CallerID(name)=Something)
 same => n,Dial(PJSIP/1106)

And you would originate the call like so:

Action:Originate
Channel:Local/1106@someContext
Context:Long-Distance
Exten:1101
Priority:1
CallerID:1106
1 Like

Thanks, @Chano
can you tell me whats is local in
Local/1106@someContext
and where should I write this in my extension.conf file

[someContext]
exten => 1106,1,Set(CallerID(num)=1106)
 same => n,Set(CallerID(name)=Something)
 same => n,Dial(PJSIP/1106)

?

I just started this 2 weeks ago so that’s why I’m not sure clear on this.

Local/ will instruct Asterisk to run the dialplan for the specified extension@context, instead of just dialing the PJSIP endpoint directly. This allows you to set the required variables on the channel, before actually calling the device. When using PJSIP Asterisk uses whatever is set at that point in time, when using originate, not many, if any, variables are set in advance, and you get things like missing caller ID, and other “funny” stuff. I had to do similar tricks to make it possible for our customers to upload a document through a webinterface, and have it sent as a fax to the recipient. (Apparently FAX is still a thing in 2021… )

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.