Changing Context and CallerID in sip_additional.conf

Hi,

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

Thx

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.

Hi Stewart1,

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?

Thx

By the way, is there any commercial modules out there in this case?

Hi,

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?

Thx in advance

It’s been 21days, isn’t there anyone give me a clue or at least tell me who I should ask to?

Thx

Sorry that I missed that post.

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.

Hi Stewart1,

OK thank you for your assistance. I really hope someone can provide solution. I don’t mind to accept commercial issue for it.

Thx

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.

1 Like

If all you are trying to do is modify caller ID name we did something similar using the asterisk phonebook under the Admin section.

https://wiki.asterisk.org/wiki/display/AST/Function_DB_EXISTS

Put 7322 & John Six for the Number and Name Asterisk Phonebook fields respectively.

exten => s,n,Set(NAMEOVRD=${DB_EXISTS(cidname/${CALLERID(number)})})

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.

Sangoma support here:

Thank you for your advice, Dave

I’ll try to contact Sangoma Support regarding my issue. Hope it will be the solution for my project. Thx

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