Ticket #2763 (closed Bugs: fixed)

Opened 1 year ago

Last modified 1 year ago

Route CID Name Prefix becomes missing for anonymous calls.

Reported by: rogerluo Assigned to: p_lindheimer
Priority: minor Milestone: 2.5
Component: Core - Trunks/Routing Version: 2.4.0
Keywords: CID prefix Cc:
Confirmation: Need testing SVN Revision (if applicable):
Backend Engine: All Backend Engine Version:

Description

In a route, the specified CID Name Prefix becomes missing for anonymous calls.

Attachments

trace.txt (6.0 kB) - added by KriS83 on 04/17/08 09:24:23.
calltrace

Change History

04/17/08 09:22:45 changed by KriS83

I'm having the same issue. CID name Prefix is lost when receiving calls from anonymous. I'm also using FreePBX 2.4.0.0

Here is a call trace:

--- snip --- -- Accepting voice call from to '65062012' on channel 0/1, span 1 -- Executing [65062012@from-pstn:1] Set("Zap/1-1", "FROM_DID=65062012") in new stack -- Executing [65062012@from-pstn:2] GotoIf?("Zap/1-1", "1 ?cidok") in new stack -- Goto (from-pstn,65062012,4) -- Executing [65062012@from-pstn:4] NoOp?("Zap/1-1", "CallerID is "CID withheld" <>") in new stack -- Executing [65062012@from-pstn:5] Set("Zap/1-1", "_RGPREFIX=LL: ") in new stack -- Executing [65062012@from-pstn:6] Set("Zap/1-1", "CALLERID(name)=LL: CID withheld") in new stack -- Executing [65062012@from-pstn:7] Goto("Zap/1-1", "from-did-direct|4412|1") in new stack -- Goto (from-did-direct,4412,1) -- Executing [4412@from-did-direct:1] Macro("Zap/1-1", "exten-vm|novm|4412") in new stack -- Executing [s@macro-exten-vm:1] Macro("Zap/1-1", "user-callerid") in new stack -- Executing [s@macro-user-callerid:1] NoOp?("Zap/1-1", "user-callerid: LL: CID withheld ") in new stack -- Executing [s@macro-user-callerid:2] Set("Zap/1-1", "AMPUSER=") in new stack -- Executing [s@macro-user-callerid:3] GotoIf?("Zap/1-1", "0?report") in new stack -- Executing [s@macro-user-callerid:4] ExecIf?("Zap/1-1", "1|Set|REALCALLERIDNUM=") in new stack -- Executing [s@macro-user-callerid:5] NoOp?("Zap/1-1", "REALCALLERIDNUM is ") in new stack -- Executing [s@macro-user-callerid:6] Set("Zap/1-1", "AMPUSER=") in new stack -- Executing [s@macro-user-callerid:7] Set("Zap/1-1", "AMPUSERCIDNAME=") in new stack -- Executing [s@macro-user-callerid:8] GotoIf?("Zap/1-1", "1?report") in new stack -- Goto (macro-user-callerid,s,13) -- Executing [s@macro-user-callerid:13] NoOp?("Zap/1-1", "TTL: ARG1: novm") in new stack -- Executing [s@macro-user-callerid:14] GotoIf?("Zap/1-1", "0?continue") in new stack -- Executing [s@macro-user-callerid:15] Set("Zap/1-1", "TTL=64") in new stack -- Executing [s@macro-user-callerid:16] GotoIf?("Zap/1-1", "1?continue") in new stack -- Goto (macro-user-callerid,s,23) -- Executing [s@macro-user-callerid:23] NoOp?("Zap/1-1", "Using CallerID "LL: CID withheld" <>") in new stack -- Executing [s@macro-exten-vm:2] Set("Zap/1-1", "FROMCONTEXT=exten-vm") in new stack -- Executing [s@macro-exten-vm:3] Set("Zap/1-1", "VMBOX=novm") in new stack -- Executing [s@macro-exten-vm:4] Set("Zap/1-1", "EXTTOCALL=4412") in new stack -- Executing [s@macro-exten-vm:5] Set("Zap/1-1", "CFUEXT=") in new stack -- Executing [s@macro-exten-vm:6] Set("Zap/1-1", "CFBEXT=") in new stack -- Executing [s@macro-exten-vm:7] Set("Zap/1-1", "RT=""") in new stack -- Executing [s@macro-exten-vm:8] Macro("Zap/1-1", "record-enable|4412|IN") in new stack -- Executing [s@macro-record-enable:1] GotoIf?("Zap/1-1", "0?2:4") in new stack -- Goto (macro-record-enable,s,4) -- Executing [s@macro-record-enable:4] AGI("Zap/1-1", "recordingcheck|20080417-171538|asterisk-1208445338.2") in new stack -- Launched AGI Script /var/lib/asterisk/agi-bin/recordingcheck -- AGI Script recordingcheck completed, returning 0 -- Executing [s@macro-record-enable:5] NoOp?("Zap/1-1", "No recording needed") in new stack

