SOLVED: CALLTRACE misinformation issue when call comes to an ext via a Group

Added by Brian Kelly 21 days ago

In the CLI if you do a "database show CALLTRACE" you'll see the last number that called each of your devices

The issue is that when the call to that device (ext) is from a Group the caller id information is not present. So if ext 723 called ext 721 had a chat and then 721 received a DID call as part of a Group then the DID callers id will not be in the CALLTRACE information.

Is there an easy way to solve this problem?

One reason this is needed is that the Incredible PBX blacklist function (*32) uses CALLTRACE to determine the last number that called so it can be added to the blacklist


Replies (13)

RE: CALLTRACE misinformation issue when call comes to an ext via a Group - Added by Pascal Cadotte-Michaud 20 days ago

Hi Brian,

I did know about "database show CALLTRACE" and in my development environment this key does not exists in the database. My guess is that the database is updated by an incredible pbx module.

Could you show me I can take a look at this code to understand what it does and whats wrong?
Alternatively, you would probably have more luck asking this question on the incredible pbx forum.

RE: CALLTRACE doesn't provide accurate lastcaller info if call comes from Group - Added by Brian Kelly 19 days ago

[app-blacklist-last] is the section in question.....

In the Asterisk CLI if I type: database show CALLTRACE I get

wazo*CLI> database show CALLTRACE
/CALLTRACE/1 : 702
/CALLTRACE/13 : 723
/CALLTRACE/14 : 730
/CALLTRACE/15 : 725
/CALLTRACE/2 : 0018459862121
/CALLTRACE/20 : 723
/CALLTRACE/21 : 8459862020
/CALLTRACE/22 : 17328446737
/CALLTRACE/23 : 723
/CALLTRACE/24 : 723
/CALLTRACE/25 : 723
/CALLTRACE/27 : 723
/CALLTRACE/3 : 0018459862121
/CALLTRACE/30 : 722

*The problem is that if the last call to one of these lines is from a Wazo Group the query does not reflect the caller id of the person who called the Group number instead it shows and holds onto the
last caller that called the line directly either from another extension or a DID that routes directly to that extension (not through a Group).

I'm not sure where CALLTRACE is originally placed in database but the question would be what is the best way to determine lastcaller and will it be accurate if the call comes from a group?

*

;     Blacklist dialplan code modified for XiVO platform on 6/4/2016 by Ward Mundy & Associates, LLC.
;     Modified code is GPL3-licensed. See LICENSES.conf for additional information and terms of use.
; 
;     Portions Copyright (C) 2005-2016,  Ward Mundy & Associates LLC
;     Portions Copyright (C) 2005-2016,  Sangoma Technologies, Inc.
;     Portions Copyright (C) 2016,  Avencall

[app-blacklist-add]
exten => s,1,Answer
exten => s,n,Wait(1)
exten => s,n,Set(NumLoops=0)
exten => s,n(start),Playback(enter-num-blacklist)
exten => s,n,Set(TIMEOUT(digit)=5)
exten => s,n,Set(TIMEOUT(response)=60)
exten => s,n,Read(blacknr,then-press-pound,,,,)
exten => s,n,SayDigits(${blacknr})
exten => s,n,Playback(if-correct-press&digits/1)
exten => s,n,Noop(Waiting for input)
exten => s,n(end),WaitExten(40,)
exten => s,n,Playback(sorry-youre-having-problems&goodbye)
exten => s,n,Hangup

exten => i,1,Playback(sorry-youre-having-problems&goodbye)
exten => i,n,Hangup
exten => e,1,Playback(sorry-youre-having-problems&goodbye)
exten => e,n,Hangup

;exten => 1,1,GotoIf($[ "${blacknr}" != ""]?:app-blacklist-add-invalid,s,1)
exten => 1,1,Set(DB(blacklist/${blacknr})=1)
exten => 1,n,Playback(num-was-successfully&added)
exten => 1,n,Wait(1)
exten => 1,n,Hangup

[app-blacklist-add-invalid]
exten => s,1,Set(NumLoops=$[${NumLoops} + 1])
exten => s,n,Playback(pm-invalid-option)
;exten => s,n,GotoIf($[${NumLoops} < 3]?app-blacklist-add,s,start)
exten => s,n,Playback(goodbye)
exten => s,n,Hangup

