Simply AGI Script Help

Discussion in 'General' started by ctrahan, Oct 20, 2009.

  1. ctrahan

    Joined:
    Oct 19, 2009
    Messages:
    3
    Likes Received:
    0
    Hello there, I am a little off on my programming these days. I am experienced in PHP, Perl, ASP and Visual Basic (Visual Studio 6.0). My problem is, I am attempting to program here with Asterisk. I currently have a DID setup to route to a time condition which if the time condition is met it will send them to the IVR otherwise it is sent to a closed announcement and the line is terminated. What I would like to do is, when that DID is dialed into instead going straight to the time condition, I would like it to check the caller ID and if its a certain number I would like to have it play a file saying "Please enter the phone number or extension to be dialed or press the * key to go to the IVR" other wise if the number is not a certain number go straight to the time condition. If the number is a certain phone number and one enters a PHONE Number either 11, 10 or 7 digits I would like asterisk to just dial it using the default trunk, if its a 4 digit number then I would like it to route it to the default internal dial for the extension and if they press * I would like it to toss it straight to the IVR. I am not asking for someone to program this for me, as I can do that :), I am just not familiar with asterisk at all, having a hard time finding where to start. So if I could get pointed to the right direction, I can take care of the rest, or if anyone wants to shed some incite to all of this, let me know :)
     
  2. dicko

    Joined:
    Oct 24, 2008
    Messages:
    4,099
    Likes Received:
    0
    If your "known" cid's are relatively limited in number, you can do it by adding inbound routes that meet your CID criteria, just route them to a DISA (Direct System Inward Access) context that will draw dialtone in "from-internal", in effect they will be treated as internal calls.

    (I suggest "Elastix Without Tears" to familiarize yourself with Elastix in particular, http://FreePBX.org for the php/asterisk/mysql interface bits, and http://voip-info.org for a more general grounding in Asterisk and VOIP per se.)
     
  3. ctrahan

    Joined:
    Oct 19, 2009
    Messages:
    3
    Likes Received:
    0
    Thank you for your reply, I have been reading up on elastix, freepbx and elastix :), and thats a good idea how you said route it to a DISA, that part works nicly, except I cant figure out how to route an Inbound route based on the Caller ID of the person calling, I know how the inbound route works for when my DID comes in. Maybe I mis understood you in general, I was hoping to be able to either do this all by a Macro or by a custom AGI script, as I would like to be able to set the caller ID and, maybe turn on Recording or announce something in general ect. I would like to do it via a AGI script, but is there a way to call the IVR or time condition from the AGI script?
     
  4. dicko

    Joined:
    Oct 24, 2008
    Messages:
    4,099
    Likes Received:
    0
    Perhaps you did misunderstand me, many do!
    Apart from not completing the reading bit, I suggest you:

    Hover your mouse over the "Caller ID Number" text header in the unembedded FreePBX bit (the "DID Number" text header is also didactic when similarly treated). Seriously, that's all it takes, the hovering thingy is largely FreePBX' FM (selF docuMentation perhaps? ). You can have either a DID or a CID or both in an incoming route (or even a regex (regular expression) in either or both), it's your choice, the most restrictive will be honored, CID over DID.

    To me it's a KISS thing, your AGI solution will, I'm sure, be much more elegant if you need more or less granularity, I stand by my references for how to do that (and suggest you read the other posts in this particular Elastix forum for more insight).
     
  5. ctrahan

    Joined:
    Oct 19, 2009
    Messages:
    3
    Likes Received:
    0
    Wow, I learn something new everyday, I did not know it was DID or CID or a regex. Now I do though, and Since that is the case, then I understand your reference's suggest and I will use them. Thank you. I did not mean to offend you or anything, your reply seems like I might of hit a button or two lol. But no harm I am working on your method right now, I will keep you posted perhaps. Also I will read this forum some more, and see what else there is :), thank you again for pointing me in the right direction :)
     
  6. dicko

    Joined:
    Oct 24, 2008
    Messages:
    4,099
    Likes Received:
    0
    No buttons pressed or offense taken , I am occasionally a little short when apparently my post was replied to without being fully read, my apologies and welcome to Elastix.

    regards

    dicko
     

Share This Page