-- Executing [s@macro-exten-vm:9] Macro("Zap/1-1", "dialtr|4412") in new stack -- Executing [s@macro-dial:1] GotoIf?("Zap/1-1", "1?dial") in new stack -- Goto (macro-dial,s,3) -- Executing [s@macro-dial:3] AGI("Zap/1-1", "dialparties.agi") in new stack -- Launched AGI Script /var/lib/asterisk/agi-bin/dialparties.agi dialparties.agi: Starting New Dialparties.agi == Parsing '/etc/asterisk/manager.conf': Found == Parsing '/etc/asterisk/manager_additional.conf': Found == Parsing '/etc/asterisk/manager_custom.conf': Found == Manager 'admin' logged on from 127.0.0.1 dialparties.agi: Caller ID name is 'LL: CID withheld' number is 'unknown' dialparties.agi: USE_CONFIRMATION: 'FALSE' dialparties.agi: RINGGROUP_INDEX: dialparties.agi: Methodology of ring is 'none' -- dialparties.agi: Added extension 4412 to extension map -- dialparties.agi: Extension 4412 cf is disabled -- dialparties.agi: Extension 4412 do not disturb is disabled

dialparties.agi: extnum 4412 has: cw: 1; hascfb: 0 [] hascfu: 0 [] dialparties.agi: ExtensionState?: 0

-- dialparties.agi: DbDel? CALLTRACE/4412 - Caller ID is not defined -- dialparties.agi: Filtered ARG3: 4412 == Manager 'admin' logged off from 127.0.0.1 -- AGI Script dialparties.agi completed, returning 0

-- Executing [s@macro-dial:7] Dial("Zap/1-1", "SIP/4412tr") in new stack Extension Changed 4412 new state Ringing for Notify User 4411 -- Called 4412 -- SIP/4412-087449b8 is ringing == Parsing '/etc/asterisk/manager.conf': Found == Parsing '/etc/asterisk/manager_additional.conf': Found == Parsing '/etc/asterisk/manager_custom.conf': Found == Manager 'admin' logged on from 127.0.0.1 == Manager 'admin' logged off from 127.0.0.1 -- Channel 0/1, span 1 got hangup request, cause 16 Extension Changed 4412 new state Idle for Notify User 4411 == Spawn extension (macro-dial, s, 7) exited non-zero on 'Zap/1-1' in macro 'dial' == Spawn extension (macro-dial, s, 7) exited non-zero on 'Zap/1-1' in macro 'exten-vm' == Spawn extension (macro-dial, s, 7) exited non-zero on 'Zap/1-1' -- Executing [h@macro-dial:1] Macro("Zap/1-1", "hangupcall") in new stack -- Executing [s@macro-hangupcall:1] ResetCDR("Zap/1-1", "w") in new stack -- Executing [s@macro-hangupcall:2] NoCDR("Zap/1-1", "") in new stack -- Executing [s@macro-hangupcall:3] GotoIf?("Zap/1-1", "1?skiprg") in new stack -- Goto (macro-hangupcall,s,6) -- Executing [s@macro-hangupcall:6] GotoIf?("Zap/1-1", "1?skipblkvm") in new stack -- Goto (macro-hangupcall,s,9) -- Executing [s@macro-hangupcall:9] GotoIf?("Zap/1-1", "1?theend") in new stack -- Goto (macro-hangupcall,s,11) -- Executing [s@macro-hangupcall:11] Hangup("Zap/1-1", "") in new stack == Spawn extension (macro-hangupcall, s, 11) exited non-zero on 'Zap/1-1' in macro 'hangupcall' == Spawn extension (macro-hangupcall, s, 11) exited non-zero on 'Zap/1-1' -- Hungup 'Zap/1-1' --- snap ---

Thanks in advance

Regards, KriS83

04/17/08 09:24:23 changed by KriS83

  • attachment trace.txt added.

calltrace

04/17/08 09:25:52 changed by KriS83

Hi again,

sorry! I added the trace as an attachment.

Regards, KriS83

04/17/08 09:59:26 changed by p_lindheimer

  • priority changed from major to minor.
  • confirmation changed from Unreviewed to Need Feedback.
  • milestone changed from Cut Line to 3.0.

It looks to me like the prefix is being retained:

-- Executing [s@macro-user-callerid:23] NoOp("Zap/1-1", "Using CallerID "LL: CID withheld" <>") in new stack

