[Home]

Summary:ASTERISK-28761: Assigning CallerIDNum from DNIDDigits to chan_pjsip
Reporter:Vyrva Igor (vigor1710)Labels:
Date Opened:2020-02-28 07:44:23.000-0600Date Closed:2020-03-03 13:14:21.000-0600
Priority:MinorRegression?
Status:Closed/CompleteComponents:Channels/chan_pjsip
Versions:16.8.0 Frequency of
Occurrence
Constant
Related
Issues:
Environment:CentOS 7 Asterisk 16.8 (src) Attachments:
Description:If the channel that responds to the Dial/Queue (dstchannel) call is running on chan_pjsip for it, the CallerIDNum parameter takes the value from the DNIDDigits parameter of the call Initiator (channel)
Channel:
{code}
Name= SIP/423-00000031
Type= SIP
UniqueID= 1582885712.361
LinkedID= 1582885712.361
CallerIDNum= 423
CallerIDName= AP-423
ConnectedLineIDNum= (N/A)
ConnectedLineIDName=(N/A)
DNIDDigits= 300
{code}

Dstchannel:
{code}
Name= PJSIP/666-00000003
Type= PJSIP
UniqueID= 1582885712.364
LinkedID= 1582885712.361
CallerIDNum= 300
CallerIDName= (N/A)
ConnectedLineIDNum= 423
ConnectedLineIDName= AP-423
DNIDDigits= (N/A)
{code}

However, if the meeting works in chan_sip that happens

Channel
{code}
Name= SIP/423-00000036
Type= SIP
UniqueID= 1582896505.420
LinkedID= 1582896505.420
CallerIDNum= 423
CallerIDName= AP-423
ConnectedLineIDNum= (N/A)
ConnectedLineIDName=(N/A)
DNIDDigits= 300
{code}

Dstchannel
{code}
Name= SIP/422-00000037
Type= SIP
UniqueID= 1582896505.423
LinkedID= 1582896505.420
CallerIDNum= (N/A)
CallerIDName= (N/A)
ConnectedLineIDNum= 423
ConnectedLineIDName=AP-423
DNIDDigits= (N/A)
{code}

If, before making a call, we delete the information from DNIDDigits, then for PJSIP we get in CallerIDNum=${EXTEN} from which the Dial/Queue is made
Channel
Executing [anonym11@test-line:10] Set("SIP/423-00000038", "CALLERID(dnid)= ") in new stack
{code}
Name= SIP/423-00000038
Type= SIP
UniqueID= 1582896895.436
LinkedID= 1582896895.436
CallerIDNum= 423
CallerIDName= AP-423
ConnectedLineIDNum= (N/A)
ConnectedLineIDName=(N/A)
DNIDDigits= (N/A)
{code}

Dstchannel
{code}
Name= PJSIP/666-00000006
Type= PJSIP
UniqueID= 1582896895.439
LinkedID= 1582896895.436
CallerIDNum= anonym11
CallerIDName= (N/A)
ConnectedLineIDNum= 423
ConnectedLineIDName=AP-423
DNIDDigits= (N/A)
{code}

Is it really a bug or is it specifically made this way?
If specifically-how to disable it?
Comments:By: Asterisk Team (asteriskteam) 2020-02-28 07:44:24.446-0600

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

Please note that once your issue enters an open state it has been accepted. As Asterisk is an open source project there is no guarantee or timeframe on when your issue will be looked into. If you need expedient resolution you will need to find and pay a suitable developer. Asking for an update on your issue will not yield any progress on it and will not result in a response. All updates are posted to the issue when they occur.

By: Vyrva Igor (vigor1710) 2020-03-02 01:33:51.259-0600

Example DialPlan:
{code}
exten => *777,1,NoOp(--- Test PJSIP ---)
same => n,GoTo(test,1)

exten => test,1,NoOp(--- Test ---)
same => n,DumpChan()
same => n,Queue(test)
same => n,HangUp()

[sub-test]
exten => s,1,NoOp(--- TEST GoSub ---)
same => n,DumpChan
same => n,Return()
{code}

Queue test:
{code}
test]
setqueuevar = yes ;Для работы ${QUEUENAME}
ringinuse = yes
member => PJSIP/666,1,Test User
membergosub = sub-test
{code}
PJSIP/422 added from CLI
{code}
queue add member PJSIP/422 to test penalty 1
{code}
{code}
queue show test
test has 0 calls (max unlimited) in 'ringall' strategy (2s holdtime, 2s talktime), W:0, C:1, A:0, SL:0.0%, SL2:0.0% within 0s
  Members:
     PJSIP/422 with penalty 1 (ringinuse enabled) (dynamic) (Not in use) has taken 1 calls (last was 199 secs ago)
     Test User (PJSIP/666) with penalty 1 (ringinuse enabled) (Unavailable) has taken no calls yet
  No Callers
{code}
DumpChan channel
{code}
Dumping Info For Channel: PJSIP/423-00000099:
================================================================================
Info:
Name=               PJSIP/423-00000099
Type=               PJSIP
UniqueID=           1583133481.160
LinkedID=           1583133481.160
CallerIDNum=        423
CallerIDName=       Igor Vyrva
ConnectedLineIDNum= (N/A)
ConnectedLineIDName=(N/A)
DNIDDigits=         *777
RDNIS=              (N/A)
{code}
DumpChan dstchannel
{code}
Dumping Info For Channel: PJSIP/422-0000009a:
================================================================================
Info:
Name=               PJSIP/422-0000009a
Type=               PJSIP
UniqueID=           1583133481.161
LinkedID=           1583133481.160
CallerIDNum=        *777
CallerIDName=       (N/A)
ConnectedLineIDNum= 423
ConnectedLineIDName=Igor Vyrva
DNIDDigits=         (N/A)
RDNIS=              (N/A)
{code}
If application Dial with 'b' (The rest is identical, just use Dial instead of Queue)
DumpChan dstchannel
{code}
Dumping Info For Channel: PJSIP/422-0000009e:
================================================================================
Info:
Name=               PJSIP/422-0000009e
Type=               PJSIP
UniqueID=           1583134114.165
LinkedID=           1583134114.164
CallerIDNum=        test
CallerIDName=       (N/A)
ConnectedLineIDNum= 423
ConnectedLineIDName=Igor Vyrva
DNIDDigits=         (N/A)
RDNIS=              (N/A)
{code}
If application Dial with 'U' (The rest is identical, just use Dial instead of Queue)
DumpChan dstchannel
{code}
Dumping Info For Channel: PJSIP/422-000000a0:
================================================================================
Info:
Name=               PJSIP/422-000000a0
Type=               PJSIP
UniqueID=           1583134310.167
LinkedID=           1583134310.166
CallerIDNum=        test
CallerIDName=       (N/A)
ConnectedLineIDNum= 423
ConnectedLineIDName=Igor Vyrva
DNIDDigits=         (N/A)
RDNIS=              (N/A)
{code}
DumpChan channel differs only by the channel number

