I am an Asterisk amateur trying to understand the behaviour of aor and some related functions.
I am trying to use a dialplan function PJSIP_AOR to retrieve contact information without success. I am hoping that someone can help.
Below are the details.
I am running: Asterisk 20.7.0 built by pi @ raspberrypi on aarch64 running Linux built on 2024-04-02 16:50:39 UT
This example is PJSIP_AOR. The documentation reads:
PJSIP_AOR(name,field)
Arguments¶
name - The name of the AOR to query.
field - The configuration option for the AOR to query for. Supported options are those fields on the aor object in pjsip.conf.
contact - Permanent contacts assigned to AoR
…etc.
The relevant fragment of my pjsip.conf is:
[who-endpoint2]
type=endpoint
context = who-Incoming
allow = !all,g722,alaw
outbound_auth = who-auth2
aors = who-aor2
direct_media = no
from_domain = sip.who.com[who-auth2]
type = auth
auth_type = userpass
(username and password omitted)
realm = sip.who.com[who-aor2]
type = aor
contact = sip:sip.who.com
That being loaded. With asterisk running:
raspberrypi*CLI> pjsip show aor who-aor2
Aor: <Aor..............................................> <MaxContact>
Contact: <Aor/ContactUri…> <Hash…> <RTT(ms)…>
Aor: who-aor2 0
Contact: who-aor2/sip:sip.who.com cf882623ee NonQual nan
ParameterName : ParameterValue
authenticate_qualify : false
contact : sip:sip.who.com
default_expiration : 3600
mailboxes :
max_contacts : 0
maximum_expiration : 7200
minimum_expiration : 60
outbound_proxy :
qualify_frequency : 0
qualify_timeout : 3.000000
remove_existing : false
remove_unavailable : false
support_path : false
voicemail_extension :
The above shows the contact correctly as it appears in pjsip.conf
I make a call from extension 14 to sip:someone%40sip.aphoneco.org@sip.en.my-home.com
(sip.en.my-home.com is not on the internet - just the local IP of my test server)
This triggers a pattern match with the following EXTEN match:
exten => _[a-z].,1,Verbose(1,“hard to believe exten=${EXTEN} and domain =${SIPDOMAIN}”)
same = n,Verbose(1, “pjsip_AOR for who-aor2 returns ${PJSIP_AOR(who-aor2,contact)}”)
same = n,Hangup()
which is supposed to do nothing other than print out the value of the contact for who-aor2.
It triggers but not with the expected result.
Below is the output from asterisk -r -ddddvvvv
– Executing [someone@sip.aphoneco.org@Long-Distance:1] Verbose(“PJSIP/14-00000000”, “1,“hard to believe exten=someone@sip.aphoneco.org and domain =sip.en.my-home.com””) in new stack
“hard to believe exten=someone@sip.aphoneco.org and domain =sip.en.my-home.com”
– Executing [someone@sip.aphoneco.org@Long-Distance:2] Verbose(“PJSIP/14-00000000”, "1, “pjsip_AOR for who-aor2 contact returns who-aor2@@cf882623eedc97f7d90f6860b85549e4"”) in new stack
“pjsip_AOR for who-aor2 contact returns who-aor2@@cf882623eedc97f7d90f6860b85549e4”
– Executing [someone@sip.aphoneco.org@Long-Distance:4] Hangup(“PJSIP/14-00000000”, “”) in new stack
== Spawn extension (Long-Distance, someone@sip.aphoneco.org, 4) exited non-zero on ‘PJSIP/14-00000000’
If I do the same query for maximum_expiration I get pjsip_AOR for who-aor2 maximum_expiration returns 7200""
Which gives a correct entry for maximum_expiration of 7200 but who-aor2@@cf882623eedc97f7d90f6860b85549e4 in place of sip:sip.who.com for the contact.
endpoint 12, which has two contacts shown in the cli query “pjsip show aor 12 contact” as:
Contact:12/sip:12@192.168.222.242:5060;transport=UDP 2ac3651ea1
Contact: 12/sip:someone@sip.aphoneco.org 61ec8bc9af
PJSIP_AOR(12,contact) returns 12;@2ac3651ea193f1ff958ba224f4a6d9cc,12@@61ec8bc9af0090abc1794763c2788405
I noticed that the first 10 hex digits of both of these results are visible on the cli command “pjsip show aor 12 contact”
So why does the request for maximum_expiration work but the request for contact produce lots of hexadecimal preceded by @@ or ;@ ? I am baffled.