...

   dialparties.agi: Caller ID name is 'LL: CID withheld' number is 'unknown'

It would appear that the absence of a CID number is resulting in the phone itself not displaying the information. You can turn on 'sip debug' for the extension being dialed and see if the appropriate CID info is being sent in the SIP message. You can also look into the channel when the call is up and answered to see what the CID information is setup in the channel

04/17/08 15:24:08 changed by KriS83

Hi,

I had a look at "sip debug". And you were right, it looked something like:

From: "Unknown" <sip:Unknown@192.168.0.9>;tag=as213e0b59

However I still managed to fix this issue, atleast for myself. This is the patch/changes I made:

--- /var/www/html/admin/modules/core/functions.inc.php.ori      2008-04-17 15:11:47.000000000 +0200
+++ /var/www/html/admin/modules/core/functions.inc.php  2008-04-18 00:18:52.000000000 +0200
@@ -741,6 +741,7 @@
                                        $context = "ext-did";
 
                                        $ext->add($context, $exten, '', new ext_setvar('__FROM_DID','${EXTEN}'));
+                                       $ext->add($context, $exten, '', new ext_setcallerpres('allowed_not_screened'));
                                        // always set callerID name
                                        $ext->add($context, $exten, '', new ext_gotoif('$[ "${CALLERID(name)}" != "" ] ','cidok'));
                                        $ext->add($context, $exten, '', new ext_setvar('CALLERID(name)','${CALLERID(num)}'));

I'm not in the ofice atm, but from loking at the sip headers via debug it now seems to work:

From: "LL: CID withheld" <sip:Unknown@192.168.0.9>;tag=as4f7fee6c

I will give feedback if it actually does work and show correct on our phones tomorrow.

Regards, KriS83

(follow-up: ↓ 8 ) 04/17/08 17:06:02 changed by p_lindheimer

Kris83, from the first trace, it looks like you are correct and the information is not being transmitted to the phones. Are your calls coming in on a PRI? I think that may be related, the SIP channel is honoring the signaling from the PRI without the 'allowed_not_screened' directive. I'm thinking we may want to only add that if a cid-prepend is happening?

04/17/08 17:07:59 changed by p_lindheimer

actually - we probably want to always set it because subsequent pre-pends may happen in ringgroups, etc, so skip the last comment.

04/17/08 18:47:58 changed by p_lindheimer

I ran some tests on a PRI, there's a downside to your solution. It works well for the internal extensions, however if someone has a Follow-Me setup, or a phone forwarded, and the calls back out the PSTN, the anonymous caller presence is lost and the default trunk CID is transmitted vs. a relay of the anonymous/private status. The problem with this is that some people may choose not to answer their phone if they see it is anonymous and instead, it will look like a call from their office. I'm testing a potential solution to this but it is a bit more involved. We will need to do what you are doing while retaining the state of the ${CALLINGPRES} and then reset the calling presence to what it was on the outbound leg of the call.

(in reply to: ↑ 5 ) 04/17/08 22:43:54 changed by KriS83

Replying to p_lindheimer:

Kris83, Are your calls coming in on a PRI? I think that may be related, the SIP channel is honoring the signaling from the PRI without the 'allowed_not_screened' directive.

Hi,

yes their coming in on pri. I use Junghanns E1 double PRI cards.

Currently I don't forward any calls back to PSTN, so currently this solution is ok with me. But of course I do understand what you are saying. If you want me to test anything, just let me know. ${CALLINGPRES} seems to be set to some default as I didn't find this var anywhere besides in the Marco "dumpvars".

Please do give feedback as soon as you've solved this issue or require more information etc. I will be glad to assist whereever I can.

Regards, KriS83

04/17/08 23:02:07 changed by p_lindheimer

${CALLINGPRES} is set in the channel. The solution is conceptually simple, we just need to save the current state, do what you did, and then put the state back when the call goes back out. However, the format of what ${CALLINGPRES} returns and what we need to set it to are not the same, so the solution gets slightly complicated. I'll probably wait to hear back on this:

http://bugs.digium.com/view.php?id=12472

04/18/08 06:03:39 changed by KriS83

Hi,

why not use "CalligPres?()" as described here: http://www.voip-info.org/wiki/view/Asterisk+cmd+CallingPres

At least this is a solution until "SetCallingPres?()" is able to handle the the correct format.

Regards, KriS83

04/18/08 06:49:10 changed by p_lindheimer

because "This Application has been removed, and is no longer present." - it was replaced with SetCallerPres?()

04/20/08 10:31:50 changed by p_lindheimer

  • status changed from new to closed.
  • confirmation changed from Need Feedback to Need testing.
  • resolution set to fixed.

