Uploaded image for project: 'FreeSWITCH'
  1. FreeSWITCH
  2. FS-11503

sofia_presence.c attempts to use an invalid concat mechanism on mysql

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: New
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 1.6.20
    • Fix Version/s: None
    • Component/s: mod_sofia
    • Labels:
      None
    • Environment:
      CentOS 7, mysql
    • CPU Architecture:
      x86-64
    • Kernel:
      Linux
    • Userland:
      GNU/Linux
    • Distribution:
      CentOS
    • Distribution Version:
      CentOS 7
    • lsb_release:
      Hide
      LSB Version: :core-4.1-amd64:core-4.1-noarch
      Show
      LSB Version: :core-4.1-amd64:core-4.1-noarch
    • Compiler:
      gcc
    • Compiler Version:
      4.8.5
    • FreeSWITCH GIT Revision:
      FreeSWITCH Version 1.6.20~64bit ( 64bit)
    • GIT Master Revision hash::
      FreeSWITCH Version 1.6.20~64bit ( 64bit)

      Description

      In sofia_presence.c there is a sql command in
      static void do_normal_probe(switch_event_t *event)
      that attempts to use a concat sequence that is not enabled in mysql/mariadb by default. The line in question reads

      "sip_dialogs.presence_id = sip_registrations.sip_user %q '@' %q sip_registrations.sub_host "

      and is substituted in the sprintf with switch_sql_concat(), switch_sql_concat(),. When this is run and the command is submitted to the mysql server, what it submits is the following

      sip_dialogs.presence_id = sip_registrations.sip_user || '@' || sip_registrations.sub_host

      If you run

      select sip_registrations.sip_user || '@' || sip_registrations.sub_host from sip_dialogs,sip_registrations limit 5;

      then mysql returns 5 lines saying "1" which is not the intended thing at all.

      To get mysql to recognise this syntax it is necessary to change the SQL_MODE using

      SET @@SQL_MODE = CONCAT(@@SQL_MODE, ',PIPES_AS_CONCAT');

      and now the example debug select works as designed as will the real thing that freeswitch executes. A grep of all freeswitch source doesn't seem to show it issuing anything like that.

        Attachments

          Activity

            People

            • Assignee:
              mikej Mike Jerris
              Reporter:
              TrevorH Trevor Hemsley
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: