Problem to populate tables ps_aors and ps_endpoints throught ARI API

Hello,
I’m using Asterisk 16.7.0 with PJSIP Realtime and Sorcery. I’m trying to add an auth,aor and endpoint throught ARI and note that ps_auths table is populated, but ps_aors and ps_endpoints not. On Asterisk CLI, both auth and aors was created normally.
The schema of tables was loaded from contrib/realtime/mysql/mysql_config.sql file.

  • AUTH request
curl --request PUT \
  --url http://localhost:8088/a2feff32/ari/asterisk/config/dynamic/res_pjsip/auth/107 \
  --header 'Authorization: Basic YXN0ZXJpc2s6YXN0ZXJpc2s=' \
  --header 'Content-Type: application/json' \
  --data '{
	"fields": [
		{
			"attribute": "auth_type",
			"value": "userpass"
		},
		{
			"attribute": "username",
			"value": "107"
		},
		{
			"attribute": "password",
			"value": "123#456"
		}
	]
}'
  • AUTH response
[
  {
    "attribute": "username",
    "value": "107"
  },
  {
    "attribute": "md5_cred",
    "value": ""
  },
  {
    "attribute": "realm",
    "value": ""
  },
  {
    "attribute": "auth_type",
    "value": "userpass"
  },
  {
    "attribute": "password",
    "value": "123#456"
  },
  {
    "attribute": "nonce_lifetime",
    "value": "32"
  }
]
  • AOR request
curl --request PUT \
  --url http://localhost:8088/a2feff32/ari/asterisk/config/dynamic/res_pjsip/aor/107 \
  --header 'Authorization: Basic YXN0ZXJpc2s6YXN0ZXJpc2s=' \
  --header 'Content-Type: application/json' \
  --data '{
	"fields": [
		{
			"attribute": "max_contacts",
			"value": "1"
		},	
				{
			"attribute": "remove_existing",
			"value": "yes"
		},
		{
			"attribute": "support_path",
			"value": "yes"
		}
	]
}' 
  • AOR response
[
  {
    "attribute": "minimum_expiration",
    "value": "60"
  },
  {
    "attribute": "default_expiration",
    "value": "3600"
  },
  {
    "attribute": "qualify_timeout",
    "value": "3.000000"
  },
  {
    "attribute": "mailboxes",
    "value": ""
  },
  {
    "attribute": "support_path",
    "value": "true"
  },
  {
    "attribute": "voicemail_extension",
    "value": ""
  },
  {
    "attribute": "max_contacts",
    "value": "1"
  },
  {
    "attribute": "authenticate_qualify",
    "value": "false"
  },
  {
    "attribute": "contact",
    "value": ""
  },
  {
    "attribute": "maximum_expiration",
    "value": "7200"
  },
  {
    "attribute": "qualify_frequency",
    "value": "0"
  },
  {
    "attribute": "remove_existing",
    "value": "true"
  },
  {
    "attribute": "outbound_proxy",
    "value": ""
  }
]
  • On database:
MariaDB [database]> select * from ps_auths where id='107';
+-----+-----------+----------------+----------+----------+-------+----------+
| id  | auth_type | nonce_lifetime | md5_cred | password | realm | username |
+-----+-----------+----------------+----------+----------+-------+----------+
| 107 | userpass  |             32 |          | 123#456  |       | 107      |

MariaDB [database]> select * from ps_aors;
Empty set (0.001 sec)

Looking on mysql general log on request moment, I note that INSERT was prepared, but not executed on ps_aors like ps_auths was:

  • INSERT on ps_auths:
                    24 Prepare  INSERT INTO ps_auths (id, username, md5_cred, realm, auth_type, password, nonce_lifetime) VALUES (?, ?, ?, ?, ?, ?, ?)       
                    24 Execute  INSERT INTO ps_auths (id, username, md5_cred, realm, auth_type, password, nonce_lifetime) VALUES ('107', '107', '', '', 'userpass', '123#456', '32')
                    24 Reset stmt
                    24 Close stmt
  • INSERT on ps_aors:
                    24 Prepare  INSERT INTO ps_aors (id, minimum_expiration, default_expiration, qualify_timeout, mailboxes, support_path, voicemail_extension, max_contacts, authenticate_qualify, contact, maximum_expiration, qualify_frequency, remove_existing, outbound_proxy) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
                    24 Reset stmt
                    24 Close stmt
  • On Asterisk CLI:
