I created a small script to change the values of CallerID and Context in sip_additional.conf file. My script will be triggered by third party’s application (Hotel Management System) in order to run. Here is the sample:
The original values are:
[81104]
Context= from-trunk
CallerID= Room 1104 <81104>
My script will change it to:
[81104]
Context= from-internal
CallerID= John Six <81104>
But I cannot apply the changes by executing any of the following command:
asterisk -rx ‘sip reload’
or
rasterisk -x reload
or
amportal admin reload
When I check it in WebGUI, it still shows the original values of Context and CallerID. Even when I restart freePBX, the original values remain intact and the changes I made in sip_additional.conf will be overwrited by the original values.
What’s the command to commit and reload the sip_additional.conf? Or is there any way to change Context and CallerID instead of editing sip_additional.conf file which can be triggered by third party’s application?
I use freePBX 2.11.0, asterisk 11.20.0, elastix 4.0.0
Don’t even think about dynamically modifying sip_additional.conf. Two chefs working in the same pot rarely results in anything tasty.
Create a new context e.g. guest-room and define it in extensions_custom.conf. It looks up the guest name in a new database table (key is extension number). If it’s null (room is unoccupied), it goes to from-trunk. Otherwise it sets CallerID to the guest name and goes to from-internal. Set all guest room extensions to use the guest-room context.
Then, when a guest is registered or checked out, your script simply updates the database entry; no reloads or restarts are needed.
Thank you for your response. Is there any how-to documentation about creating such a rule in extensions_custom.conf that I can learn from it since I am a newbie in freePBX?
I just search some documentations, though I haven’t found the exact case as I try to create but I did find an interesting documentation which may lead to my targets by some clues that Stewart1 described.
First I add something in extensions_custom.conf like this:
[macro-dialout-trunk-predial-hook]
exten => s,1,NoOp(CUSTOM: calleridall is ${CALLERID(all)})
exten => s,n,NoOp(CUSTOM: calleridnumber is ${CALLERID(number)})
exten => s,n,ExecIf($["${CALLERID(number)}" = “7322”]?NoOp(CUSTOM: Setting Caller ID override for source ${CALLERID(number)}))
exten => s,n,ExecIf($["${CALLERID(number)}" = “7322”]?Set(CALLERID(all)=“John Six” <7322>))
exten => s,n,MacroExit()
After executing amportal a r command. I test to make an internal call from 7322 extension to 8909 extension. The 8909 devices display the original CallerID which is Room 7322 instead of John Six. Can anyone show me what I missed?
The [macro-dialout-trunk-predial-hook] only gets executed on a ‘trunk’ call, i.e. one routed by Outbound Routes and usually a call via an external carrier. An internal call from one extension to another doesn’t execute that code.
IMO it’s best to create a new context for the guest rooms, but I’m not confident enough to post specific code without testing. I hope that another member will chime in, either with a solution or with an offer to implement this for you at a fair price.
We’re all users, and I doubt any of us are using the Hotel Management system you are using. Because of that, there probably aren’t a lot of people that can help you without a lot of up-front preparation. If it was me, I’d call Sangoma and ask them for some commercial support.
You can also try requesting some help in the “Support” area - same deal (commercial support), but with typing.
This will set the ${DB_RESULT} variable to the CID Name in Asterisk Phonebook. You could then set your ${CALLERID(name)} to ${DB_RESULT}.
What was cool about this was you could grant users access to just this module to keep the names up to date. No additional “coding” when making changes. The phonebook also supports .csv import/exports for mass changes and uploads.