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.
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.
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