Extension unable to call other extension


I am having an issue where when one of my phones calls a specific extension it is always forwarded to voicemail. I checked the call event logging and saw that it’s getting an s-CHANUNAVAIL message. I will reply with the asterisks log.

All help is apprieciated.


Ext. 210 calling 219.

In processing the caller ID “Reception” <210> there is a syntax error in line 13 of [macro-user-callerid] (see log lines 16-18) that I believe causes a blank or null caller ID to be set.

It appears that extension 219 is set (in the phone, not in FreePBX) to reject anonymous calls, resulting in the error on line 212. A temporary workaround may be for 219 to allow such calls.

If possible, see whether updating FreePBX Framework or Core helps.

On my test system, lines of the macro starting with the last ok line 12 are

exten => s,n,Set(CALLERID(all)="${AMPUSERCIDNAME}" <${AMPUSERCID}>)
exten => s,n,ExecIf($["${DB(DEVICE/${ARG2}/tech)}"="custom"]?Set(CALLERID(all)=${IF($[${LEN(${DB(AMPUSER/${ARG2}/outboundcid)})}]?${DB(AMPUSER/${ARG2}/outboundcid)}:${ARG2})}))
exten => s,n,GotoIf($["${ARG1}"="LIMIT" & ${LEN(${AMPUSER})} & ${DB_EXISTS(AMPUSER/${AMPUSER}/concurrency_limit)} & ${DB(AMPUSER/${AMPUSER}/concurrency_limit)}>0 & ${GROUP_COUNT(${AMPUSER}@concurrency_limit)}>=${DB(AMPUSER/${AMPUSER}/concurrency_limit)}]?limit)
exten => s,n,ExecIf($["${ARG1}"="LIMIT" & ${LEN(${AMPUSER})}]?Set(GROUP(concurrency_limit)=${AMPUSER}))

but our macros are different on the two systems. I’ve got Framework and core
Try to spot an error on line 13, or post the contents of the macro.

Thank you for the feedback, I will look in to the blocking of anonymous calls. I am new to Free PBX, how would I look at the contents of the macro?

Look at the file /etc/asterisk/extensions_additional.conf
Search for
and post the text from there through the line
;–== end of [macro-user-callerid] ==–;

Also post module version numbers.

The line that is triggering the error looks clean to me. What version of Asterisk is this?

You may be referring to the fragment of the macro posted from my test system.
AFAIK, one can’t tell from the OPs log the literal content of the macro code.

1 Like

I am running FreePBX 14.0.11 and below is the macro

include => macro-user-callerid-custom
exten => lang-playback,1,GosubIf($[${DIALPLAN_EXISTS(macro-user-callerid,${CHANNEL(language)})}]?macro-user-callerid,${CHANNEL(language)},${ARG1}():macro-user-callerid,en,${ARG1}())
exten => lang-playback,n,Return()

