stripping "1" from calls with 1+area code?

Discussion in 'General' started by p2ii, Sep 18, 2008.

  1. p2ii

    Joined:
    Sep 10, 2008
    Messages:
    13
    Likes Received:
    0
    I'm using Voicepulse for SIP trunks but it appears they only accept 7/10 digit dialing. I would like to strip the 1 from outgoing calls when dialing 1NXXXXXXXXX. Any ideas? Thanks

    -Pat
     
  2. wiseoldowl

    Joined:
    Aug 19, 2008
    Messages:
    251
    Likes Received:
    0
    Go to the FreePBX HowTOs page:

    http://www.freepbx.org/support/documentation/howtos

    Click on "Hints on Route Dial Patterns and Trunk Dial Rules"

    Read and learn.

    (Yes, I'm teaching you to fish rather than giving you a fish, to torture a metaphor somewhat, but this is such a basic question that you need to learn how to use the FreePBX documentation site, where unfortunately things aren't always presented in an obvious manner.)
     
  3. p2ii

    Joined:
    Sep 10, 2008
    Messages:
    13
    Likes Received:
    0
    I appreciate the link. I now understand the difference between routes and trunks and where and when to use "|" and "+". The output in ssh shows an agi script being run which is automatically inputting the 1 when I dial. When i look at the script I'm not seeing the spot where it is doing it's thing. Here is the script from VI.

    !/usr/bin/php -q
    <?php
    /**
    // fixlocalprefix Copyright (C) 2005 Greg MacLellan (greg@mtechsolutions.ca)
    // Asterisk Management Portal Copyright (C) 2004 Coalescent Systems Inc. (info@coalescentsystems.ca)
    //
    //This program is free software; you can redistribute it and/or
    //modify it under the terms of the GNU General Public License
    //as published by the Free Software Foundation; either version 2
    //of the License, or (at your option) any later version.
    //
    //This program is distributed in the hope that it will be useful,
    //but WITHOUT ANY WARRANTY; without even the implied warranty of
    //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    //GNU General Public License for more details.

    /* --------WARNING---------
    *
    * This script is auto-copied from an included module and will get overwritten.
    * If you modify it, you must change it to write only, in the agi-bin directory,
    * to keep it from getting changed.


    This program takes a number, checks it against a list of patterns for a specific trunk, and modifies the number based
    on the rules for that number.

    Two variables are required:

    DIAL_NUMBER - the number to be dialed (this will be modified, if necessary)
    DIAL_TRUNK - the trunk number to use

    The list of prefixes is contained in $localprefix_file (defined below, defaults to /etc/asterisk/localprefixes.conf). This
    file has the format:

    [trunk-1]
    rule1=1613|NXXXXXX
    rule2=1519|555XXXX
    rule2=1519|54[0-9]XXXX

    [trunk-2]
    rule1=1613+NXXXXXX
    rule2=1519+12XXXXX


    The section read depends on the value of DIAL_TRUNK.

    A | means to drop the number before the |. In this example, if DIAL_NUMBER is "16135551234" and DIAL_TRUNK is "1",
    DIAL_NUMBER will become "5551234" (rule1). If DIAL_NUMBER is "15195551234", it will become "5551234" (rule2).
    "15195435555" will become "5435555" (rule3).

    A + means to prefix the beginning digits to the following pattern. In this example, if DIAL_NUMBER is 5551234, and
    DIAL_TRUNK is "2", DIAL_NUMBER will become "16135551234". If DIAL_NUMBER is "1235555", it will match rule2 and
    become "15191235555".
    "fixlocalprefix" 251L, 7716C
     
  4. wiseoldowl

    Joined:
    Aug 19, 2008
    Messages:
    251
    Likes Received:
    0
    Okay, I'm baffled as to why you are looking at a script that is part of the internals of FreePBX. Let me try to explain this to you as gently as I can. When you use Elastix, and by extension FreePBX, you don't muck around with scripts, config files, etc. (there are exceptions, for example, if you are an advanced user you can use the files with _custom in the name, but let's not go there for the moment). If you really want to muck with config files and dial plans, then you should probably not be using FreePBX or any distribution that contains FreePBX, or any similar GUI. Just install Asterisk alone (without a GUI), and then go in and write all your dial plans and config files by hand (there are actually people who actually do that, though I have no idea how).

    But if you want to use Elastix, or any distribution that contains FreePBX, you have to accept almost as a matter of faith that almost anything you need to do can be done from the FreePBX and/or Elastix GUI, and that if you think it can't, it's probably because you're not fully understanding the situation. Messing around with the FreePBX internals such as you are contemplating is almost guaranteed to break FreePBX, and/or your changes will be overwritten by FreePBX.

    So to address the problem you are having, did you try stripping the 1 in the trunk dial rules? By which I mean, did you put in a line like this:

    1|NXXNXXXXXX

    If you did that, it should strip the 1 before sending the call out. If it DOESN'T do that, then I fear you've already broken something in FreePBX by messing with their scripts. Your only recourse at that point may be a clean reinstall of Elastix.

    Now, you did not mention if you are doing anything out of the ordinary here - we can only go by what you tell us. If you are in any way bypassing parts of FreePBX then trunk rules may not be "seen" during call processing. But you wouldn't do something like that without mentioning it, would you?
     
  5. p2ii

    Joined:
    Sep 10, 2008
    Messages:
    13
    Likes Received:
    0
    No, I haven't done anything funny to the dialplan. Voicepulse has a setup module that you run from FreePBX that sets up the trunks and route automatically. I assumed(big mistake) that's all the setup was doing. Apparently it puts in some other "unseen" process. The changes I made while trying to get 1+dialing to work I have removed. I will contact them for clarification. Sorry for the confusion...I did not have all the info until this a.m.
     

Share This Page