Yes, I think so. I’m only looking to evaluate this variable during outbound calls. (At the same time I’m learning how all this fits together, but obviously not quite there yet. I’m still a little unsure about terminology.)
I see that values inserted in the “Edit SIP Trunk” page’s “PEER Details” appear in extensions_additional.conf like:
[code]Trunk name: c2800
PEER Details:
host=10.1.250.11
type=peer
secret=c2800pw
qualify=yes
username=c2800
fromuser=c2800
dtmfmode=auto
[/code]
results in:
/etc/asterisk/extensions_additional.conf
[c2800]
host=10.1.250.11
type=peer
secret=c2800pw
qualify=yes
username=c2800
fromuser=c2800
dtmfmode=auto
context=from-trunk-sip-c2800
In the above solution for determining when to add the diversion header I have to manually maintain the trunk in two locations: Edit SIP Trunk and extensions_custom.conf.
I’m wondering what it takes to add a key/value pair to the “PEER Details” such that I can simply match that key in macro-dialout-trunk-predial-hook.
The resulting macro-dialout-trunk-predial-hook could then be (apologies in advance for bogus pseudo-coding):
[macro-dialout-trunk-predial-hook]
exten => s,1,Noop(Need Diversion Header Check)
exten => s,n,ExecIf($["${${SIP CHAN}.SOMEKEY}"!=""],SIPAddHeader,"${${SIP CHAN}.SOMEKEY}"
exten => s,n,MacroExit()
Then the resulting PEER details would be changed to:
host=10.1.250.11
type=peer
secret=c2800pw
qualify=yes
username=c2800
fromuser=c2800
dtmfmode=auto
context=from-trunk-sip-c2800
SOMEKEY=Diversion: <sip:[email protected]>\;reason=unconditional\;screen=no\;privacy=off
To better restate the question: if I put SOMEKEY in the peer details, how would I access to test for that key’s value in macro-dialout-trunk-predial-hook?
Thank you for your help!