How to add prefix to all incoming caller id?

Discussion in 'General' started by midiabyte, Jan 6, 2010.

  1. midiabyte

    Joined:
    Aug 31, 2009
    Messages:
    58
    Likes Received:
    0
    Hi i need to add a prefix 2200 in all incoming calls, on a specific trunk.

    I added the line

    I'm editing the file extensions_additional.conf
    However, don't have effect. I don't receive the caller id, with the added prefix.

    Thank's
     
  2. danardf

    Joined:
    Dec 3, 2007
    Messages:
    8,069
    Likes Received:
    12
    Hi.

    You mustn't use extension_addition.conf but extension_custom.conf because, Freepbx rewrite your config file!
     
  3. danardf

    Joined:
    Dec 3, 2007
    Messages:
    8,069
    Likes Received:
    12
    Look at this.

    It's an example to add a [0] front the phone number at the second line.

    Code:
    [custom-add-zero]
    exten => _[1-9]xxxxxxxx,1,Noop(add 00 from start of number)
    exten => _[1-9]xxxxxxxx,n,Goto(from-internal,00${EXTEN:1},1)
    exten => _xxxx,1,Goto(from-internal,${EXTEN},1)
    exten => h,1,Hangup()
    It's a way. ;)
     
  4. midiabyte

    Joined:
    Aug 31, 2009
    Messages:
    58
    Likes Received:
    0
    danardf

    I'm need this to use a multiple callbacks. (each one, return the call in different trunks).

    Example:
    With a pattern 2200X. to outbound by trunk 1, and rules 2200|x. to set dial via trunk 1;
    With a pattern 3300X. to outbound by trunk 2, and rules 3300|x. to set dial via trunk 2;, etc...

    When have incoming call via trunk [leivivono] set the caller id to 2200PhoneNumber and go to callback making a call via trunk X;
    When have incoming call via trunk [midiabyte] set the caller id to 3300PhoneNumber and go to callback making a call via trunk Y...

    i explained Clear to you my objective???

    Thank's and excuse my poor english!
     
  5. midiabyte

    Joined:
    Aug 31, 2009
    Messages:
    58
    Likes Received:
    0
    OK. And my code exten => _X!,1,Set(CALLERID(num)=2200${CALLERID(num)}) is correct?
     
  6. danardf

    Joined:
    Dec 3, 2007
    Messages:
    8,069
    Likes Received:
    12
    hmmm... I think that's a point, like that. _X.,1,....Etc, and not _X!,1,
     
  7. midiabyte

    Joined:
    Aug 31, 2009
    Messages:
    58
    Likes Received:
    0
    danardf my extensions_additional.conf file have:
    Please, confirm if only I need to add in extensions_custom.conf file, the code
    [leivivono] is a "context name" of this trunk.

    Excuse, because I don't have much expertise in edit the Elastix (asterisk) code.
     
  8. danardf

    Joined:
    Dec 3, 2007
    Messages:
    8,069
    Likes Received:
    12
    First, create your custom context into extension_cutom.conf, and next, put the new context name into your config trunk.
    for example:

    [My_trunk_1]
    exten => _x.,1....etc
    exten => ..

    Into the config trunk, replace context=from-trunk by context=My_trunk_1

    In my example, I add a zero for any number beginning by 1 to 9 with 9 digits, and don't add zero for any number with 4 digits. And that, for from-internal context. But you can use from-trunk, or another context.
     
  9. midiabyte

    Joined:
    Aug 31, 2009
    Messages:
    58
    Likes Received:
    0
    danardf

    I maked the alterations, but, don't have effect...

    my extensions_custom.con file, have this code:
    And I change in the Trunk configuration the context to: context=customleivi

    See:
    username=username
    fromuser=username
    domain=vono...
    fromdomain=vono...
    insecure=very
    qualify=yes
    port=5060
    nat=no
    type=peer
    secret=password
    host=vono...
    context=customleivi
    canreinvite=no
    dtmfmode=inband


    Now, i have a doubt.. the correct code for Set the caller id, is:
    Set(CALLERID(num)=2200${CALLERID(num)})
    or
    Set(CALLERID(number)=2200${CALLERIDNUM})

    I found these two forms in my research on the Internet

    Thank's;
     
  10. danardf

    Joined:
    Dec 3, 2007
    Messages:
    8,069
    Likes Received:
    12
    Hmmm, I don't think that you must use CALLERID(NUM) information. look at my example, it's EXTEN.

    I think that you can use something like that:
    Code:
    [customleivi]
    exten => _x.,1,Noop(Add 2200 from start of number)
    exten => _x.,n,Goto(from-trunk,2200${EXTEN:1},1)
    exten => h,1,Hangup()
    Try this.

    Now it's late for me. I will see that tomorrow, if you want. ;)
     
  11. danardf

    Joined:
    Dec 3, 2007
    Messages:
    8,069
    Likes Received:
    12
    Hoo. And remember that you must restart or reload asterisk after each modification!!!!
     
  12. midiabyte

    Joined:
    Aug 31, 2009
    Messages:
    58
    Likes Received:
    0
    Unfortunately it did not work ... Thank you trying to help.

    I'll wait to see if some other friend can guide me. I'll keep trying, because it is essential that this callback is working properly by tomorrow.

    Thank you!
     
  13. dicko

    Joined:
    Oct 24, 2008
    Messages:
    4,099
    Likes Received:
    0
    I claim to be a friend of Franck's

    In the Inbound route, does not setting the:

    CID name prefix:

    You can optionally prefix the Caller ID name. ie: If you prefix with "Sales:", a call from John Doe would display as "Sales:John Doe" on the extensions that ring.

    to "2222" work for you?

    (Restricting outbound calls to certain trunks by extension is covered several times elsewhere here)
     
  14. danardf

    Joined:
    Dec 3, 2007
    Messages:
    8,069
    Likes Received:
    12
    Another way.... try to look the asterisk trace.

    Connect you to asterisk CLI mode:
    # asterisk -rvvvvvvvvvvvvvvv
    CLI>

    Make your incoming call and look at the variable an your comment into Noop within your custom extension. Maybe you could see what information that may be changed.
    With Noop you can put ${EXTEN} and look the content.
    So, you can play with this by add some line with Noop.
    Noop it's as a comment.

    Ok
    Bye.
     
  15. danardf

    Joined:
    Dec 3, 2007
    Messages:
    8,069
    Likes Received:
    12
    Ha dicko..

    I'm happy to see you here now.
    Now you can replace me to help midiabyte.
    now I can go to sleep. :laugh:
     
  16. dicko

    Joined:
    Oct 24, 2008
    Messages:
    4,099
    Likes Received:
    0
    Bonne annee, bonne nuit et dormez bien.
     
  17. midiabyte

    Joined:
    Aug 31, 2009
    Messages:
    58
    Likes Received:
    0
    Dicko, CID name don't help me. Because i need the imediate Callback.

    It's necessary the return of a call using the prefixes added to the phone number, for use the correct outbound route

    I see informations on WEB, "confirming" the use of command as below:
    [from-pstn-custom]
    exten => _X!,1,Set(CALLERID(num)=0${CALLERID(num)})
    with success. Lies? ;-))
     
  18. dicko

    Joined:
    Oct 24, 2008
    Messages:
    4,099
    Likes Received:
    0
    As danradf said its probably better as

    exten => _X.,1,Set(CALLERID(num)=0${CALLERID(num)})
    exten => _X.,n,noop(CALLERIDNUM${callerid(num)}) ; for debugging at the CLI


    reason,

    http://www.voip-info.org/wiki/index.php ... n+Patterns

    particularly:

    Note: The exclamation mark wildcard, which is available only in Asterisk 1.2 and later, behaves specially
     
  19. midiabyte

    Joined:
    Aug 31, 2009
    Messages:
    58
    Likes Received:
    0
    Dicko, thankyou for your attention!

    I got some progress and now I can add the prefix on incoming calls. However, it is being added to all calls and not only those that are the incoming trunk leivivono

    My code is as follows:

    Setting the file extensions_custom.conf the following context

    In extensions.conf, I added to the context from-trunk, to include the setcid

    Now, all calls come with the prefix 2200 in front, but I need only be added that prefix the calls that come in the trunk (DID) [leivivono]

    Thank's
     
  20. midiabyte

    Joined:
    Aug 31, 2009
    Messages:
    58
    Likes Received:
    0
    Dicko, although I have no experience with the programming language of the asterisk, I was thinking... we could be any positive results using a code like this:


    That is:

    While I make sure that the code above is wrong, the intention is to say, "Go only if the DID is = leivivono.

    What do you think? Got any ideas?

    Thank's
     

Share This Page