Search code examples
sql-serverdebianasteriskcrmsip

static queue and dynamic extensions


I use the odbc function and get the number of the manager from the MSSQL table if the client calls me a second or more times.

[incoming_calls]
exten => s,1,Set(fname=${CDR(uniqueid)})
exten=>  s,2,Set(extext=${ODBC_GET_EXTEN(${CALLERID(num)})})
exten => s,3,Dial(SIP/${extext})
exten => s,n,Hangup()

But if a client calls me the first time, the call must have got the manager according to the queue.

How can I combine a queue and a dynamic function? Is this a good solution?


Solution

  • I use goto and label. It works.

    [incoming_calls]
    exten => s,1,Set(fname=${CDR(uniqueid)})
    exten => s,2,Set(extext=${ODBC_GET_EXTEN(${CALLERID(num)})})
    exten => s,3,GotoIf($[${extext}!=""]?ee:qq)
    exten => s,4(qq),Queue(queue2228) ;
    exten => s,4(ee),Dial(SIP/${extext})
    exten => s,5,Hangup()