How to add prefix to all incoming caller id?

midiabyte

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

I added the line
exten => _X!,1,Set(CALLERID(num)=2200${CALLERID(num)})

I'm editing the file extensions_additional.conf
[from-trunk-sip-leivivono]
include => from-trunk-sip-leivivono-custom
exten => _X!,1,Set(CALLERID(num)=2200${CALLERID(num)})
exten => _.,2,Set(GROUP()=OUT_25)
exten => _.,n,Goto(from-trunk,${EXTEN},1)
However, don't have effect. I don't receive the caller id, with the added prefix.

Thank's
 

danardf

Joined
Dec 3, 2007
Messages
8,069
Likes
10
Points
88
#2
Hi.

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

danardf

Joined
Dec 3, 2007
Messages
8,069
Likes
10
Points
88
#3
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. ;)
 

midiabyte

Joined
Aug 31, 2009
Messages
58
Likes
0
Points
0
#4
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!
 

midiabyte

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

danardf

Joined
Dec 3, 2007
Messages
8,069
Likes
10
Points
88
#6
hmmm... I think that's a point, like that. _X.,1,....Etc, and not _X!,1,
 

midiabyte

Joined
Aug 31, 2009
Messages
58
Likes
0
Points
0
#7
danardf my extensions_additional.conf file have:
[from-trunk-sip-leivivono]
include => from-trunk-sip-leivivono-custom
exten => _.,1,Set(GROUP()=OUT_25)
exten => _.,n,Goto(from-trunk,${EXTEN},1)
Please, confirm if only I need to add in extensions_custom.conf file, the code
[leivivono]
exten => _X!,2,Set(CALLERID(num)=2200${CALLERID(num)})
[leivivono] is a "context name" of this trunk.

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

danardf

Joined
Dec 3, 2007
Messages
8,069
Likes
10
Points
88
#8
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.
 

midiabyte

Joined
Aug 31, 2009
Messages
58
Likes
0
Points
0
#9
danardf

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

my extensions_custom.con file, have this code:
[customleivi]
exten => _X.,1,Set(CALLERID(num)=2200${CALLERID(num)})
exten => _.,n,Set(GROUP()=OUT_25)
exten => _.,n,Goto(from-trunk,${EXTEN},1)
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;
 

danardf

Joined
Dec 3, 2007
Messages
8,069
Likes
10
Points
88
#10
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. ;)
 

danardf

Joined
Dec 3, 2007
Messages
8,069
Likes
10
Points
88
#11
Hoo. And remember that you must restart or reload asterisk after each modification!!!!
 

midiabyte

Joined
Aug 31, 2009
Messages
58
Likes
0
Points
0
#12
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!
 

dicko

Joined
Oct 24, 2008
Messages
4,099
Likes
0
Points
0
#13
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)
 

danardf

Joined
Dec 3, 2007
Messages
8,069
Likes
10
Points
88
#14
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.
 

danardf

Joined
Dec 3, 2007
Messages
8,069
Likes
10
Points
88
#15
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:
 

dicko

Joined
Oct 24, 2008
Messages
4,099
Likes
0
Points
0
#16
Bonne annee, bonne nuit et dormez bien.
 

midiabyte

Joined
Aug 31, 2009
Messages
58
Likes
0
Points
0
#17
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? ;-))
 

dicko

Joined
Oct 24, 2008
Messages
4,099
Likes
0
Points
0
#18
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
 

midiabyte

Joined
Aug 31, 2009
Messages
58
Likes
0
Points
0
#19
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

[setcid]
exten => _., 1, Set (CALLERID (num) = 2200 $ (CALLERID (num)))
exten => _., n, Set (CALLERID (number) = $ (CALLERID (num)))
exten => _., n, Goto (ext-did, $ (EXTEN), 1)
In extensions.conf, I added to the context from-trunk, to include the setcid

[from-trunk]; just an alias since VoIP should not be called PSTN
include => setcid; include the context setcid
include => from-pstn
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
 

midiabyte

Joined
Aug 31, 2009
Messages
58
Likes
0
Points
0
#20
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:


[setcid]
exten => _., 1, Set (CALLERID (num) = $ 2200 (CALLERID (num)))
exten => _., n, Set (CALLERID (number) = $ (CALLERID (num)))
exten => _., n, GotoIf ($ [DID = leivivono (ext-did, $ (EXTEN), 1)])
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
 

Members online

Latest posts

Forum statistics

Threads
30,915
Messages
130,920
Members
17,594
Latest member
knethardsolutions
Top