res_pjsip: convert configuration settings names to snake case some more
authorKevin Harwell <kharwell@digium.com>
Fri, 22 Nov 2013 22:37:30 +0000 (22:37 +0000)
committerKevin Harwell <kharwell@digium.com>
Fri, 22 Nov 2013 22:37:30 +0000 (22:37 +0000)
Updated the alembic script for pjsip.  Also, the dtls config parsing stuff was
expecting strings with no underscores, so removed the underscores from the
option name before passing it to the parser.
........

Merged revisions 403082 from http://svn.asterisk.org/svn/asterisk/branches/12

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@403083 65c4cc65-6c06-0410-ace0-fbb531ad65f3

contrib/ast-db-manage/config/versions/43956d550a44_add_tables_for_pjsip.py
res/res_pjsip/pjsip_configuration.c

index f74d936..2fabf7a 100755 (executable)
@@ -52,13 +52,13 @@ def upgrade():
         sa.Column('direct_media_glare_mitigation',
                   sa.Enum(*PJSIP_DIRECT_MEDIA_GLARE_MITIGATION_VALUES, name='pjsip_direct_media_glare_mitigation_values')),
         sa.Column('disable_direct_media_on_nat', sa.Enum(*YESNO_VALUES, name='yesno_values')),
-        sa.Column('dtmfmode', sa.Enum(*PJSIP_DTMF_MODE_VALUES, name='pjsip_dtmf_mode_values')),
+        sa.Column('dtmf_mode', sa.Enum(*PJSIP_DTMF_MODE_VALUES, name='pjsip_dtmf_mode_values')),
         sa.Column('external_media_address', sa.String(40)),
         sa.Column('force_rport', sa.Enum(*YESNO_VALUES, name='yesno_values')),
         sa.Column('ice_support', sa.Enum(*YESNO_VALUES, name='yesno_values')),
         sa.Column('identify_by', sa.Enum(*PJSIP_IDENTIFY_BY_VALUES, name='pjsip_identify_by_values')),
         sa.Column('mailboxes', sa.String(40)),
-        sa.Column('mohsuggest', sa.String(40)),
+        sa.Column('moh_suggest', sa.String(40)),
         sa.Column('outbound_auth', sa.String(40)),
         sa.Column('outbound_proxy', sa.String(40)),
         sa.Column('rewrite_contact', sa.Enum(*YESNO_VALUES, name='yesno_values')),
@@ -81,43 +81,43 @@ def upgrade():
         sa.Column('use_avpf', sa.Enum(*YESNO_VALUES, name='yesno_values')),
         sa.Column('media_encryption', sa.Enum(*PJSIP_MEDIA_ENCRYPTION_VALUES, name='pjsip_media_encryption_values')),
         sa.Column('inband_progress', sa.Enum(*YESNO_VALUES, name='yesno_values')),
-        sa.Column('callgroup', sa.String(40)),
-        sa.Column('pickupgroup', sa.String(40)),
-        sa.Column('namedcallgroup', sa.String(40)),
-        sa.Column('namedpickupgroup', sa.String(40)),
-        sa.Column('devicestate_busy_at', sa.Integer),
-        sa.Column('faxdetect', sa.Enum(*YESNO_VALUES, name='yesno_values')),
-        sa.Column('t38udptl', sa.Enum(*YESNO_VALUES, name='yesno_values')),
-        sa.Column('t38udptl_ec', sa.Enum(*PJSIP_T38UDPTL_EC_VALUES, name='pjsip_t38udptl_ec_values')),
-        sa.Column('t38udptl_maxdatagram', sa.Integer),
-        sa.Column('t38udptl_nat', sa.Enum(*YESNO_VALUES, name='yesno_values')),
-        sa.Column('t38udptl_ipv6', sa.Enum(*YESNO_VALUES, name='yesno_values')),
-        sa.Column('tonezone', sa.String(40)),
+        sa.Column('call_group', sa.String(40)),
+        sa.Column('pickup_group', sa.String(40)),
+        sa.Column('named_call_group', sa.String(40)),
+        sa.Column('named_pickup_group', sa.String(40)),
+        sa.Column('device_state_busy_at', sa.Integer),
+        sa.Column('fax_detect', sa.Enum(*YESNO_VALUES, name='yesno_values')),
+        sa.Column('t38_udptl', sa.Enum(*YESNO_VALUES, name='yesno_values')),
+        sa.Column('t38_udptl_ec', sa.Enum(*PJSIP_T38UDPTL_EC_VALUES, name='pjsip_t38udptl_ec_values')),
+        sa.Column('t38_udptl_maxdatagram', sa.Integer),
+        sa.Column('t38_udptl_nat', sa.Enum(*YESNO_VALUES, name='yesno_values')),
+        sa.Column('t38_udptl_ipv6', sa.Enum(*YESNO_VALUES, name='yesno_values')),
+        sa.Column('tone_zone', sa.String(40)),
         sa.Column('language', sa.String(40)),
         sa.Column('one_touch_recording', sa.Enum(*YESNO_VALUES, name='yesno_values')),