159cafa0b520*CLI> pjsip show auth 107

  I/OAuth:  <AuthId/UserName.............................................................>
==========================================================================================

     Auth:  107/107

 ParameterName  : ParameterValue
 ===============================
 auth_type      : userpass
 md5_cred       :
 nonce_lifetime : 32
 password       : 123#456
 realm          :
 username       : 107

159cafa0b520*CLI> pjsip show aor 107

      Aor:  <Aor..............................................>  <MaxContact>
    Contact:  <Aor/ContactUri............................> <Hash....> <Status> <RTT(ms)..>
==========================================================================================

      Aor:  107                                                  1


 ParameterName        : ParameterValue
 =====================================
 authenticate_qualify : false
 contact              :
 default_expiration   : 3600
 mailboxes            :
 max_contacts         : 1
 maximum_expiration   : 7200
 minimum_expiration   : 60
 outbound_proxy       :
 qualify_frequency    : 0
 qualify_timeout      : 3.000000
 remove_existing      : true
 support_path         : true
 voicemail_extension  :

My config files:

root@159cafa0b520:/etc/asterisk# cat sorcery.conf 
[res_pjsip] ; Realtime PJSIP configuration wizard
endpoint=realtime,ps_endpoints
endpoint=config,pjsip.conf,criteria=type=endpoint
auth=realtime,ps_auths
aor=realtime,ps_aors
domain_alias=realtime,ps_domain_aliases
contact=realtime,ps_contacts

[res_pjsip_endpoint_identifier_ip]
identify=realtime,ps_endpoint_id_ips
root@159cafa0b520:/etc/asterisk# cat extconfig.conf 
[settings]
;sipusers => odbc,asterisk,sipusers
;sippeers => odbc,asterisk,sipusers
;sipregs => odbc,asterisk,sipusers
voicemail => odbc,asterisk,voicemail
queues => odbc,asterisk,queue_table
queue_members => odbc,asterisk,queue_member_table
ps_endpoints => odbc,asterisk
ps_auths => odbc,asterisk
ps_aors => odbc,asterisk
ps_domain_aliases => odbc,asterisk
ps_endpoint_id_ips => odbc,asterisk
ps_contacts => odbc,asterisk
root@159cafa0b520:/etc/asterisk# cat pjsip.conf 

[global]
type = global
user_agent = test

[transport-udp]
type = transport
protocol = udp
bind = 0.0.0.0:5080
external_media_address=localhost
external_signaling_address=localhost


[transport-wss]
type=transport
protocol=wss
bind=0.0.0.0
root@159cafa0b520:/etc/asterisk# cat ari.conf 
[general]
enabled = yes
pretty = yes
allowed_origins = localhost:8088,http://ari.asterisk.org

[asterisk]
type = user
read_only = no
password = asterisk

; password_format may be set to plain (the default) or crypt. When set to crypt,
; crypt(3) is used to validate the password. A crypted password can be generated
; using mkpasswd -m sha-512.
;
[asterisk-supersecret]
type = user
read_only = no
password = $6$nqvAB8Bvs1dJ4V$8zCUygFXuXXp8EU3t2M8i.N8iCsY4WRchxe2AYgGOzHAQrmjIPif3DYrvdj5U2CilLLMChtmFyvFa3XHSxBlB/
password_format = crypt

I discover that de field ‘support_path’ on ps_aors INSERT has the value ‘true’, but the table schema has an ENUM with ‘yes’ and ‘no’ values. After change ENUM to ‘yes’,‘no’,‘true’,‘false’ possible values tha objects was created successfully.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.