[asterisk-bugs] [JIRA] (ASTERISK-28747) YES/NO attributes are not set properly when creating PJSIP sorcery objects via ARI

Andrés Alonso (JIRA) noreply at issues.asterisk.org
Tue Feb 18 10:00:25 CST 2020


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

Andrés Alonso commented on ASTERISK-28747:
------------------------------------------

I was originally passing "yes" in the ARI call.
These are the steps I'm following:

1) ARI HTTP PUT request to create an aor. remove_existng is set to "yes"
{code}
curl -k -v -X PUT -u <USER:PASS> -H "Content-Type: application/json" -d '{"fields": [{"attribute": "max_contacts", "value": "1"}, {"attribute": "remove_existing", "value": "yes"}]}' https://<PBX_IP>:8089/ari/asterisk/config/dynamic/res_pjsip/aor/test
{code}
2) HTTP Response
{code}
< HTTP/1.1 200 OK
< Server: Asterisk
< Date: Tue, 18 Feb 2020 15:01:00 GMT
< Cache-Control: no-cache, no-store
< Content-type: application/json
< Content-Length: 828
<
[
  {
    "attribute": "minimum_expiration",
    "value": "60"
  },
  {
    "attribute": "default_expiration",
    "value": "3600"
  },
  {
    "attribute": "qualify_timeout",
    "value": "3.000000"
  },
  {
    "attribute": "mailboxes",
    "value": ""
  },
  {
    "attribute": "support_path",
    "value": "false"
  },
  {
    "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": ""
  }
]
{code}
See that remove_existing comes as "true" in the response

3) Check for the newly created PJSIP aor (_test_), {{pjsip show aor test}}
{code}
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      : false
 support_path         : false
 voicemail_extension  :
{code}
remove_existing is now "false"

4) Check the row created in mysql ps_aors table
{code}
+--------+---------+--------------------+-----------+--------------+--------------------+-----------------+-------------------+----------------------+
| id     | contact | default_expiration | mailboxes | max_contacts | minimum_expiration | remove_existing | qualify_frequency | ...
+--------+---------+--------------------+-----------+--------------+--------------------+-----------------+-------------------+----------------------+
| test |           |               3600 |           |            1 |                 60 |                 |                 0 |                      |
+--------+---------+--------------------+-----------+--------------+--------------------+-----------------+-------------------+----------------------+
{code}
remove_existing is empty 

Type definition of the column in mysql is {{enum('yes','no')}}

Passing "true" instead of "yes" in the request gives exactly the same result.

> YES/NO attributes are not set properly when creating PJSIP sorcery objects via ARI
> ----------------------------------------------------------------------------------
>
>                 Key: ASTERISK-28747
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-28747
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Core/AstDB, Core/Sorcery, Resources/res_ari
>    Affects Versions: 17.1.0
>         Environment: - CentOS release 7.7.1908 (Core) kernel 3.10.0-1062.4.3.el7.x86_64
> - mysql  Ver 15.1 Distrib 5.5.64-MariaDB
>            Reporter: Andrés Alonso
>            Assignee: Unassigned
>            Severity: Minor
>         Attachments: extconfig.conf, sorcery.conf
>
>
> When creating PJSIP object through the Sorcery API, *yes/no attributes* are not created according to the given payload data.
> For instance, creating an AOR object passing:
> * max_contacts=1
> * remove_existing=yes
> Request ends succesfully, but the resulting object has (pjsip show aor):
> * max_contacts: 1 (as expected)
> * remove_existing: *false*



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



More information about the asterisk-bugs mailing list