Originate set caller id

I’m using Originate to call a phone. Caller id displays anonymous and I would like to set the caller id. I see the documentation on the command

https://docs.asterisk.org/Asterisk_16_Documentation/API_Documentation/Dialplan_Applications/Originate/

here is one way I’ve tried to write it
same => n,Originate(PJSIP/1001,app,Playback,/var/lib/asterisk/sounds/en/custom/gate_alert,c(12345),n(“mqtt”))

From some examples it looks like this is how options are passed to functions? I can’t find many examples though. I just need to set the caller id so it’s not anonymous

In case you are wondering the reason I’m using “Originate” is because I’m calling my pbx from a microcontroller when the driveway sensor gets triggered, which then call two phones (one right now). Then the idea is to auto answer and play an audio file saying “gate alert”. Everything is working except I need to be able to set the caller id and name because I want it to say something other than anonymous and my phone can be set to only auto answer for a certain number.

Thanks, I’m not sure what I’m doing wrong here with the command

btw in case it’s mentioned I tried using Dial and auto answer but the Playback command would not play the audio file to the phone doing this. If there is a better way to try what I’m doing I’m open to that to. But if I could just set the caller ID I would be all set.

Here is the full code of this part of the dial plan

[from-trunk]
exten => 12345,1,NoOp(Auto-Answering Call for Extension 12345)
same => n,Originate(PJSIP/1001,app,Playback,/var/lib/asterisk/sounds/en/custom/gate_alert,c(12345),n(“mqtt”))
same => n,Hangup()

To set the caller ID when using the Originate application in Asterisk, you can specify the CALLERID(num) and CALLERID(name) options. Here’s how you can modify your Originate command to set the caller ID:

same => n,Originate(PJSIP/1001,app,Playback,/var/lib/asterisk/sounds/en/custom/gate_alert,c(12345),n(“mqtt”),CALLERID(num)=YourCallerIDNumber,CALLERID(name)=YourCallerIDName)

Replace YourCallerIDNumber with the desired caller ID number and YourCallerIDName with the desired caller ID name.

So, in the context of your dialplan:

[from-trunk]
exten => 12345,1,NoOp(Auto-Answering Call for Extension 12345)
same => n,Originate(PJSIP/1001,app,Playback,/var/lib/asterisk/sounds/en/custom/gate_alert,c(12345),n(“mqtt”),CALLERID(num)=YourCallerIDNumber,CALLERID(name)=YourCallerIDName)
same => n,Hangup()

This modification should set the caller ID to the specified values when making the call using Originate. Make sure to replace YourCallerIDNumber and YourCallerIDName with actual values you want to use for the caller ID.

I’ve tried it both ways

same => n,Originate(PJSIP/1001,app,Playback,/var/lib/asterisk/sounds/en/custom/gate_alert,c(12345),n(“mqtt”),CALLERID(num)=12345,CALLERID(name)=“mqtt”)

and

same => n,Originate(PJSIP/1001,app,Playback,/var/lib/asterisk/sounds/en/custom/gate_alert,CALLERID(num)=12345,CALLERID(name)=“mqtt”)

Still has caller ID as “Anonymous”. I used the c and n in params because the docs mention c being for caller id and n being for name.

Not according to the documentation.

According to the documentation:

c(12345),n(“mqtt”)

almost does it, but there should be no comma.

https://docs.asterisk.org/Asterisk_16_Documentation/API_Documentation/Dialplan_Applications/Originate/

Do you mind pasting an example? I’m sorry I tried without comma and it errored out. I understand how parameters are passed to functions and how options are passed in cli. I’m having a heck of a time understanding and finding example of how options are passed to a function in asterisk :frowning:

Most people have used options with Dial. e.g. this example from the Dial() documentation, which has two options (B and b), both with parameters:

Dial(PJSIP/alice,,b(default^called_channel^1(my_gosub_arg1^my_gosub_arg2))B(default^callee_channel^1(my_gosub_arg1^my_gosub_arg2)))

Of course, like with Dial, you need placeholders for the missing parameters, and you are missing those.

I did it thank you!!! I had tried adding the blank spaces with params before but was using the array brackets. Worked perfect without them

same => n,Originate(PJSIP/1001,app,Playback,/var/lib/asterisk/sounds/en/custom/gate_alert,,,c(12345)n(mqtt))

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