Variable mismatching

exten => 555,1,NoOP(member login/logout)
same => n,GotoIf(REGEX({CALLERID}), ${DB(Queue/PersistentMembers/support)})}?555-logout,1:555-login,1)
same => n,Hangup

exten => 555-login,1,noOp({CALLERID}) same => n,Answer() same => n,AddQueueMember(support,{CALLERID})
same => n,playback(beep)
same => n,Hangup

exten => 555-logout,1,noOp({CALLERID}) same => n,Answer() same => n,RemoveQueueMember(support,{CALLERID})
same => n,playback(beep)
same => n,Hangup

here is a part of my dialplan where i am trying to check whether a callerid exists or not in a queue and to be added to the database if not and if there then i try to log out.

the problem i am facing(the bolded line in the script above) is that REGEX takes string variable where as CALLERID function does not return a string.
so what could be done in order to solve it.
what i am clearly asking is how to change the callerID into a string.

for example $REGEX{“SIP/XXX”} … since “SIP/xxx” is a string and xxx is the extension real number.
in this way it works so fine but i want it to be more proffesional so i would take callerid and do what to be done.

Yes i did and it did not work

solved this way.

“SIP/${CALLERID(num)}”

I’d recommend adding FILTER function around the CALLERID(num) to restrict what you dial out.

1 Like