Uploaded image for project: 'FreePBX'
  1. FreePBX
  2. FREEPBX-6139

Queue Prefix in CallerID for Internal Calls?



    • ToDo:


      FreePBX Distro 1.818.210.58 x64
      Plugins: FOP2, CID Superfecta

      Hey folks,
      Ran into an interesting problem this week
      - we often call our internal queues directly in order to get a hold of anyone in a department who is available rather than bugging one specific person. To do this, we dial the queue number directly (i.e. Accounting at 711). The problem with this is that the CallerID shows up on their phone as just the ID of the phone (i.e. "295-Gord") instead of with the Queue's prefix (i.e. Acc
      - 295-Gord). This of course puts some of the managers into a tizzy because they don't know whether a person is calling them directly or if they can let their staff answer.

      Spent some time digging with our resident developer and we located the source of the changes to be in /etc/asterisk/extensions_additional.conf in the user-callerid macro at line 4565. When we comment out lines 7-12 in the Macro, things start to act as we desire. Like so:


      include => macro-user-callerid-custom
      exten => s,1,Set(AMPUSER=${IF($["foo${AMPUSER}" = "foo"]?${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,Set(AMPUSERCIDNAME=${DB(AMPUSER/${AMPUSER}/cidname)})
      ;exten => s,n,GotoIf($["x${AMPUSERCIDNAME:1:2}" = "x"]?report)
      ;exten => s,n,Set(AMPUSERCID=${IF($["${DB_EXISTS(AMPUSER/${AMPUSER}/cidnum)}" = "1"]?${DB_RESULT}:${AMPUSER})})
      ;exten => s,n,Set(CALLERID(all)="${AMPUSERCIDNAME}" <${AMPUSERCID}>)
      ;exten => s,n,GotoIf($["${ARG1}"="LIMIT" & ${LEN(${AMPUSER})} & "${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}))
      ;exten => s,n,ExecIf($["${DB(AMPUSER/${AMPUSER}/language)}" != ""]?Set(CHANNEL(language)=${DB(AMPUSER/${AMPUSER}/language)}))
      ;exten => s,n,GosubIf($[${LEN(${DB(AMPUSER/${AMPUSER}/ccss/cc_agent_policy)})} & "${DB(AMPUSER/${AMPUSER}/ccss/cc_agent_policy)}" != "never"]?sub-ccss,s,1(${MACRO_CONTEXT},${CALLERID(dnid)}))
      exten => s,n(report),GotoIf($[ "${ARG1}" = "SKIPTTL" | "${ARG1}" = "LIMIT" ]?continue)
      exten => s,n(report2),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,Playback(im-sorry&an-error-has-occured&with&call-forwarding)
      exten => s,n,Macro(hangupcall,)
      exten => s,n(limit),Answer
      exten => s,n,Wait(1)
      exten => s,n,Playback(beep&im-sorry&your&simul-call-limit-reached&goodbye)
      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,Set(CHANNEL(language)=${MASTER_CHANNEL(CHANNEL(language))})

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

      ;-== end of [macro-user-callerid] ==-;{noformat}

      We also found that this is generated through a PHP script at /var/www/html/admin/modules/core/functions.inc.php beginning at line 2753, where we commented lines 2769-2774 to make the changes persistent in the system (i.e. when we reload the configuration in the GUI the change stays). Like so:


      // user may masquerade as a different user internally, so set the internal cid as indicated
      // but keep the REALCALLERID which is used to determine their true identify and lookup info
      // during outbound calls.
      // $ext->add($context, $exten, '', new ext_set('AMPUSERCID', '${IF($["${DB_EXISTS(AMPUSER/${$
      // $ext->add($context, $exten, '', new ext_set('CALLERID(all)', '"${AMPUSERCIDNAME}" <${AMPU$

      // $ext->add($context, $exten, '', new ext_noop_trace('Current Concurrency Count for ${AMPUS$
      // $ext->add($context, $exten, '', new ext_gotoif('$["${ARG1}"="LIMIT" & ${LEN(${AMPUSER})} $
      // $ext->add($context, $exten, '', new ext_execif('$["${ARG1}"="LIMIT" & ${LEN(${AMPUSER})}]$

      So my request / question is there. Is there a spot in the GUI that I'm missing that will allow this functionality (showing the queue prefix for internal calls) or would it be possible to have this functionality (a simple switch) added in order that we wouldn't have to manually patch the system every time we update?

        Gliffy Diagrams




              • Assignee:
                GordSpence GordSpence
              • Votes:
                0 Vote for this issue
                0 Start watching this issue


                • Created:


                  Error rendering 'slack.nextup.jira:nextup-jira-plus-status'. Please contact your Jira administrators.