[app-blacklist-remove]
exten => s,1,Answer
exten => s,n,Wait(1)
exten => s,n,Playback(entr-num-rmv-blklist)
exten => s,n,Set(TIMEOUT(digit)=5)
exten => s,n,Set(TIMEOUT(response)=60)
exten => s,n,Read(blacknr,then-press-pound,,,,)
exten => s,n,SayDigits(${blacknr})
exten => s,n,Playback(if-correct-press&digits/1)
exten => s,n,Noop(Waiting for input)
exten => s,n(end),WaitExten(40,)
exten => s,n,Playback(sorry-youre-having-problems&goodbye)
exten => s,n,Hangup

exten => i,1,Playback(sorry-youre-having-problems&goodbye)
exten => i,n,Hangup
exten => e,1,Playback(sorry-youre-having-problems&goodbye)
exten => e,n,Hangup

exten => 1,1,Noop(Deleting: blacklist/${blacknr} ${DB_DELETE(blacklist/${blacknr})})
exten => 1,n,Playback(num-was-successfully&removed)
exten => 1,n,Wait(1)
exten => 1,n,Hangup

[app-blacklist-last]
exten => s,1,Answer
exten => s,n,Wait(1)

exten => s,n,Noop(USER ID=${XIVO_USERID})
exten => s,n,Noop(CALLTRACE=${DB(CALLTRACE/${XIVO_USERID})})

exten => s,n,Set(lastcaller=${DB(CALLTRACE/${XIVO_USERID})})

exten => s,n,GotoIf($[ $[ "${lastcaller}" = "" ] | $[ "${lastcaller}" = "unknown" ] ]?noinfo)
exten => s,n,Playback(privacy-to-blacklist-last-caller&telephone-number)
exten => s,n,SayDigits(${lastcaller})
exten => s,n,Set(TIMEOUT(digit)=3)
exten => s,n,Set(TIMEOUT(response)=7)
exten => s,n,Playback(if-correct-press&digits/1)
exten => s,n,Goto(end)
exten => s,n(noinfo),Playback(unidentified-no-callback)
exten => s,n,Hangup
exten => s,n,Noop(Waiting for input)
exten => s,n(end),WaitExten(20,)
exten => s,n,Playback(sorry-youre-having-problems&goodbye)
exten => s,n,Hangup

exten => i,1,Playback(sorry-youre-having-problems&goodbye)
exten => i,n,Hangup
exten => e,1,Playback(sorry-youre-having-problems&goodbye)
exten => e,n,Hangup

exten => 1,1,Set(DB(blacklist/${lastcaller})=1)
exten => 1,n,Playback(num-was-successfully)
exten => 1,n,Playback(added)
exten => 1,n,Wait(1)
exten => 1,n,Hangup

RE: CALLTRACE misinformation issue when call comes to an ext via a Group - Added by Ward Mundy 19 days ago

Hi Pascal,
Incredible PBX generates the CALLTRACE entries in the Asterisk DB based upon XIVO_USERID in hopes of deciphering the CallerID of the last caller. This seems to work when calls come into extensions, but doesn't work when a call comes into a ring group. Is there some other way to detect the phone number of the last call??

RE: CALLTRACE misinformation issue when call comes to an ext via a Group - Added by Brian Kelly 17 days ago

Hello..... Anyone have a "best" solution for obtaining the last caller?

RE: CALLTRACE misinformation issue when call comes to an ext via a Group - Added by Pascal Cadotte-Michaud 17 days ago

Hi

there's no easy way to know which user's user id answered a call on a queue using dialplan subroutines like the global subroutine used for the user CALLTRACE. But I it's possible to reach the user's dialplan instead of calling it's sip peer when the call is sent to the group. With this kind of configuration, the CALLTRACE would be updated for calls received using a group.

To do that, you can edit your user. In the "Groups" tab there's a "Channel" column. If you choose "Local" instead of "default" the CALLTRACE value will be updated.

RE: CALLTRACE misinformation issue when call comes to an ext via a Group - Added by Brian Kelly 17 days ago

I went into the user associated with 722 which is one of the ext's in grp1 and made the channel change to local. I then called the DID that routes to that Group and answered the call on 722.

In the CLI database show calltrace produces a list of the ext's and the lastcall numbers. It was NOT updated since the last call from an internal extension (725).

I did reload and restart just to make sure.....

Am I missing something?

Brian

RE: CALLTRACE misinformation issue when call comes to an ext via a Group - Added by Pascal Cadotte-Michaud 17 days ago

In the asterisk cli, whats the output of the command "queue show <group name>"?

RE: CALLTRACE misinformation issue when call comes to an ext via a Group - Added by Brian Kelly 17 days ago

