Changeset 1603
- Timestamp:
- 04/15/06 11:03:04 (7 years ago)
- Files:
-
- freepbx/trunk/amp_conf/astetc/extensions.conf (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
freepbx/trunk/amp_conf/astetc/extensions.conf
r1561 r1603 274 274 exten => s,n,Set(DIAL_TRUNK=${ARG1}) 275 275 exten => s,n,AGI(fixlocalprefix) ; this sets DIAL_NUMBER to the proper dial string for this trunk 276 exten => s,n,GotoIf($["${DIAL_NUMBER:0:1}" = "+"]?hasplus) ; Skip next line if it already is prefixed by a plus 276 exten => s,n,Set(E164NETWORKS=e164.arpa-e164.info-e164.org) ; enum networks to check 277 exten => s,n,GotoIf($["${DIAL_NUMBER:0:1}" = "+"]?begin) ; Skip next line if it already is prefixed by a plus 277 278 exten => s,n,Set(DIAL_NUMBER=+${DIAL_NUMBER}) ; Add a plus to the start, becasue ENUMLOOKUP needs it. 278 ; OK, this is now quite complex. To remain compliant, we have to iterate 279 ; through, in order, the returned records. Since we want to make this 280 ; call over the network, we can ignore tel: lines. Even if it's first 281 ; priority. 282 exten => s,n(hasplus),Set(ENUMCOUNT=${ENUMLOOKUP(${DIAL_NUMBER},ALL,c,e164.org)}) ; Should e164.org be a var? I think so. 283 ; Now the count may be zero, so if it is, just go to failed 284 exten => s,n,GotoIf($[ $[ ${ENUMCOUNT} = 0 ] | $[x${ENUMCOUNT} = x ] ]?failed) 279 280 ; start of main network loop 281 exten => s,n(begin),NoOp(E164NETWORKS is ${E164NETWORKS}) 282 exten => s,n,GotoIf($["${E164NETWORKS:1:2}"=""]?failedtotally) 283 exten => s,n,Set(ENUMNET=${CUT(E164NETWORKS,-,1)}) 284 exten => s,n,Set(E164NETWORKS=${CUT(E164NETWORKS,-,2-)}) 285 286 exten => s,n,NoOp(E164NETWORKS is now ${E164NETWORKS}) 287 exten => s,n,NoOp(ENUMNET is ${ENUMNET}) 288 289 exten => s,n,Set(ENUMCOUNT=${ENUMLOOKUP(${DIAL_NUMBER},all,c,${ENUMNET})}) 290 exten => s,n,Set(ENUMPTR=0) 291 292 ; start of main lookup loop 293 exten => s,n(startloop),GotoIf($["${ENUMPTR}"<"${ENUMCOUNT}"]?continue:failed) 294 285 295 ; Now, let's start through them. 286 exten => s,n ,Set(ENUMPTR=1)287 exten => s,n (startloop),Set(ENUM=${ENUMLOOKUP(${DIAL_NUMBER},ALL,${ENUMPTR},e164.org)})288 ; Sanity check the return, make sure there's something in there. 289 exten => s,n,GotoIf($[${LEN(${ENUM})} = 0 ]?continue) 296 exten => s,n(continue),Set(ENUMPTR=$[${ENUMPTR}+1]) 297 exten => s,n,Set(ENUM=${ENUMLOOKUP(${DIAL_NUMBER},all,${ENUMPTR},${ENUMNET})}) 298 299 ; Deal with reponse 290 300 exten => s,n,GotoIf($["${ENUM:0:3}" = "sip" ]?sipuri) 291 301 exten => s,n,GotoIf($["${ENUM:0:3}" = "iax" ]?iaxuri) … … 293 303 ; about dialstatus and retries if there are any enum results left. 294 304 exten => s,n,GotoIf($["${ENUM:0:3}" = "h32" ]?h323uri) 295 ; If we're here, it's not a protocol we know about. Let's increment the pointer 296 ; and if it's more than ENUMCOUNT, we know we've run out of options. We also can 297 ; come here if the enum string we've received is empty, or if the Dial command 298 ; returned CONGESTION or CHANUNAVAIL. 299 exten => s,n(continue),Set(ENUMPTR=$[${ENUMPTR}+1]) 300 exten => s,n,GotoIf($[${ENUMPTR} > ${ENUMCOUNT}]?failed) 305 301 306 ; OK. If we're here, we've still got some enum entries to go through. Back to 302 307 ; the start with you! 303 308 exten => s,n,Goto(startloop) 309 304 310 ; If the prefix is 'sip:'... 305 311 exten => s,n(sipuri),Set(DIALSTR=SIP/${ENUM:4}) 306 312 exten => s,n,Goto(dodial) 313 307 314 ; If it's IAX2... 308 315 exten => s,n(iaxuri),Set(DIALSTR=IAX2/${ENUM:5}) 309 316 exten => s,n,Goto(dodial) 317 310 318 ; Or even if it's H323. 311 319 exten => s,n(h323uri),Set(DIALSTR=H323/${ENUM:5}) … … 313 321 exten => s,n(dodial),Dial(${DIALSTR}) 314 322 exten => s,n,NoOp(Dial exited in macro-enum-dialout with ${DIALSTATUS}) 323 315 324 ; Now, if we're still here, that means the Dial failed for some reason. 316 325 ; If it's CONGESTION or CHANUNAVAIL we probably want to try again on a … … 318 327 ; left, and I didn't keep any previous dialstatuses, so hopefully 319 328 ; someone looking throught the logs would have seen the NoOp's 320 exten => s,n,GotoIf($["${ENUMPTR}" = "${ENUMCOUNT}"]?noneleft) 321 exten => s,n,GotoIf($[ $[ "${DIALSTATUS}" = "CHANUNAVAIL" ] | $[ "${DIALSTATUS}" = "CONGESTION" ] ]?continue) 329 exten => s,n,GotoIf($["${ENUMPTR}"<"${ENUMCOUNT}"]?maybemore:dialfailed) 330 exten => s,n(maybemore),GotoIf($[ $[ "${DIALSTATUS}" = "CHANUNAVAIL" ] | $[ "${DIALSTATUS}" = "CONGESTION" ] ]?continue) 331 322 332 ; If we're here, then it's BUSY or NOANSWER or something and well, deal with it. 323 exten => s,n(noneleft),Goto(s-${DIALSTATUS},1) 333 exten => s,n(dialfailed),Goto(s-${DIALSTATUS},1) 334 324 335 ; Here are the exit points for the macro. 325 exten => s,n(failed),NoOp(EnumLookup failed) 336 exten => s,n(failed),NoOp(EnumLookup failed on network ${ENUMNET}) 337 exten => s,n,Goto(begin) 338 339 exten => s,n(failedtotally),NoOp(EnumLookup failed -- no more networks to try) 326 340 exten => s,n,Goto(end) 341 327 342 exten => s,n(nochans),NoOp(max channels used up) 343 328 344 exten => s,n(end),NoOp(Exiting macro-dialout-enum) 329 345