exten => s,1,Set(TOUCH_MONITOR=${UNIQUEID})
exten => s,n,Set(AMPUSER=${IF($["${AMPUSER}" = “”]?${CALLERID(number)}:${AMPUSER})})
exten => s,n,GotoIf($["${CUT(CHANNEL,@,2):5:5}"=“queue” | ${LEN(${AMPUSERCIDNAME})}]?report)
exten => s,n,ExecIf($["${REALCALLERIDNUM:1:2}" = “”]?Set(REALCALLERIDNUM=${CALLERID(number)}))
exten => s,n,Set(AMPUSER=${DB(DEVICE/${REALCALLERIDNUM}/user)})
exten => s,n,GotoIf($["${AMPUSER}" = “none”]?limit)
exten => s,n,Set(AMPUSERCIDNAME=${DB(AMPUSER/${AMPUSER}/cidname)})
exten => s,n,ExecIf($["${ARG2}" != “EXTERNAL” & ${DB_EXISTS(AMPUSER/${AMPUSER}/cidnum)} & “${AMPUSER}” != “${DB(AMPUSER/${AMPUSER}/cidnum)}”]?Set(__CIDMASQUERADING=TRUE))
exten => s,n,GotoIf($["${AMPUSERCIDNAME:1:2}" = “”]?report)
exten => s,n,Set(AMPUSERCID=${IF($["${ARG2}" != “EXTERNAL” & “${DB_EXISTS(AMPUSER/${AMPUSER}/cidnum)}” = “1”]?${DB_RESULT}:${AMPUSER})})
exten => s,n,Set(__DIAL_OPTIONS=${IF($["${DB_EXISTS(AMPUSER/${AMPUSER}/dialopts)}" = “1”]?${DB_RESULT}:${DIAL_OPTIONS})})
exten => s,n,Set(CALLERID(all)="${AMPUSERCIDNAME}" <${AMPUSERCID}>)
exten => s,n,GotoIf($["${ARG1}"=“LIMIT” & ${LEN(${AMPUSER})} & ${DB_EXISTS(AMPUSER/${AMPUSER}/concurrency_limit)} & ${DB(AMPUSER/${AMPUSER}/concurrency_limit)}>0 & ${GROUP_COUNT(${AMPUSER}@concurrency_limit)}>=${DB(AMPUSER/${AMPUSER}/co$
exten => s,n,ExecIf($["${ARG1}"=“LIMIT” & ${LEN(${AMPUSER})}]?Set(GROUP(concurrency_limit)=${AMPUSER}))
exten => s,n,ExecIf($["${DB(AMPUSER/${AMPUSER}/language)}" != “”]?Set(CHANNEL(language)=${DB(AMPUSER/${AMPUSER}/language)}))
exten => s,n(report),Noop(Macro Depth is ${MACRO_DEPTH})
exten => s,n,GotoIf($["${MACRO_DEPTH}" = “” | ${MACRO_DEPTH} < 6 ]?report2:macroerror)
exten => s,n(report2),GotoIf($[ “${ARG1}” = “SKIPTTL” | “${ARG1}” = “LIMIT” ]?continue)
exten => s,n,ExecIf($["${CALLEE_ACCOUNCODE}" = “”]?Set(__CALLEE_ACCOUNCODE=${DB(AMPUSER/${IF($["${MACRO_CONTEXT}"=“macro-exten-vm”]?${ARG2}:${MACRO_EXTEN})}/accountcode)}))
exten => s,n(report3),Set(__TTL=${IF($[“foo${TTL}” = “foo”]?64:$[ ${TTL} - 1 ])})
exten => s,n,GotoIf($[ ${TTL} > 0 ]?continue)
exten => s,n,Wait(${RINGTIMER})
exten => s,n,Answer
exten => s,n,Wait(1)
exten => s,n,Gosub(macro-user-callerid,lang-playback,1(hook_0))
exten => s,n,Macro(hangupcall,)
exten => s,n(macroerror),Noop(Macro Limit Reached. Aborting Call)
exten => s,n,Answer
exten => s,n,Wait(1)
exten => s,n,Gosub(macro-user-callerid,lang-playback,1(hook_2))
exten => s,n,Macro(hangupcall,)
exten => s,n(limit),Answer
exten => s,n,Wait(1)
exten => s,n,Gosub(macro-user-callerid,lang-playback,1(hook_1))
exten => s,n,Macro(hangupcall,)
exten => s,n,Congestion(20)
exten => s,n(continue),Set(CALLERID(number)=${CALLERID(number):0:40})
exten => s,n,Set(CALLERID(name)=${CALLERID(name):0:40})
exten => s,n,GotoIf($["${CALLERID(name)}" = “”]?cnum)
exten => s,n,Set(CDR(cnam)=${CALLERID(name)})
exten => s,n(cnum),Set(CDR(cnum)=${CALLERID(num)})
exten => s,n,Set(CHANNEL(language)=${MASTER_CHANNEL(CHANNEL(language))})

exten => h,1,Macro(hangupcall,)

exten => en,1(hook_0),Playback(im-sorry&an-error-has-occurred&with&call-forwarding)
exten => en,n,Return()
exten => en,n(hook_1),Playback(beep&im-sorry&your&simul-call-limit-reached&goodbye)
exten => en,n,Return()
exten => en,n(hook_2),Playback(im-sorry&an-error-has-occurred)
exten => en,n,Return()

exten => ja,1(hook_0),Playback(im-sorry&call-forwarding&jp-no&an-error-has-occured)
exten => ja,n,Return()
exten => ja,n(hook_1),Playback(beep&im-sorry&simul-call-limit-reached)
exten => ja,n,Return()
exten => ja,n(hook_2),Playback(im-sorry&an-error-has-occured)
exten => ja,n,Return()

;–== end of [macro-user-callerid] ==–;

Above line got garbled by the forum. Please paste the macro (being sure that no lines are cut off) at pastebin.freepbx.org and post the link here.

here you are


Something is still wrong with what you pasted, or the .conf file really is corrupted. The GotoIf statement should end with a ) but the last character is $

The $ is sometimes used to indicate that the line was cut off, so perhaps your editor or other processing between file and paste garbled it.

Are any module updates available that look relevant?

Unfortunately, I need to get to bed (it’s 02:50 here) but will try to answer tomorrow.

I’ll try and get another copy and no there aren’t any module updates. And no worries thanks for your help.

@Stewart1 here I think this is better


So I don’t know if this is relevant and I won’t be able to test until tomorrow but my FreePBX Framework just updated from 14.0.11 to

So here is the CallerID of the Caller being set.

[2019-06-19 09:03:01] VERBOSE[87917][C-00000609] pbx.c: Executing [[email protected]:12] Set("SIP/210-00000c2d", "CALLERID(all)="Reception" <210>") in new stack
[2019-06-19 09:03:01] VERBOSE[87917][C-00000609] pbx.c: Executing [[email protected]:37] Set("SIP/210-00000c2d", "CALLERID(number)=210") in new stack
[2019-06-19 09:03:01] VERBOSE[87917][C-00000609] pbx.c: Executing [[email protected]:38] Set("SIP/210-00000c2d", "CALLERID(name)=Reception") in new stack

Here it is being set for the CDR

[2019-06-19 09:03:01] VERBOSE[87917][C-00000609] pbx.c: Executing [[email protected]:40] Set("SIP/210-00000c2d", "CDR(cnam)=Reception") in new stack
[2019-06-19 09:03:01] VERBOSE[87917][C-00000609] pbx.c: Executing [[email protected]:41] Set("SIP/210-00000c2d", "CDR(cnum)=210") in new stack

The error that is being triggered is setting the concurrency limit so that doesn’t impact CallerID. So now if the phone is rejecting the call that could be due to it looking in the wrong source for the CallerID or something else.

As I have said in the past, the full log is great for looking at how Asterisk processed the call but you need actual SIP traces to look at things like rejections, SDP issues and such because those have all the vital pieces of information.

@kslaw You need to make another test call. No verbosity just the Chan_SIP debug which means you do the following:

  1. asterisk -r
  2. sip set debug on
    3 make the call
    4 show us the output.

Okay I was able to fix this issue this morning. I deleted the user and extension from freePBX, then I reset the phone to factory default and rebuilt everything from scratch. still don;t know what the original cause was but if the issue happens again within 7 days I’ll report back.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.