wazo*CLI> queue show grp1
grp1 has 0 calls (max unlimited) in 'ringall' strategy (0s holdtime, 1s talktime), W:0, C:2, A:1, SL:0.0% within 0s
Members:
SIP/734 (ringinuse enabled) (Not in use) has taken no calls yet
SIP/ (ringinuse enabled) (Invalid) has taken no calls yet
SIP/733 (ringinuse enabled) (Not in use) has taken no calls yet
SIP/732 (ringinuse enabled) (Not in use) has taken no calls yet
SIP/731 (ringinuse enabled) (Not in use) has taken no calls yet
SIP/730 (ringinuse enabled) (Unavailable) has taken no calls yet
SIP/726 (ringinuse enabled) (Not in use) has taken no calls yet
SIP/725 (ringinuse enabled) (Not in use) has taken no calls yet
SIP/724 (ringinuse enabled) (Unavailable) has taken no calls yet
SIP/723 (ringinuse enabled) (Not in use) has taken no calls yet
SIP/722 (ringinuse enabled) (Not in use) has taken 1 calls (last was 1041 secs ago)
SIP/721 (ringinuse enabled) (Not in use) has taken no calls yet
SIP/711 (ringinuse enabled) (Not in use) has taken no calls yet
SIP/710 (ringinuse enabled) (Not in use) has taken no calls yet
SIP/735 (ringinuse enabled) (Not in use) has taken no calls yet
No Callers

RE: CALLTRACE misinformation issue when call comes to an ext via a Group - Added by Pascal Cadotte-Michaud 17 days ago

It looks like the change to "Local" has not been saved.

If you edit you user and change to Local again, one of the members should be "Local/..." instead of "SIP/..."

RE: CALLTRACE misinformation issue when call comes to an ext via a Group - Added by Brian Kelly 17 days ago

Now shows the Local change but still doesn't update database show calltrace

queue show grp1
grp1 has 0 calls (max unlimited) in 'ringall' strategy (0s holdtime, 1s talktime), W:0, C:1, A:0, SL:0.0% within 0s
Members:
SIP/734 (ringinuse enabled) (Not in use) has taken no calls yet
SIP/ (ringinuse enabled) (Invalid) has taken no calls yet
Local/722@default (ringinuse enabled) (Not in use) has taken 1 calls (last was 23 secs ago)
SIP/733 (ringinuse enabled) (Not in use) has taken no calls yet
SIP/732 (ringinuse enabled) (Not in use) has taken no calls yet
SIP/731 (ringinuse enabled) (Not in use) has taken no calls yet
SIP/730 (ringinuse enabled) (Unavailable) has taken no calls yet
SIP/726 (ringinuse enabled) (Not in use) has taken no calls yet
SIP/725 (ringinuse enabled) (Not in use) has taken no calls yet
SIP/724 (ringinuse enabled) (Unavailable) has taken no calls yet
SIP/723 (ringinuse enabled) (Not in use) has taken no calls yet
SIP/721 (ringinuse enabled) (Not in use) has taken no calls yet
SIP/711 (ringinuse enabled) (Not in use) has taken no calls yet
SIP/710 (ringinuse enabled) (Not in use) has taken no calls yet
SIP/735 (ringinuse enabled) (Not in use) has taken no calls yet
No Callers

RE: CALLTRACE misinformation issue when call comes to an ext via a Group - Added by Brian Kelly 17 days ago

Here's the original post from a year ago on this. The issue was solved for direct to ext number calls the problem now is when a call is routed to a Group and then the members of that Group the information is not updated.

https://projects.wazo.community/boards/1/topics/6211

RE: Lastcaller issue when call comes to an ext via a Group - Added by Brian Kelly 15 days ago

Seems puzzling that an accurate lastcaller is presented in the caller id of the group members caller id but yet that information isn't held anywhere?

If that truly turns out to be the case might a pre-process routine invoked by anyone of the group members extensions be used to capture and store the needed lastcaller information?

Brian

RE: CALLTRACE misinformation issue when call comes to an ext via a Group - Added by Brian Kelly 14 days ago

Here's a solution that works:

Create a config file called 'pre-setlast' with these contents

[pre-setcalltrace]
exten = s,1,NoOp()
same =  n,Set(DB(CALLTRACE/${XIVO_DSTID})=${CALLERID(number)})
same  =   n(return),Return()

add the Preprocessor Subroutine 'pre-setcalltrace' to ALL Users that are in the Group (unless you only need access to this variable on certain extensions)

ALSO change the Group channel in each User from 'default' to 'local'

(1-13/13)