* You are viewing Posts Tagged ‘callerid’

If Would Possible Use A Custom Function In Asterisk Dialplan


If would be possible to use a “function concept” in side of Asterisk DialPlan

For example:

I have following logic in my dial plan remove country code a add an “0” before the rest of the numbers

exten => _X.,1, NoOp( call ID ${CALLERID(num)} exten: ${EXTEN}))
; remove my country code exten => _X.,n, GotoIf($["${CALLERID(num):0:4}"="${country-code}"]?international-format:national-format)
exten => _X.,n(international-format), Set(CALLERID(num)=0${CALLERID(num):4})
exten => _X.,n(national-format), NoOp(call ID: ${CALLERID(num)} exten: ${EXTEN}))

Do you think if would be possible that I could write a function something like “REMOVEMYCOUNTRYCODE(${NUM})” with a return value of a number with out country code and with an “0” add in front of the rest of the numbers.


exten => _X.,1, NoOp( call ID ${CALLERID(num)} exten: ${EXTEN}))
; remove my county code exten => _X.n, Set(CALLERID(num=REMOVEMYCOUNTRYCODE(${CALLERID(num)} ));

then I have to define this function in someway

TON Always Unknown In RDNIS (outgoing Calls)


first of all, this is my first time asking for advice on this mailing list, so I apologize and thank in advance for your help. Also, besides having access to rather advanced equipment, maybe some of the terms I will use will be incorrect or ambiguous. I hope to be able to clarify any doubt you should have about it.

I am currently in the process of upgrading a SIP/TDM gateway from Asterisk
1.4.23 to 1.8.17. The gateway is designed to terminate SIP calls via TDM
through a switching equipment. Among the features for this gateway there is handling for redirected calls, i.e. populating the outgoing RDNIS with information from custom SIP headers.

In the past, (Asterisk 1.4.23, DAHDI 2.6.1, libPRI 1.4.12) this was accomplished by setting CALLERID(RDNIS) and PRIREDIRECTREASON in the dialplan. Tracing on the switching equipment, I noticed that the REDIRECTING party had:
– TON as set in DAHDI’s prilocaldialplan
– Presentation indicator always “allowed”
– Reason as set in PRIREDIRECTREASON
– Redirecting Party Number as set in CALLERID(RDNIS)

In the new setup (Asterisk 1.8.17, DAHDI 2.6.1, libPRI 1.4.12) I am instead using:
– REDIRECTING(from-num) to set the redirecting party number
– REDIRECTING(from-num-plan) to set the NPI (to numeric value 1 – ISDN),
because by default it was set to 0 – unknown
– REDIRECTING(from-num-pres) to set the Presentation Indicator
– REDIRECTING(reason) to set the redirecting reason

Everything seems fine, and using the new REDIRECTING function I have also gained control on the Presentation Indicator (which was previously fixed), but the RDNIS seems always to have TON unknown (instead of what specified in prilocaldialplan – international). Is there a specific way to manually set the TON as I did with the NPI, or is there some known issue with this mechanism?

Thanks again in advance for your help.


Digium D40 Phones And Caller ID

First post to this mailing list. I’ll keep it brief: My D40 phones don’t show the “name” component of CALLERID. It only displays the number. This includes calls originating from PSTN
with their own CID already set, and calls where we’ve specifically filled in this data. Changing the destination of my test extension to a softphone (zoiper in this case) correctly displays the information. sip.conf already contains sendrpid=pai.

From what I can tell, this appears to be a Digium phone limitation. Or am I missing something crucial?

Regarding Caller ID And Security

Hi all,

I am new to Asterisk, and would like to begin by saying that it is an absolutely fantastic system. Seems incredibly stable, well tested, and easy to use.

Now, to my question. I am making a mix between a personal ads and a voicemail service, where I want each user to be able to submit an ad that others can respond to by recording messages that go into this users inbox. My original thought was to base this purely on the CALLERID(num) value, but quickly discovered that this is a bit unreliable. Sometimes when I would call in it’d say anonymous, other times it would give me a bunch of zero’s, other times it would show me my real phone number, and once it actually gave me just random digits. I do have a wait call after answering but before my first soundf ile is triggered, in my pickup context. I am wondering what the best way to approach this is? Do I ask the user to enter their phone number, and then generate a code based upon this that will then serve as a password when you call back? Do I attempt to use CALLERID(num) to detect returning users, or is this not adviseable from a security perspective?

Preferably, I would like to avoid using a code altogether but I am told that it is relatively easy to spoof phone numbers to hack into someone else’s inbox. Note that I do not plan to allow direct SIP calls, only through a PSTN/SIP provider where the IP address is on a whitelist. Any tips on how to approach this would be highly appreciated. Basically I want to make it as easy as possible for my users, but maintain high security.

Thanks in advance for any help, and thanks once again to the developers of Asterisk for making such an excellent tool!

Kind regards,

Philip Bennefall

P.S. I also wanted to know whether there is a function to check if a string contains only digits? This would be useful as a sanity check before I look up the phone number in the MySql database, if I do decide to use CALLERID(num) in this way.

Flowroute: Howto Set Outbound Callerid (ast 1.4)?

The flowroute website mentions that they set callerid on outbound calls based on the presence of (in order of preference):
“P-Asserted-Identity”, “Remote-Party-ID” or “From:”.

I’ve been trying to make outbound callerid work via flowroute to no avail. Does anyone have an extensions.conf / sip.conf snippet howto make this work? This is for Asterisk 1.4.44.

Strange behavior – Can’t figure out


I have two asterisk boxes, one with asterisk and the other
with asterisk

Sip show settings of both boxes have no difference and also the peers

I am generating a call using call file with following details:
Channel: SIP/1028
Account: 9164421122 < -- this is the accountcode of 1028
MaxRetries: 1
RetryTime: 60
WaitTime: 30
Context: default
Extension: 1031
Priority: 1
CallerID: “Zohair Raza”<1031> < -- I want to see this caller id at
dialing peer (1028) and “Test” <1028> (originiating caller id) at
dialed peer

On asterisk I get results as expected and debug output is as below