Why not

exten => s,4,Cut(TECHNOLOGY=CHANNEL,/,1)
exten => s,5,GotoIf($["${TECHNOLOGY}" = "Zap"]?6:9)


C F wrote:
This belongs at asterisk users, if you want some real help you should
try that list.
Your code doesn't make sense to me, if all your trying to see is what
device type is making the call then this will do:

set(DTYPE=${CHANNEL:0:4}) should give you either SIP/ or ZAP/ for those 2 types.

if you want everyting after the slash ('/') then this will do for
local, sip, and zap:
exten => 807,1,GotoIf($[${CHANNEL:0:5} = Local]?20)
exten => 807,2,GotoIf($[${CHANNEL:0:3} = Zap]?30)
exten => 807,3,Noop(not zap or local so must be sip)
exten => 807,4,Set(DEVICE=${CHANNEL:4})
exten => 807,5,Noop(${DEVICE})
exten => 807,20,Set(DEVICE=${CHANNEL:6})
exten => 807,21,Noop(${DEVICE})
exten => 807,30,Set(DEVICE=${CHANNEL:4})
exten => 807,31,Noop(${DEVICE})

if you want the above but that device should never contain the hex
value for the SIP calls, so that all you get is the device from
sip.conf and not the -abc3:
exten => 807,1,GotoIf($[${CHANNEL:0:5} = Local]?20)
exten => 807,2,GotoIf($[${CHANNEL:0:3} = Zap]?30)
exten => 807,3,Noop(not zap or local so must be sip)
exten => 807,4,Set(DEVICE=${CHANNEL:4:$[${LEN(${CHANNEL})} - 9]})
exten => 807,5,Noop(${DEVICE})
exten => 807,20,Set(DEVICE=${CHANNEL:6})
exten => 807,21,Noop(${DEVICE})
exten => 807,30,Set(DEVICE=${CHANNEL:4})
exten => 807,31,Noop(${DEVICE})

The above should give you 1324 for a channel that holds SIP/1234-abc3

On 11/22/05, Bill Michaelson <[EMAIL PROTECTED]> wrote:
Based on what I've read about Asterisk variables, I'm considering this
ugly snippet to determine the device from which a call originates in
order to drive further processing...

exten => 807,1,Set(L=${LEN(${CHANNEL})})
exten => 807,2,set(L=${MATH(${L}-5)})
exten => 807,3,noop(${L})
exten => 807,4,set(DEVICE=${CHANNEL:0:${L}}) ; chop off 5 chars


I strongly suspect that there is a better way.
_______________________________________________
Asterisk-Biz mailing list
Asterisk-Biz@lists.digium.com
http://lists.digium.com/mailman/listinfo/asterisk-biz

Reply via email to