[asterisk-bugs] [JIRA] (ASTERISK-28767) chan_pjsip: Caller ID not used when checking for extension, callerid supplement executed too late

Olaf Winkler (JIRA) noreply at issues.asterisk.org
Wed Apr 8 07:30:25 CDT 2020


    [ https://issues.asterisk.org/jira/browse/ASTERISK-28767?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=250171#comment-250171 ] 

Olaf Winkler commented on ASTERISK-28767:
-----------------------------------------

Hi Joshua,

the problem with You patch is, that both - session->id.number.valid and session->id.number.str - are still not initialized when teh call goes into get_destination.
If this is intended it would be necessary here to fetch the callerid for the CID-Matching from the respective From-Header (which should be avbailable in rdata) before calling ast_exists_extension.

Can be verified with just printing it out before comparison:

ast_log(LOG_ERROR, "Got callerid : %s .\n", session->id.number.str);
ast_log(LOG_ERROR, "Got callerid-valied : %d .\n", session->id.number.valid);

Gets You <null> and 0 and thus the CID-Match will not be successfull.

Unfortunately I'm not the "PJSIP-Expert" and don't have the time to dig through all APIs. maybe You can have a look at this and suggest a way for getting the Callerid-Info here (if we don't have an non-intended issue of initializing these values too late in teh process).

KR
Olaf Winkler

> chan_pjsip: Caller ID not used when checking for extension, callerid supplement executed too late
> -------------------------------------------------------------------------------------------------
>
>                 Key: ASTERISK-28767
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-28767
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Channels/chan_pjsip, Resources/res_pjsip_caller_id
>    Affects Versions: 16.0.1, 16.8.0
>            Reporter: Oleg
>            Assignee: Unassigned
>              Labels: patch
>         Attachments: 3333.jpg, ASTERISK-28767.diff
>
>
> {noformat}
> [DLPN_DialPlan1]
> exten => _8[89]XXXXXXXXX/_2000,1,Answer()
>  same => n,Verbose(111111111111111111 CID ${CALLERID(num)})
>  same => n,Dumpchan()
>  same => n,Wait(1)
>  same => n,Hangup
> exten => _8[89]XXXXXXXXX/2000,1,Answer()
>  same => n,Verbose(44444444444 CID ${CALLERID(num)})
>  same => n,Dumpchan()
>  same => n,Wait(1)
>  same => n,Hangup
> exten => _8[89]XXXXXXXXX,1,Answer()
>  same => n,Verbose(!!!!!!!!!!!! CID ${CALLERID(num)})
>  same => n,Dumpchan()
>  same => n,Wait(1)
>  same => n,Hangup
> {noformat}
> Asterisk:
> {noformat}
> Setting global variable 'SIPDOMAIN' to '10.40.8.162'
>     -- Executing [89051333333 at DLPN_DialPlan1:1] Answer("PJSIP/2000-00000004", "") in new stack
>        > 0x7f262405f0d0 -- Strict RTP learning after remote address set to: 10.40.4.223:50836
>        > 0x7f262405f0d0 -- Strict RTP switching to RTP target address 10.40.4.223:50836 as source
>     -- Executing [89051333333 at DLPN_DialPlan1:2] Verbose("PJSIP/2000-00000004", "44444444444 CID 2000") in new stack
> 44444444444 CID 2000
>     -- Executing [89051333333 at DLPN_DialPlan1:3] DumpChan("PJSIP/2000-00000004", "") in new stack
> {noformat}
> Dumping Info For Channel: PJSIP/2000-00000004:
> {noformat}
> ================================================================================
> Info:
> Name=               PJSIP/2000-00000004
> Type=               PJSIP
> UniqueID=           1583394430.6
> LinkedID=           1583394430.6
> CallerIDNum=        2000
> CallerIDName=       Ananas
> ConnectedLineIDNum= (N/A)
> ConnectedLineIDName=(N/A)
> DNIDDigits=         89051333333
> RDNIS=              (N/A)
> Parkinglot=         
> Language=           en
> State=              Up (6)
> Rings=              1
> NativeFormat=       (alaw)
> WriteFormat=        alaw
> ReadFormat=         alaw
> RawWriteFormat=     alaw
> RawReadFormat=      alaw
> WriteTranscode=     No 
> ReadTranscode=      No 
> 1stFileDescriptor=  -1
> Framesin=           15 
> Framesout=          0 
> TimetoHangup=       0
> ElapsedTime=        0h0m0s
> BridgeID=           (Not bridged)
> Context=            DLPN_DialPlan1
> Extension=          89051333333
> Priority=           3
> CallGroup=          
> PickupGroup=        
> Application=        DumpChan
> Data=               (Empty)
> Blocking_in=        (Not Blocking)
> {noformat}
> Variables:
> {noformat}
> ================================================================================
>     -- Executing [89051333333 at DLPN_DialPlan1:4] Wait("PJSIP/2000-00000004", "1") in new stack
>     -- Executing [89051333333 at DLPN_DialPlan1:5] Hangup("PJSIP/2000-00000004", "") in new stack
>   == Spawn extension (DLPN_DialPlan1, 89051333333, 5) exited non-zero on 'PJSIP/2000-00000004'[/spoiler]
> {noformat}
> Delete the bottom lines:
> {noformat}
> [DLPN_DialPlan1]
> exten => _8[89]XXXXXXXXX/_2000,1,Answer()
>  same => n,Verbose(111111111111111111 CID ${CALLERID(num)})
>  same => n,Dumpchan()
>  same => n,Wait(1)
>  same => n,Hangup
> exten => _8[89]XXXXXXXXX/2000,1,Answer()
>  same => n,Verbose(44444444444 CID ${CALLERID(num)})
>  same => n,Dumpchan()
>  same => n,Wait(1)
>  same => n,Hangup
> ; exten => _8[89]XXXXXXXXX,1,Answer()
>  ; same => n,Verbose(!!!!!!!!!!!! CID ${CALLERID(num)})
>  ; same => n,Dumpchan()
>  ; same => n,Wait(1)
>  ; same => n,Hangup
> {noformat}
> Asterisk:
> {noformat}
> [Mar  5 10:53:05] NOTICE[2216]: res_pjsip_session.c:3078 new_invite: Call from '2000' (UDP:10.40.4.223:54005) to extension '89051333333' rejected because extension not found in context 'DLPN_DialPlan1'.
> {noformat}
> pjsip_wizard.conf
> {noformat}
> [user_defaults](!)
> type = wizard
> transport = ipv4
> accepts_registrations = yes
> sends_registrations = no
> accepts_auth = yes
> sends_auth = no
> has_hint = yes
> hint_context = DLPN_DialPlan1
> hint_application = Gosub(stdexten,${EXTEN},1(${HINT}))
> endpoint/context = DLPN_DialPlan1
> endpoint/allow_subscribe = yes
> endpoint/allow = !all,alaw
> endpoint/direct_media = yes
> endpoint/force_rport = yes
> endpoint/disable_direct_media_on_nat = yes
> endpoint/direct_media_method = invite
> endpoint/ice_support = yes
> endpoint/moh_suggest = default
> endpoint/send_rpid = yes
> endpoint/rewrite_contact = yes
> endpoint/send_pai = yes
> endpoint/allow_transfer = yes
> endpoint/trust_id_inbound = yes
> endpoint/device_state_busy_at = 1
> endpoint/trust_id_outbound = yes
> endpoint/send_diversion = yes
> aor/qualify_frequency = 30
> aor/authenticate_qualify = no
> aor/max_contacts = 1
> aor/remove_existing = yes
> aor/minimum_expiration = 30
> aor/support_path = yes
>  
> [bob](user_defaults)
> hint_exten = 1000
> inbound_auth/username = bob
> inbound_auth/password = bobspassword
>  
> [alice](user_defaults)
> hint_exten = 1001
> endpoint/callerid = Alice <1001>
> inbound_auth/username = alice
> inbound_auth/password = alicespassword
> [2000](user_defaults)
> hint_exten = 2000
> endpoint/callerid = Ananas <2000>
> inbound_auth/username = 2000
> inbound_auth/password = Ananas2000
> {noformat}
> With the sip driver, the bottom line was not required.



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list