Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dbtext: presentity table issue with empty values #1017

Closed
ovidiusas opened this issue Jan 11, 2017 · 4 comments
Closed

dbtext: presentity table issue with empty values #1017

ovidiusas opened this issue Jan 11, 2017 · 4 comments
Milestone

Comments

@ovidiusas
Copy link
Member

The following fields from presentity table must accept empty/null values:

  • body
  • extra_hdrs
  • sender

In the dbtext file, the above fields should be defined as:

... body(blob,null) extra_hdrs(blob,null) sender(string,null)

The definition for body and extra_headers should be identical in ./db/schema/pr_presentity.xml
For regular presence stuff, extra_hdrs field will not be used and for sca (aka call-info) the body field will not be used.

@razvancrainea razvancrainea added this to the 2.3 milestone Jan 13, 2017
@razvancrainea
Copy link
Member

Hi, Ovidiu!

This looks somehow related to #1004. As documented there, MySQL does not allow a blob to have a default value. If we would set them to NULL, that ticket will also be fixed.
I was about to check if those extra_headers can and/or should be NULL, but didn't find the time yet. Did you manage to test this with NULL body and extra_headers?

Best regards,
Răzvan

@ovidiusas
Copy link
Member Author

Here's what works for sca with both db_text and db_mysql:

    <column>
        <name>body</name>
        <type>binary</type>
        <null/>
    </column>

    <column>
        <name>extra_hdrs</name>
        <type>binary</type>
        <null/>
    </column>

    <column id="sender">
        <name>sender</name>
        <type>string</type>
        <null/>
        <size>&uri_len;</size>
        <description>Sender contact</description>
    </column>

and this will create the fields in mysql like this:

    body BLOB,
    extra_hdrs BLOB,
    sender CHAR(128),

I can commit the changes if this is ok with everybody.

@razvancrainea
Copy link
Member

Yes, but I was asking from code pov: are the modules ok if they receive NULL values from the database engine?

@ovidiusas
Copy link
Member Author

I tested with NULL values in the table and it is working ok.
I tested with sca only. The code seems to check for NULL values.
I haven't tested with regular presence (which uses the body field and ignores extra_hdr field).
The presentity table is populated by the opensips (in other word not by hand), so this should work ok.

bogdan-iancu added a commit that referenced this issue Mar 15, 2017
Columns 'body', 'extra_hdrs' and 'sender' can be NULL and by default are NULL

Closes #1017
Closes #1004

(cherry picked from commit 90df400)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants