[Asterisk-Users] Re: long list of prefixes

Randy Bush randy at psg.com
Sat Dec 11 11:29:32 MST 2004


>> if a phone number starts with one of 50+ prefixes,
>> i want to send the sip call to gateway X.  if it
>> is in any other prefix, i want to send it to gate
>> Y.
> Take a look at http://www.voip-info.org/wiki-Asterisk+app_dbodbc

too big a hammer.  i finally did the agi hack.  for the archive

    [dial-hawi]
    exten => s,1,NoOp("dial-hawi")
    exten => _.,1,SetVar(PREFIX="")
    exten => _.,2,AGI(agi-prefix|${EXTEN:4:3})
    exten => _.,3,NoOp("agi-prefix returns ${PREFIX}")
    exten => _.,4,Dial(SIP/${PREFIX}${EXTEN:4}@spa3k2-out,60,Ttr)
    exten => h,1,Hangup()
    exten => i,1,GoTo(s,1)
    exten => t,1,GoTo(s,1)

with the script being a brutal

    #!/usr/local/bin/bash
    if ! grep $1 /usr/local/etc/hawi-prefixes > /dev/null; then
      echo SET VARIABLE PREFIX "1808"
    fi

randy




More information about the asterisk-users mailing list