By: Vyrva Igor (vigor1710) 2020-03-02 01:39:15.892-0600

PJSIP:
{code}
[phone-endpoint](!)
type = endpoint
 context = local
 disallow = all
 allow = ulaw,alaw
 dtmf_mode = rfc4733
 direct_media = no
 rtp_symmetric = yes
 language = ru
 asymmetric_rtp_codec = yes

[phone-auth](!)
type = auth
 auth_type = userpass
 password = 123456q

[phone-aor](!)
type = aor
 max_contacts = 1
 default_expiration=600
 qualify_frequency=150
 authenticate_qualify=yes

[422](phone-endpoint)
auth = 422
 aors = 422
[422](phone-auth)
username = 422
[422](phone-aor)

[423](phone-endpoint)
auth = 423
 aors = 423
  send_rpid=yes
 device_state_busy_at=2 ; The number of in use channels which will cause busy to be returned as device state (default: «0»)
[423](phone-auth)
username = 423
[423](phone-aor)
max_contacts=2
{code}

By: Kevin Harwell (kharwell) 2020-03-02 17:26:37.983-0600

In this instance _app_queue_ is attempting to guess the caller id since one is not found on the channel. From what I understand, _chan_pjsip_ does not necessarily guarantee its channels are created will caller id.

However, you should be able to remedy the situation by specifying a caller id (for instance, in the endpoint configuration) in the _chan_pjsip_ case.

By: Vyrva Igor (vigor1710) 2020-03-03 04:31:56.543-0600

Is it possible in chan_pjsip to make it so that in dstchannel (without binding to Dial/Queue) in the CallerID parameter Num = (N/A)

For exsample
{code}
Dumping Info For Channel: PJSIP/422-000000a0:
================================================================================
Info:
Name=               PJSIP/422-000000a0
Type=               PJSIP
UniqueID=           1583134310.167
LinkedID=           1583134310.166
CallerIDNum=        (N/A)
CallerIDName=       (N/A)
ConnectedLineIDNum= 423
ConnectedLineIDName=Igor Vyrva
DNIDDigits=         (N/A)
RDNIS=              (N/A)
{code}

By: Asterisk Team (asteriskteam) 2020-03-03 04:31:56.901-0600

This issue has been reopened as a result of your commenting on it as the reporter. It will be triaged once again as applicable.

By: Kevin Harwell (kharwell) 2020-03-03 13:14:04.096-0600

For the caller ID number _app_dumpchan_ first checks to see if a "valid" caller id number is available for the channel. If so it uses that, otherwise it writes "N/A". So if you want that value written there you'd have to make sure no caller id number was present (or invalid).

However in your scenario if the caller id number is invalid then _app_queue_ tries to "guess" and fill it in. Here's the [section of code|https://github.com/asterisk/asterisk/blob/master/apps/app_queue.c#L4533] doing that:
{noformat}
if (!ast_channel_caller(tmp->chan)->id.number.valid) {
if (ast_channel_connected(qe->chan)->id.number.valid) {
struct ast_party_caller caller;

ast_party_caller_set_init(&caller, ast_channel_caller(tmp->chan));
caller.id = ast_channel_connected(qe->chan)->id;
caller.ani = ast_channel_connected(qe->chan)->ani;
ast_channel_set_caller_event(tmp->chan, &caller, NLL);
} else if (!ast_strlen_zero(ast_channel_dialed(qe->chan)->number.str)) {
ast_set_callerid(tmp->chan, ast_channel_dialed(qe->chan)->number.str, NULL, NULL);
} else if (!ast_strlen_zero(S_OR(ast_channel_macroexten(qe->chan), ast_channel_exten(qe->chan)))) {
ast_set_callerid(tmp->chan, S_OR(ast_channel_macroexten(qe->chan), ast_channel_exten(qe->chan)), NULL, NULL);
}
tmp->dial_callerid_absent = 1;
}
{noformat}
You can see if the number part is invalid then it first tries to use the connected line information. Barring that it tries to use the dialed channel info, which is the case here.

You'd have to find a way to invalidate the number after this part (I'm not sure if that's possible), but before dumping the channel. Or just specify "N/A" for the caller id number maybe.

Otherwise I don't think it can be done without a code change.