r5743

Closing this bug but PLEASE try out and provide feedback if issues.

The fix is similar to the proposed fix above. However, we save the callingpresence information and reapply it in the macro-outbound-callerid that is applied on outbound calls if the call is forwarded (or followme). If we don't do this, the forwarded call will end up with the trunk's default CID which may be mistaken as an internal call. With this patch, the calling presence information gets relayed on digital channels which results in the call showing as anonymous/blocked - the desired results. This will not be the case all the time as the calling presence information needs to be transmitted and honored. Some channels do and some don't.

IMPORTANT - if you are running 1.6, you will need to make sure you have r5739 installed which will be part of the next framework update.

Index: functions.inc.php
===================================================================
--- functions.inc.php (revision 5742)
+++ functions.inc.php (working copy)
@@ -799,6 +799,18 @@
          }
          if ($item['privacyman'] == "1") {
            $ext->add($context, $exten, '', new ext_macro('privacy-mgr'));
+         } else {
+           // if privacymanager is used, this is not necessary as it will not let blocked/anonymous calls through
+           // otherwise, we need to save the caller presence to set it properly if we forward the call back out the pbx
+           // note - the indirect table could go away as of 1.4.20 where it is fixed so that SetCallerPres can take
+           // the raw format.
+           //
+           if (version_compare($version, "1.6", "lt")) { 
+             $ext->add($context, $exten, '', new ext_setvar('__CALLINGPRES_SV','${CALLINGPRES_${CALLINGPRES}}'));
+           } else {
+             $ext->add($context, $exten, '', new ext_setvar('__CALLINGPRES_SV','${CALLERPRES()}'));
+           }
+           $ext->add($context, $exten, '', new ext_setcallerpres('allowed_not_screened'));
          }
          if (!empty($item['alertinfo'])) {
            $ext->add($context, $exten, '', new ext_setvar("__ALERT_INFO", str_replace(';', '\;', $item['alertinfo'])));
@@ -1056,6 +1068,23 @@
      // Put the asterisk version in a global for agi etc.
      $ext->addGlobal('ASTVERSION', $version);

+     // Create CallingPresTable to deal with difference that ${CALINGPRES} returns vs. what
+     // SetCallingPres() accepts. This is a workaround that gets resolved in 1.6 where
+     // function CALLINGPRES() is consistent.
+     // This should be fixed in 1.4.20 but for now we keep it in until 1.6
+     //
+     if (version_compare($version, "1.6", "lt")) { 
+       $ext->addGlobal('CALLINGPRES_0', 'allowed_not_screened');
+       $ext->addGlobal('CALLINGPRES_1', 'allowed_passed_screen');
+       $ext->addGlobal('CALLINGPRES_2', 'allowed_failed_screen');
+       $ext->addGlobal('CALLINGPRES_3', 'allowed');
+       $ext->addGlobal('CALLINGPRES_32', 'prohib_not_screened');
+       $ext->addGlobal('CALLINGPRES_33', 'prohib_passed_screen');
+       $ext->addGlobal('CALLINGPRES_34', 'prohib_failed_screen');
+       $ext->addGlobal('CALLINGPRES_35', 'prohib');
+       $ext->addGlobal('CALLINGPRES_67', 'unavailable');
+     }
+
      /* outbound routes */
      // modules should use their own table for storage (and module_get_config() to add dialplan)
      // modules should NOT use the extension table to store anything!
@@ -1392,6 +1421,15 @@
      $context = 'macro-outbound-callerid';
      $exten = 's';

+     // If we modified the caller presence, set it back. This allows anonymous calls to be internally prepended but keep
+     // their status if forwarded back out. Not doing this can result in the trunk CID being displayed vs. 'blocked call'
+     //
+     if (version_compare($version, "1.6", "lt")) { 
+       $ext->add($context, $exten, '', new ext_execif('$["${CALLINGPRES_SV}" != ""]', 'SetCallingPres', '${CALLINGPRES_SV}'));                                              
+     } else {                                                                                                                                                               
+       $ext->add($context, $exten, '', new ext_execif('$["${CALLINGPRES_SV}" != ""]', 'Set', 'CALLERPRES()=${CALLINGPRES_SV}'));                                            
+     }                                                                                                                                                                      
+                                                                                                                                                                            
      // Keep the original CallerID number, for failover to the next trunk.                                                                                                  
      $ext->add($context, $exten, '', new ext_gotoif('$["${REALCALLERIDNUM:1:2}" != ""]', 'start'));                                                                         
      $ext->add($context, $exten, '', new ext_set('REALCALLERIDNUM', '${CALLERID(number)}'));