PhantomVl / sccp_manager

SCCP Manager
35 stars 19 forks source link

Add support for setting "setvar=xxx=xxx" entries on sccpdevice and sccpline #83

Open dkgroot opened 3 years ago

dkgroot commented 3 years ago

Hi Alex, Most channel drivers support setting 'setvar' entries on peers, in the case of chan-sccp that would be for device and line entries. A setvar looks like setvar=variable_name=value in the sccp.conf. Note there can be multiple lines. Which in the realtime database would normally be split with ";" between the entries. So Mysql:setvar="variable1=yes;variable2=ok;overwrite_cidnum=yes;allow_international_calls=true" Luckily the setvar table entries is already there in the database (no updated needed), so i guess we only need the gui/frontend part.

When a device + line create a new channel a go to the dialplan, these setvar variables are attached to the newly created channel, and they are therefor available in the dialplan to be used. As far as i could see, FPBX doesn't seem to use them much or provide a standard way for them to be entered on the extension level, so i guess we would have to add this ourselfs on the sccpdevice and sccpline pages.

Personally i find these setvar entries very very nice when dealing with custom dialplan entries, to store extra information about the device and line being used and the permissions this line would have for example.

Would this be easy to do, or a lot of work ?

I use it in my dialplans all the time. For example

[1234]
type=line
...
setvar=canCallLocal=yes
setvar=canCallInterlocal=yes
setvar=canCallInternational=no

and then in dialplan

[outbound-routing]
exten => 00NXXXXXXXXX.,1,Nop(Route International)
same => n, GotoIf(${canCallInternational}==yes,permitted)
same => n, Nop(International dialing not permitted)
same => n, hangup()
same => permitted, Dial(SIP/provider/${EXTEN}, 30, R)

As all asterisk channel drivers support setvar on their extentions it might be a good idea to create a small "hook" module in a separate project, to extend core extension functionality. Instead of only providing it in sccp_manager. I am thinking something like: https://github.com/FreePBX-ContributedModules/sipcomment does. As it's a very small module, it would not require a lot/any maintenance after creation.