Action depending on originating number?

Hello - a quick newbie question - I have checked around but some of the terminology is not clear (yet) to me so I will try here first.

I would like to call forward a call only if is comes from a certain number. I am guessing this is possible but if someone could please explain how.

Logic would be…

if originating number is XXX
then call forward to YYY
call ZZZ

thanks in advance

See for the ex-girlfriend logic feature, or use the CALLERID function explicitly with ExecIf of GotoIf.

1 Like

Thanks for the quick response. I have tried with the ‘ExecIf’ command using this syntax…

exten => s,n,ExecIf($["${CALLERID(num)}" = “${PRIVATE}”]|Dial(${DESK},m)

…which gives the error…

[Apr 27 11:08:35] WARNING[23042] app_exec.c: Could not find application! (Dial(0041227475909)

… so I appear to have all the arguments resolving correctly.

Can I use ‘Dial’ like this or am I missing something?


There are at least two syntax errors in that line, although I don’t know why they are producing the error message. Actually, I think I do, but it will be a new feature that is overloading the term application.

The error message also suggests that you have no technology part in the dialstring variable.

Ex-girlfriend logic is likely to be cleaner, in this case.

Ex Girlfriend logic is really easy to implement.

I use it to block unwanted calls to my extension.
exten => 7001/5203825968,1,Goto(RING) ; Specific Allow
exten => 7001/Anonymous,1,Goto(RING) ; Specific Allow
exten => 7001/_480NXXXXXX,1,Goto(RING); Pattern Match
exten => 7001/_520NXXXXXX,1,Goto(RING); Pattern Match
exten => 7001/_602NXXXXXX,1,Goto(RING); Pattern Match
exten => 7001/_623NXXXXXX,1,Goto(RING); Pattern Match
exten => 7001/_928NXXXXXX,1,Goto(RING); Pattern Match
exten => 7001,1,NoOP()
same => n,Ringing()
same => n,Wait(16)
same => n,Voicemail(${EXTEN}@kiniston,u)
same => n,Hangup()
same => n(RING),Gosub(sub-stdexten,${EXTEN},1(SIP/${EXTEN}kiniston))

Sorry gentlemen you lost me here - I don’t have much experience yet with the extentions.conf syntax yet. Could you please explain - what syntax error ( I seem to have the right arguments but the Dial function fails and the ‘flow’ of the ex-girlfriend commands lost me (RING?)
Thanks in advance

I just want to forward a call from one specific incoming number to another. All others should drop through to ‘normal’ processing.

There is no question mark in the line, as you’ve coded it, and the parenthesis don’t balance. There is also an operator that should not be there.

You don’t appear to have the basic knowledge of dialplans that will allow us to support you without getting into a free consultancy situation. You need to make sure that understand the sample dialplan, and

OK so for my ex-girlfriend logic:

If the number matches any of the specific caller ID’s (Anonymous,5203825968) or matches any of the patterns I have defined (the _480,_520,_602,_603,928) then it will do a GOTO with the target being the RING label.

The RING Label calls my sub-stdexten macro and dials my phone.

Callers that do not match any of the specific caller id’s or patterns fall through to the NoOP followed by my playing ringing sounds for 16 seconds and then go to voicemail.

Does that help?

David551 - you are absolutely correct about the basic knowledge - sadly I am in a pretty normal position in the computing industry where the person who set up the Asterisk system left the company a few years ago without documenting the setup. Changes are now needed and i have been given the task :frowning: - I am reading the documentation I can find furiously but turned to the ‘community’ for specific help - thank you again for your replies and links. Slowly advancing… :-).

I’m not trying to add fuel to the fire, but that a developer built a code for a company and do not added any documentation it is bad practice but it is a very commun situation, the unacceptable part, but that a company do not requested any documentation about the changes committed to their infrascture

In the other hand , assing tasks to a person without the required level of knowlege about the product to work, it could do more harm than good.

I think companies should hire an expert to do the job and the same time train some one of their staff,