-        sa.Column('recordonfeature', sa.String(40)),
-        sa.Column('recordofffeature', sa.String(40)),
-        sa.Column('rtpengine', sa.String(40)),
-        sa.Column('allowtransfer', sa.Enum(*YESNO_VALUES, name='yesno_values')),
-        sa.Column('allowsubscribe', sa.Enum(*YESNO_VALUES, name='yesno_values')),
-        sa.Column('sdpowner', sa.String(40)),
-        sa.Column('sdpsession', sa.String(40)),
+        sa.Column('record_on_feature', sa.String(40)),
+        sa.Column('record_off_feature', sa.String(40)),
+        sa.Column('rtp_engine', sa.String(40)),
+        sa.Column('allow_transfer', sa.Enum(*YESNO_VALUES, name='yesno_values')),
+        sa.Column('allow_subscribe', sa.Enum(*YESNO_VALUES, name='yesno_values')),
+        sa.Column('sdp_owner', sa.String(40)),
+        sa.Column('sdp_session', sa.String(40)),
         sa.Column('tos_audio', sa.Integer),
         sa.Column('tos_video', sa.Integer),
         sa.Column('cos_audio', sa.Integer),
         sa.Column('cos_video', sa.Integer),
-        sa.Column('subminexpiry', sa.Integer),
-        sa.Column('fromdomain', sa.String(40)),
-        sa.Column('fromuser', sa.String(40)),
-        sa.Column('mwifromuser', sa.String(40)),
-        sa.Column('dtlsverify', sa.String(40)),
-        sa.Column('dtlsrekey', sa.String(40)),
-        sa.Column('dtlscertfile', sa.String(200)),
-        sa.Column('dtlsprivatekey', sa.String(200)),
-        sa.Column('dtlscipher', sa.String(200)),
-        sa.Column('dtlscafile', sa.String(200)),
-        sa.Column('dtlscapath', sa.String(200)),
-        sa.Column('dtlssetup', sa.Enum(*PJSIP_DTLS_SETUP_VALUES, name='pjsip_dtls_setup_values')),
+        sa.Column('sub_min_expiry', sa.Integer),
+        sa.Column('from_domain', sa.String(40)),
+        sa.Column('from_user', sa.String(40)),
+        sa.Column('mwi_fromuser', sa.String(40)),
+        sa.Column('dtls_verify', sa.String(40)),
+        sa.Column('dtls_rekey', sa.String(40)),
+        sa.Column('dtls_cert_file', sa.String(200)),
+        sa.Column('dtls_private_key', sa.String(200)),
+        sa.Column('dtls_cipher', sa.String(200)),
+        sa.Column('dtls_ca_file', sa.String(200)),
+        sa.Column('dtls_ca_path', sa.String(200)),
+        sa.Column('dtls_setup', sa.Enum(*PJSIP_DTLS_SETUP_VALUES, name='pjsip_dtls_setup_values')),
         sa.Column('srtp_tag_32', sa.Enum(*YESNO_VALUES, name='yesno_values')),
     )
 
index d382fef..d8e781a 100644 (file)
@@ -520,8 +520,19 @@ static int dtls_handler(const struct aco_option *opt,
                         struct ast_variable *var, void *obj)
 {
        struct ast_sip_endpoint *endpoint = obj;
+       char *name = ast_strdupa(var->name);
+       char *front, *buf = name;
 
-       return ast_rtp_dtls_cfg_parse(&endpoint->media.rtp.dtls_cfg, var->name, var->value);
+       /* strip out underscores in the name */
+       front = strtok(buf, "_");
+       while (front) {
+               int size = strlen(front);
+               ast_copy_string(buf, front, size + 1);
+               buf += size;
+               front = strtok(NULL, "_");
+       }
+
+       return ast_rtp_dtls_cfg_parse(&endpoint->media.rtp.dtls_cfg, name, var->value);
 }
 
 static int t38udptl_ec_handler(const struct aco_option *opt,