[asterisk-bugs] [JIRA] (ASTERISK-30260) ari: Creation of outbound PJSIP registration fails

Thomas Guebels (JIRA) noreply at issues.asterisk.org
Mon Oct 10 05:47:08 CDT 2022


     [ https://issues.asterisk.org/jira/browse/ASTERISK-30260?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Thomas Guebels updated ASTERISK-30260:
--------------------------------------

    Attachment: registration_boolean_types.diff

Here is a patch that fixes the problem for the 3 fields listed in the description, by converting all of them to yes/no on the sorcery side.

Not sure if you would prefer that or to review the schema of all realtime tables.



> ari: Creation of outbound PJSIP registration fails
> --------------------------------------------------
>
>                 Key: ASTERISK-30260
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-30260
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Resources/res_pjsip_outbound_registration
>    Affects Versions: 18.14.0
>            Reporter: Thomas Guebels
>              Labels: patch
>         Attachments: registration_boolean_types.diff
>
>
> When creating an outbound registration using ARI push and using the realtime backend, some fields defined as OPT_BOOL_T in Sorcery make the database query fail.
> It seems there is a mismatch between the realtime database schema being ENUM(yes,no) and the Sorcery object definition.
> realtime ps_registrations:
> auth_rejection_permanent    | enum('yes','no') 
> support_path                | enum('yes','no') 
> line                        | enum('yes','no')
> res_pjsip_outbound_registration:
> ast_sorcery_object_field_register(ast_sip_get_sorcery(), "registration", "auth_rejection_permanent", "yes", OPT_BOOL_T, 1, FLDSET(struct sip_outbound_registration, auth_rejection_permanent));
> ast_sorcery_object_field_register(ast_sip_get_sorcery(), "registration", "support_path", "no", OPT_BOOL_T, 1, FLDSET(struct sip_outbound_registration, support_path));
> ast_sorcery_object_field_register(ast_sip_get_sorcery(), "registration", "line", "no", OPT_BOOL_T, 1, FLDSET(struct sip_outbound_registration, line));
> When making the following request: PUT  '{ "fields": [ {"attribute" : "auth_rejection_permanent", "value" : "no" } }'
> We can see in the log that the value is converted to a boolean by sorcery:
> DEBUG[2320092] res_config_odbc.c: Parameter 3 ('auth_rejection_permanent') = 'false'
> Which then fails to be inserted in the table field:
> WARNING[2320092] res_odbc.c: SQL Execute returned an error: Data truncated for column 'auth_rejection_permanent' at row 1
> WARNING[2320092] res_odbc.c: SQL Execute error -1!



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



More information about the asterisk-bugs mailing list