On 2/24/21 1:01 AM, Jaco Kroon wrote:
Hi,
I still think the changes for forcecommit should be done for
func_odbc, however, after various discussions we've decided to give
the daemon route a shot.
So just looking at the raw AMI event via UserEvent, this seems to have
a problem with quoting, for example:
Set(ODBC_trace()=CallerID: ${CALLERID(all)})
UserEvent(trace,Message: CallerID: ${CALLERID(all)})
The former in the DB ends up as: CallerID: "name" <number>
The quotes are missing in the AMI event:
Message: CallerID name <number>
Is this a bug, or am I missing some escaping that needs to happen
prior to passing to UserEvent?
Kind Regards,
Jaco
Interesting, I couldn't find anyone having similar problems nor any
working examples. I tried /UserEvent(trace,Message: CallerID:
${QUOTE(${CALLERID(all)})})/ but that becomes /AppData: trace, CallerID:
"\"2000\" <2000>"/. I guess UserEvent() is having a bad day. While
trying to encode the body as JSON (which also doesn't work) I did find
the workaround below which I think is pretty close:
UserEvent(trace,CallerID:{${QUOTE(${CALLERID(all)})}},Val:{${QUOTE("quoted")}})
Event: UserEvent
Privilege: user,all
Channel: SIP/2000-00000016
ChannelState: 6
ChannelStateDesc: Up
CallerIDNum: 2000
CallerIDName: 2000
ConnectedLineNum: <unknown>
ConnectedLineName: <unknown>
Language: en
AccountCode:
Context: sub-speakextennum
Exten: s
Priority: 3
Uniqueid: 1614152491.107
Linkedid: 1614152491.107
UserEvent: trace
CallerID: {"2000" <2000>}
Val: {"quoted"}
In any case, the UserEvent itself already contains the CID (CallerIDNum,
CallerIDName) but I assume you were testing quoting behavior.
There is also the alternative of listening to VarSet events. It is much
more spammy but is more straight-forward in dialplan and works with arrays:
Set(ARRAY(CallerID,Val)=${QUOTE(${CALLERID(all)})},${QUOTE("quoted")})
Event: VarSet
Privilege: dialplan,all
Channel: SIP/2000-0000001a
ChannelState: 6
ChannelStateDesc: Up
CallerIDNum: 2000
CallerIDName: 2000
ConnectedLineNum: <unknown>
ConnectedLineName: <unknown>
Language: en
AccountCode:
Context: sub-speakextennum
Exten: s
Priority: 3
Uniqueid: 1614153653.127
Linkedid: 1614153653.127
Variable: CallerID
Value: \"2000\" <2000>
Event: VarSet
Privilege: dialplan,all
Channel: SIP/2000-0000001a
ChannelState: 6
ChannelStateDesc: Up
CallerIDNum: 2000
CallerIDName: 2000
ConnectedLineNum: <unknown>
ConnectedLineName: <unknown>
Language: en
AccountCode:
Context: sub-speakextennum
Exten: s
Priority: 3
Uniqueid: 1614153653.127
Linkedid: 1614153653.127
Variable: Val
Value: \"quoted\"
Another alternative would be to format the event per your own preferences:
UserEvent(CallerID=${QUOTE(${CALLERID(all)})}|Val=${QUOTE("quoted")})
Event: UserEvent
Privilege: user,all
Channel: SIP/2000-00000019
ChannelState: 6
ChannelStateDesc: Up
CallerIDNum: 2000
CallerIDName: 2000
ConnectedLineNum: <unknown>
ConnectedLineName: <unknown>
Language: en
AccountCode:
Context: sub-speakextennum
Exten: s
Priority: 3
Uniqueid: 1614153302.122
Linkedid: 1614153302.122
UserEvent: CallerID="2000" <2000>|Val="quoted"
--
Dennis Buteyn
Xorcom Ltd
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
asterisk-dev mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-dev