<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[Freeswitch-trunk][15030] </title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<div id="header">FreeSWITCH Subversion</div>
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://fisheye.freeswitch.org/changelog/FreeSWITCH?cs=15030">15030</a></dd>
<dt>Author</dt> <dd>gmaruzz</dd>
<dt>Date</dt> <dd>2009-10-01 06:20:48 -0500 (Thu, 01 Oct 2009)</dd>
</dl>
<h3>Log Message</h3>
<pre>celliax: added setmixers, a script that sets the audio levels for GSMopen interfaces</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#freeswitchbranchesgmaruzzmod_celliaxmod_celliaxc">freeswitch/branches/gmaruzz/mod_celliax/mod_celliax.c</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="freeswitchbranchesgmaruzzmod_celliaxmod_celliaxc"></a>
<div class="modfile"><h4>Modified: freeswitch/branches/gmaruzz/mod_celliax/mod_celliax.c (15029 => 15030)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/branches/gmaruzz/mod_celliax/mod_celliax.c        2009-10-01 00:45:17 UTC (rev 15029)
+++ freeswitch/branches/gmaruzz/mod_celliax/mod_celliax.c        2009-10-01 11:20:48 UTC (rev 15030)
</span><span class="lines">@@ -1104,6 +1104,8 @@
</span><span class="cx"> *
</span><span class="cx"> */
</span><span class="cx"> /* BEGIN: Changes heres */
</span><ins>+
+
</ins><span class="cx"> static switch_status_t load_config(int reload_type)
</span><span class="cx"> /* END: Changes heres */
</span><span class="cx"> {
</span><span class="lines">@@ -1142,6 +1144,1331 @@
</span><span class="cx">                                 set_global_context(val);
</span><span class="cx">                                 DEBUGA_CELLIAX("globals.context=%s\n", CELLIAX_P_LOG, globals.context);
</span><span class="cx">
</span><ins>+                        }
+
+                }
+        }
+
+        if ((interfaces = switch_xml_child(cfg, "per_interface_settings"))) {
+                int i = 0;
+
+                for (myinterface = switch_xml_child(interfaces, "interface"); myinterface; myinterface = myinterface->next) {
+                        char *id = (char *) switch_xml_attr(myinterface, "id");
+                        char *name = (char *) switch_xml_attr(myinterface, "name");
+                        char *context = "default";
+                        char *dialplan = "XML";
+                        char *destination = "5000";
+                        char *controldevice_name = "/dev/ttyACM0";
+                        char *digit_timeout = NULL;
+                        char *max_digits = NULL;
+                        char *hotline = NULL;
+                        char *dial_regex = NULL;
+                        char *hold_music = NULL;
+                        char *fail_dial_regex = NULL;
+                        char *enable_callerid = "true";
+
+
+                        char *at_dial_pre_number= "ATD";
+                        char *at_dial_post_number= ";";
+                        char *at_dial_expect= "OK";
+                        char *at_hangup= "ATH";
+                        char *at_hangup_expect= "OK";
+                        char *at_answer= "ATA";
+                        char *at_answer_expect= "OK";
+                        char *at_send_dtmf= "AT+VTS";
+                        char *at_preinit_1= "";
+                        char *at_preinit_1_expect= "";
+                        char *at_preinit_2= "";
+                        char *at_preinit_2_expect= "";
+                        char *at_preinit_3= "";
+                        char *at_preinit_3_expect= "";
+                        char *at_preinit_4= "";
+                        char *at_preinit_4_expect= "";
+                        char *at_preinit_5= "";
+                        char *at_preinit_5_expect= "";
+                        char *at_postinit_1= "at+cmic=0,9";
+                        char *at_postinit_1_expect= "OK";
+                        char *at_postinit_2= "AT+CKPD=\"EEE\"";
+                        char *at_postinit_2_expect= "OK";
+                        char *at_postinit_3= "AT+CSSN=1,0";
+                        char *at_postinit_3_expect= "OK";
+                        char *at_postinit_4= "at+sidet=0";
+                        char *at_postinit_4_expect= "OK";
+                        char *at_postinit_5= "at+clvl=99";
+                        char *at_postinit_5_expect= "OK";
+                        char *at_query_battchg= "AT+CBC";
+                        char *at_query_battchg_expect= "OK";
+                        char *at_query_signal= "AT+CSQ";
+                        char *at_query_signal_expect= "OK";
+                        char *at_call_idle= "+MCST: 1";
+                        char *at_call_incoming= "+MCST: 2";
+                        char *at_call_active= "+CSSI: 7";
+                        char *at_call_failed= "+MCST: 65";
+                        char *at_call_calling= "+CSSI: 1";
+                        char *at_indicator_noservice_string= "CIEV: 2;0";
+                        char *at_indicator_nosignal_string= "CIEV: 5;0";
+                        char *at_indicator_lowsignal_string= "CIEV: 5;1";
+                        char *at_indicator_lowbattchg_string= "CIEV: 0;1";
+                        char *at_indicator_nobattchg_string= "CIEV: 0;0";
+                        char *at_indicator_callactive_string= "CIEV: 3;1";
+                        char *at_indicator_nocallactive_string= "CIEV: 3;0";
+                        char *at_indicator_nocallsetup_string= "CIEV: 6;0";
+                        char *at_indicator_callsetupincoming_string= "CIEV: 6;1";
+                        char *at_indicator_callsetupoutgoing_string= "CIEV: 6;2";
+                        char *at_indicator_callsetupremoteringing_string= "CIEV: 6;3";
+                        char *sms_receiving_program= "/usr/local/bin/ciapalo";
+                        char *alsacname= "plughw:1";
+                        char *alsapname= "plughw:1";
+
+                        uint32_t interface_id = 0, to = 0, max = 0;
+                        uint32_t controldevice_speed = B115200;
+                        uint32_t controldevprotocol = PROTOCOL_AT;
+                        uint32_t running =1;
+                        uint32_t at_early_audio =0;
+                        uint32_t at_after_preinit_pause=500000;
+                        uint32_t at_initial_pause=500000;
+                        uint32_t at_has_clcc=0;
+                        uint32_t at_has_ecam=0;
+                        uint32_t alsa_period_size=160;
+                        uint32_t alsa_periods_in_buffer=4;
+                        uint32_t celliax_sound_rate=8000;
+                        uint32_t alsa_play_is_mono=1;
+                        uint32_t alsa_capture_is_mono=1;
+                        uint32_t capture_boost=5;
+                        uint32_t playback_boost=10;
+
+
+                        tech_pvt = NULL;
+
+                        for (param = switch_xml_child(myinterface, "param"); param; param = param->next) {
+                                char *var = (char *) switch_xml_attr_soft(param, "name");
+                                char *val = (char *) switch_xml_attr_soft(param, "value");
+
+                                if (!strcasecmp(var, "id")) {
+                                        id = val;
+                                } else if (!strcasecmp(var, "name")) {
+                                        name = val;
+                                } else if (!strcasecmp(var, "context")) {
+                                        context = val;
+                                } else if (!strcasecmp(var, "dialplan")) {
+                                        dialplan = val;
+                                } else if (!strcasecmp(var, "destination")) {
+                                        destination = val;
+                                } else if (!strcasecmp(var, "controldevice_name")) {
+                                        controldevice_name = val;
+                                } else if (!strcasecmp(var, "digit_timeout")) {
+                                        digit_timeout = val;
+                                } else if (!strcasecmp(var, "max_digits")) {
+                                        max_digits = val;
+                                } else if (!strcasecmp(var, "hotline")) {
+                                        hotline = val;
+                                } else if (!strcasecmp(var, "dial_regex")) {
+                                        dial_regex = val;
+                                } else if (!strcasecmp(var, "hold_music")) {
+                                        hold_music = val;
+                                } else if (!strcasecmp(var, "fail_dial_regex")) {
+                                        fail_dial_regex = val;
+                                } else if (!strcasecmp(var, "enable_callerid")) {
+                                        enable_callerid = val;
+                                } else if (!strcasecmp(var, "at_dial_pre_number")) {
+                                        at_dial_pre_number = val;
+                                } else if (!strcasecmp(var, "at_dial_post_number")) {
+                                        at_dial_post_number = val;
+                                } else if (!strcasecmp(var, "at_dial_expect")) {
+                                        at_dial_expect = val;
+                                } else if (!strcasecmp(var, "at_hangup")) {
+                                        at_hangup = val;
+                                } else if (!strcasecmp(var, "at_hangup_expect")) {
+                                        at_hangup_expect = val;
+                                } else if (!strcasecmp(var, "at_answer")) {
+                                        at_answer = val;
+                                } else if (!strcasecmp(var, "at_answer_expect")) {
+                                        at_answer_expect = val;
+                                } else if (!strcasecmp(var, "at_send_dtmf")) {
+                                        at_send_dtmf = val;
+                                } else if (!strcasecmp(var, "at_preinit_1")) {
+                                        at_preinit_1 = val;
+                                } else if (!strcasecmp(var, "at_preinit_1_expect")) {
+                                        at_preinit_1_expect = val;
+                                } else if (!strcasecmp(var, "at_preinit_2")) {
+                                        at_preinit_2 = val;
+                                } else if (!strcasecmp(var, "at_preinit_2_expect")) {
+                                        at_preinit_2_expect = val;
+                                } else if (!strcasecmp(var, "at_preinit_3")) {
+                                        at_preinit_3 = val;
+                                } else if (!strcasecmp(var, "at_preinit_3_expect")) {
+                                        at_preinit_3_expect = val;
+                                } else if (!strcasecmp(var, "at_preinit_4")) {
+                                        at_preinit_4 = val;
+                                } else if (!strcasecmp(var, "at_preinit_4_expect")) {
+                                        at_preinit_4_expect = val;
+                                } else if (!strcasecmp(var, "at_preinit_5")) {
+                                        at_preinit_5 = val;
+                                } else if (!strcasecmp(var, "at_preinit_5_expect")) {
+                                        at_preinit_5_expect = val;
+                                } else if (!strcasecmp(var, "at_postinit_1")) {
+                                        at_postinit_1 = val;
+                                } else if (!strcasecmp(var, "at_postinit_1_expect")) {
+                                        at_postinit_1_expect = val;
+                                } else if (!strcasecmp(var, "at_postinit_2")) {
+                                        at_postinit_2 = val;
+                                } else if (!strcasecmp(var, "at_postinit_2_expect")) {
+                                        at_postinit_2_expect = val;
+                                } else if (!strcasecmp(var, "at_postinit_3")) {
+                                        at_postinit_3 = val;
+                                } else if (!strcasecmp(var, "at_postinit_3_expect")) {
+                                        at_postinit_3_expect = val;
+                                } else if (!strcasecmp(var, "at_postinit_4")) {
+                                        at_postinit_4 = val;
+                                } else if (!strcasecmp(var, "at_postinit_4_expect")) {
+                                        at_postinit_4_expect = val;
+                                } else if (!strcasecmp(var, "at_postinit_5")) {
+                                        at_postinit_5 = val;
+                                } else if (!strcasecmp(var, "at_postinit_5_expect")) {
+                                        at_postinit_5_expect = val;
+                                } else if (!strcasecmp(var, "at_query_battchg")) {
+                                        at_query_battchg = val;
+                                } else if (!strcasecmp(var, "at_query_battchg_expect")) {
+                                        at_query_battchg_expect = val;
+                                } else if (!strcasecmp(var, "at_query_signal")) {
+                                        at_query_signal = val;
+                                } else if (!strcasecmp(var, "at_query_signal_expect")) {
+                                        at_query_signal_expect = val;
+                                } else if (!strcasecmp(var, "at_call_idle")) {
+                                        at_call_idle = val;
+                                } else if (!strcasecmp(var, "at_call_incoming")) {
+                                        at_call_incoming = val;
+                                } else if (!strcasecmp(var, "at_call_active")) {
+                                        at_call_active = val;
+                                } else if (!strcasecmp(var, "at_call_failed")) {
+                                        at_call_failed = val;
+                                } else if (!strcasecmp(var, "at_call_calling")) {
+                                        at_call_calling = val;
+                                } else if (!strcasecmp(var, "at_indicator_noservice_string")) {
+                                        at_indicator_noservice_string = val;
+                                } else if (!strcasecmp(var, "at_indicator_nosignal_string")) {
+                                        at_indicator_nosignal_string = val;
+                                } else if (!strcasecmp(var, "at_indicator_lowsignal_string")) {
+                                        at_indicator_lowsignal_string = val;
+                                } else if (!strcasecmp(var, "at_indicator_lowbattchg_string")) {
+                                        at_indicator_lowbattchg_string = val;
+                                } else if (!strcasecmp(var, "at_indicator_nobattchg_string")) {
+                                        at_indicator_nobattchg_string = val;
+                                } else if (!strcasecmp(var, "at_indicator_callactive_string")) {
+                                        at_indicator_callactive_string = val;
+                                } else if (!strcasecmp(var, "at_indicator_nocallactive_string")) {
+                                        at_indicator_nocallactive_string = val;
+                                } else if (!strcasecmp(var, "at_indicator_nocallsetup_string")) {
+                                        at_indicator_nocallsetup_string = val;
+                                } else if (!strcasecmp(var, "at_indicator_callsetupincoming_string")) {
+                                        at_indicator_callsetupincoming_string = val;
+                                } else if (!strcasecmp(var, "at_indicator_callsetupoutgoing_string")) {
+                                        at_indicator_callsetupoutgoing_string = val;
+                                } else if (!strcasecmp(var, "at_indicator_callsetupremoteringing_string")) {
+                                        at_indicator_callsetupremoteringing_string = val;
+                                } else if (!strcasecmp(var, "sms_receiving_program")) {
+                                        sms_receiving_program = val;
+                                } else if (!strcasecmp(var, "alsacname")) {
+                                        alsacname = val;
+                                } else if (!strcasecmp(var, "alsapname")) {
+                                        alsapname = val;
+
+#ifdef NOT_NUMBERS_NOW
+                                        interface_id
+                                                controldevice_speed
+                                                controldevprotocol
+                                                at_early_audio
+                                                at_after_preinit_pause
+                                                at_initial_pause
+                                                at_has_clcc
+                                                at_has_ecam
+                                                alsa_period_size
+                                                alsa_periods_in_buffer
+                                                celliax_sound_rate
+                                                alsa_play_is_mono
+                                                alsa_capture_is_mono
+                                                capture_boost
+                                                playback_boost
+#endif// NOT_NUMBERS_NOW
+
+
+                                }
+
+                        }
+
+                        /* BEGIN: Changes here */
+                        if (reload_type == SOFT_RELOAD) {
+                                char the_interface[256];
+                                sprintf(the_interface, "#%s", name);
+
+                                if (interface_exists(the_interface) == SWITCH_STATUS_SUCCESS) {
+                                        continue;
+                                }
+                        }
+                        /* END: Changes here */
+
+                        if (!id) {
+                                ERRORA("interface missing REQUIRED param 'id'\n", CELLIAX_P_LOG);
+                                continue;
+                        }
+                        if (switch_is_number(id)) {
+                                interface_id = atoi(id);
+                                DEBUGA_CELLIAX("interface_id=%d\n", CELLIAX_P_LOG, interface_id);
+                        } else {
+                                ERRORA("interface param 'id' MUST be a number, now id='%s'\n", CELLIAX_P_LOG, id);
+                                continue;
+                        }
+
+                        if (!name) {
+                                WARNINGA("interface missing param 'name', not nice, but works\n", CELLIAX_P_LOG);
+                        }
+
+                        if (digit_timeout) {
+                                to = atoi(digit_timeout);
+                        }
+
+                        if (max_digits) {
+                                max = atoi(max_digits);
+                        }
+
+                        if (name) {
+                                DEBUGA_CELLIAX("name=%s\n", CELLIAX_P_LOG, name);
+                        }
+                        if (interface_id && interface_id < CELLIAX_MAX_INTERFACES) {
+                                private_t newconf;
+                                switch_threadattr_t *celliax_api_thread_attr = NULL;
+
+                                memset(&newconf, '\0', sizeof(newconf));
+                                globals.CELLIAX_INTERFACES[interface_id] = newconf;
+
+
+                                tech_pvt = &globals.CELLIAX_INTERFACES[interface_id];
+
+                                switch_mutex_init(&globals.CELLIAX_INTERFACES[interface_id].controldev_lock, SWITCH_MUTEX_NESTED, celliax_module_pool);
+
+
+                                //FIXME switch_set_string(globals.CELLIAX_INTERFACES[interface_id].id , id );
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].name , name );
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].context , context );
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].dialplan , dialplan );
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].destination , destination );
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].controldevice_name , controldevice_name );
+                                //FIXME switch_set_string(globals.CELLIAX_INTERFACES[interface_id].digit_timeout , digit_timeout );
+                                //FIXME switch_set_string(globals.CELLIAX_INTERFACES[interface_id].max_digits , max_digits );
+                                //FIXME switch_set_string(globals.CELLIAX_INTERFACES[interface_id].hotline , hotline );
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].dial_regex , dial_regex );
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].hold_music , hold_music );
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].fail_dial_regex , fail_dial_regex );
+                                //FIXME switch_set_string(globals.CELLIAX_INTERFACES[interface_id].enable_callerid , enable_callerid );
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_dial_pre_number, at_dial_pre_number);
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_dial_post_number, at_dial_post_number);
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_dial_expect, at_dial_expect);
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_hangup, at_hangup);
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_hangup_expect, at_hangup_expect);
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_answer, at_answer);
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_answer_expect, at_answer_expect);
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_send_dtmf, at_send_dtmf);
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_preinit_1, at_preinit_1);
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_preinit_1_expect, at_preinit_1_expect);
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_preinit_2, at_preinit_2);
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_preinit_2_expect, at_preinit_2_expect);
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_preinit_3, at_preinit_3);
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_preinit_3_expect, at_preinit_3_expect);
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_preinit_4, at_preinit_4);
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_preinit_4_expect, at_preinit_4_expect);
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_preinit_5, at_preinit_5);
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_preinit_5_expect, at_preinit_5_expect);
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_postinit_1, at_postinit_1);
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_postinit_1_expect, at_postinit_1_expect);
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_postinit_2, at_postinit_2);
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_postinit_2_expect, at_postinit_2_expect);
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_postinit_3, at_postinit_3);
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_postinit_3_expect, at_postinit_3_expect);
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_postinit_4, at_postinit_4);
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_postinit_4_expect, at_postinit_4_expect);
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_postinit_5, at_postinit_5);
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_postinit_5_expect, at_postinit_5_expect);
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_query_battchg, at_query_battchg);
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_query_battchg_expect, at_query_battchg_expect);
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_query_signal, at_query_signal);
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_query_signal_expect, at_query_signal_expect);
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_call_idle, at_call_idle);
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_call_incoming, at_call_incoming);
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_call_active, at_call_active);
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_call_failed, at_call_failed);
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_call_calling, at_call_calling);
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_noservice_string, at_indicator_noservice_string);
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_nosignal_string, at_indicator_nosignal_string);
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_lowsignal_string, at_indicator_lowsignal_string);
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_lowbattchg_string, at_indicator_lowbattchg_string);
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_nobattchg_string, at_indicator_nobattchg_string);
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_callactive_string, at_indicator_callactive_string);
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_nocallactive_string, at_indicator_nocallactive_string);
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_nocallsetup_string, at_indicator_nocallsetup_string);
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_callsetupincoming_string, at_indicator_callsetupincoming_string);
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_callsetupoutgoing_string, at_indicator_callsetupoutgoing_string);
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_callsetupremoteringing_string, at_indicator_callsetupremoteringing_string);
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].sms_receiving_program, sms_receiving_program);
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].alsacname, alsacname);
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].alsapname, alsapname);
+
+
+#ifdef NOTDEF
+                                if (name) {
+                                        switch_set_string(globals.CELLIAX_INTERFACES[interface_id].name, name);
+                                } else {
+                                        switch_set_string(globals.CELLIAX_INTERFACES[interface_id].name, "N/A");
+                                }
+                                DEBUGA_CELLIAX("CONFIGURING interface_id=%d name=%s\n", CELLIAX_P_LOG, interface_id, name);
+
+                                switch_mutex_init(&globals.CELLIAX_INTERFACES[interface_id].controldev_lock, SWITCH_MUTEX_NESTED, celliax_module_pool);
+
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].interface_id, id);
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].context, context);
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].dialplan, dialplan);
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].destination, destination);
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].controldevice_name, controldevice_name);
+
+                                globals.CELLIAX_INTERFACES[interface_id].controldevice_speed = controldevice_speed;
+                                globals.CELLIAX_INTERFACES[interface_id].controldevprotocol = controldevprotocol;
+                                globals.CELLIAX_INTERFACES[interface_id].running = 1;
+                                globals.CELLIAX_INTERFACES[interface_id].at_early_audio = 0;
+                                globals.CELLIAX_INTERFACES[interface_id].at_after_preinit_pause = 500000;
+                                globals.CELLIAX_INTERFACES[interface_id].at_initial_pause = 500000;
+                                globals.CELLIAX_INTERFACES[interface_id].at_has_clcc = 0;
+                                globals.CELLIAX_INTERFACES[interface_id].at_has_ecam = 0;
+                                globals.CELLIAX_INTERFACES[interface_id].alsa_period_size = 160;
+                                globals.CELLIAX_INTERFACES[interface_id].alsa_periods_in_buffer = 4;
+                                globals.CELLIAX_INTERFACES[interface_id].celliax_sound_rate = 8000;
+                                globals.CELLIAX_INTERFACES[interface_id].alsa_play_is_mono = 1;
+                                globals.CELLIAX_INTERFACES[interface_id].alsa_capture_is_mono = 1;
+                                globals.CELLIAX_INTERFACES[interface_id].capture_boost = 0;
+                                globals.CELLIAX_INTERFACES[interface_id].playback_boost = 0;
+
+
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_dial_pre_number, "ATD");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_dial_post_number, ";");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_dial_expect, "OK");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_hangup, "ATH");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_hangup_expect, "OK");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_answer, "ATA");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_answer_expect, "OK");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_send_dtmf, "AT+VTS");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_preinit_1, "");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_preinit_1_expect, "");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_preinit_2, "");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_preinit_2_expect, "");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_preinit_3, "");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_preinit_3_expect, "");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_preinit_4, "");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_preinit_4_expect, "");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_preinit_5, "");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_preinit_5_expect, "");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_postinit_1, "at+cmic=0,9");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_postinit_1_expect, "OK");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_postinit_2, "AT+CKPD=\"EEE\"");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_postinit_2_expect, "OK");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_postinit_3, "AT+CSSN=1,0");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_postinit_3_expect, "OK");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_postinit_4, "at+sidet=0");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_postinit_4_expect, "OK");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_postinit_5, "at+clvl=99");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_postinit_5_expect, "OK");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_query_battchg, "AT+CBC");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_query_battchg_expect, "OK");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_query_signal, "AT+CSQ");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_query_signal_expect, "OK");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_call_idle, "+MCST: 1");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_call_incoming, "+MCST: 2");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_call_active, "+CSSI: 7");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_call_failed, "+MCST: 65");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_call_calling, "+CSSI: 1");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_noservice_string, "CIEV: 2;0");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_nosignal_string, "CIEV: 5;0");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_lowsignal_string, "CIEV: 5;1");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_lowbattchg_string, "CIEV: 0;1");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_nobattchg_string, "CIEV: 0;0");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_callactive_string, "CIEV: 3;1");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_nocallactive_string, "CIEV: 3;0");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_nocallsetup_string, "CIEV: 6;0");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_callsetupincoming_string, "CIEV: 6;1");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_callsetupoutgoing_string, "CIEV: 6;2");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_callsetupremoteringing_string, "CIEV: 6;3");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].sms_receiving_program, "/usr/local/bin/ciapalo");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].alsacname, "plughw:1");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].alsapname, "plughw:1");
+#endif//NOTDEF
+
+
+
+                                globals.CELLIAX_INTERFACES[interface_id].controldevice_speed = controldevice_speed;
+                                globals.CELLIAX_INTERFACES[interface_id].controldevprotocol = controldevprotocol;
+                                globals.CELLIAX_INTERFACES[interface_id].at_early_audio = at_early_audio;
+                                globals.CELLIAX_INTERFACES[interface_id].at_after_preinit_pause = at_after_preinit_pause;
+                                globals.CELLIAX_INTERFACES[interface_id].at_initial_pause = at_initial_pause;
+                                globals.CELLIAX_INTERFACES[interface_id].at_has_clcc = at_has_clcc;
+                                globals.CELLIAX_INTERFACES[interface_id].at_has_ecam = at_has_ecam;
+                                globals.CELLIAX_INTERFACES[interface_id].alsa_period_size = alsa_period_size;
+                                globals.CELLIAX_INTERFACES[interface_id].alsa_periods_in_buffer = alsa_periods_in_buffer;
+                                globals.CELLIAX_INTERFACES[interface_id].celliax_sound_rate = celliax_sound_rate;
+                                globals.CELLIAX_INTERFACES[interface_id].alsa_play_is_mono = alsa_play_is_mono;
+                                globals.CELLIAX_INTERFACES[interface_id].alsa_capture_is_mono = alsa_capture_is_mono;
+                                globals.CELLIAX_INTERFACES[interface_id].capture_boost = capture_boost;
+                                globals.CELLIAX_INTERFACES[interface_id].playback_boost = playback_boost;
+                                globals.CELLIAX_INTERFACES[interface_id].running = running; //FIXME
+
+                                celliax_store_boost("5", &globals.CELLIAX_INTERFACES[interface_id].capture_boost); //FIXME
+                                celliax_store_boost("10", &globals.CELLIAX_INTERFACES[interface_id].playback_boost); //FIXME
+
+
+                                DEBUGA_CELLIAX("interface_id=%d globals.CELLIAX_INTERFACES[interface_id].name=%s\n",
+                                                CELLIAX_P_LOG, interface_id, globals.CELLIAX_INTERFACES[interface_id].name);
+                                DEBUGA_CELLIAX
+                                        ("interface_id=%d globals.CELLIAX_INTERFACES[interface_id].dialplan=%s\n",
+                                         CELLIAX_P_LOG, interface_id, globals.CELLIAX_INTERFACES[interface_id].dialplan);
+                                DEBUGA_CELLIAX
+                                        ("interface_id=%d globals.CELLIAX_INTERFACES[interface_id].destination=%s\n",
+                                         CELLIAX_P_LOG, interface_id, globals.CELLIAX_INTERFACES[interface_id].destination);
+                                DEBUGA_CELLIAX
+                                        ("interface_id=%d globals.CELLIAX_INTERFACES[interface_id].context=%s\n",
+                                         CELLIAX_P_LOG, interface_id, globals.CELLIAX_INTERFACES[interface_id].context);
+                                WARNINGA("STARTING interface_id=%d\n", CELLIAX_P_LOG, interface_id);
+
+                                int res = 0;
+
+                                /* init the serial port */
+                                if (globals.CELLIAX_INTERFACES[interface_id].controldevprotocol != PROTOCOL_NO_SERIAL) {
+                                        globals.CELLIAX_INTERFACES[interface_id].controldevfd =
+                                                celliax_serial_init(&globals.CELLIAX_INTERFACES[interface_id], globals.CELLIAX_INTERFACES[interface_id].controldevice_speed);
+                                        if (globals.CELLIAX_INTERFACES[interface_id].controldevfd < 1) {
+                                                ERRORA("celliax_serial_init failed\n", CELLIAX_P_LOG);
+                                                return SWITCH_STATUS_FALSE;
+                                                //celliax_sound_shutdown(tmp);
+                                                //if (tmp)
+                                                //free(tmp);
+                                                //return NULL;
+                                        }
+                                }
+
+                                /* config the phone/modem on the serial port */
+                                if (globals.CELLIAX_INTERFACES[interface_id].controldevprotocol != PROTOCOL_NO_SERIAL) {
+                                        //int res;
+                                        res = celliax_serial_config(&globals.CELLIAX_INTERFACES[interface_id]);
+                                        if (res) {
+                                                ERRORA("celliax_serial_config failed\n", CELLIAX_P_LOG);
+                                                return SWITCH_STATUS_FALSE;
+                                                //celliax_sound_shutdown(tmp);
+                                                //if (tmp)
+                                                //free(tmp);
+                                                //return NULL;
+                                        }
+                                }
+
+
+                                switch_sleep(100000);
+                                switch_threadattr_create(&celliax_api_thread_attr, celliax_module_pool);
+                                switch_threadattr_stacksize_set(celliax_api_thread_attr, SWITCH_THREAD_STACKSIZE);
+                                switch_thread_create(&globals.CELLIAX_INTERFACES[interface_id].celliax_api_thread, celliax_api_thread_attr, celliax_do_celliaxapi_thread,
+                                                &globals.CELLIAX_INTERFACES[interface_id], celliax_module_pool);
+
+                                switch_sleep(100000);
+
+                        } else {
+                                ERRORA("interface id %d is higher than CELLIAX_MAX_INTERFACES (%d)\n", CELLIAX_P_LOG, interface_id, CELLIAX_MAX_INTERFACES);
+                                continue;
+                        }
+
+                }
+
+                for (i = 0; i < CELLIAX_MAX_INTERFACES; i++) {
+                        if (strlen(globals.CELLIAX_INTERFACES[i].name)) {
+                                /* How many real intterfaces */
+                                globals.real_interfaces = i + 1;
+
+                                tech_pvt = &globals.CELLIAX_INTERFACES[i];
+
+                                DEBUGA_CELLIAX("i=%d globals.CELLIAX_INTERFACES[%d].interface_id=%s\n", CELLIAX_P_LOG, i, i, globals.CELLIAX_INTERFACES[i].interface_id);
+                                DEBUGA_CELLIAX("i=%d globals.CELLIAX_INTERFACES[%d].name=%s\n", CELLIAX_P_LOG, i, i, globals.CELLIAX_INTERFACES[i].name);
+                                DEBUGA_CELLIAX("i=%d globals.CELLIAX_INTERFACES[%d].context=%s\n", CELLIAX_P_LOG, i, i, globals.CELLIAX_INTERFACES[i].context);
+                                DEBUGA_CELLIAX("i=%d globals.CELLIAX_INTERFACES[%d].dialplan=%s\n", CELLIAX_P_LOG, i, i, globals.CELLIAX_INTERFACES[i].dialplan);
+                                DEBUGA_CELLIAX("i=%d globals.CELLIAX_INTERFACES[%d].destination=%s\n", CELLIAX_P_LOG, i, i, globals.CELLIAX_INTERFACES[i].destination);
+                        }
+                }
+        }
+
+        switch_mutex_unlock(globals.mutex);
+        switch_xml_free(xml);
+
+        return SWITCH_STATUS_SUCCESS;
+}
+#ifdef NOTDEF
+                                } else if (!strcasecmp(var, "context")) {
+                                        context = val;
+                                } else if (!strcasecmp(var, "dialplan")) {
+                                        dialplan = val;
+                                } else if (!strcasecmp(var, "destination")) {
+                                        destination = val;
+                                } else if (!strcasecmp(var, "dial-regex")) {
+                                        dial_regex = val;
+                                } else if (!strcasecmp(var, "enable-callerid")) {
+                                        enable_callerid = val;
+                                } else if (!strcasecmp(var, "fail-dial-regex")) {
+                                        fail_dial_regex = val;
+                                } else if (!strcasecmp(var, "hold-music")) {
+                                        hold_music = val;
+                                } else if (!strcasecmp(var, "max_digits") || !strcasecmp(var, "max-digits")) {
+                                        max_digits = val;
+                                } else if (!strcasecmp(var, "hotline")) {
+                                        hotline = val;
+
+
+                        id
+                        name
+                        context
+                        dialplan
+                        destination
+                        controldevice_name
+                        digit_timeout
+                        max_digits
+                        hotline
+                        dial_regex
+                        hold_music
+                        fail_dial_regex
+                        enable_callerid
+
+
+                        at_dial_pre_number
+                        at_dial_post_number
+                        at_dial_expect
+                        at_hangup
+                        at_hangup_expect
+                        at_answer
+                        at_answer_expect
+                        at_send_dtmf
+                        at_preinit_1
+                        at_preinit_1_expect
+                        at_preinit_2
+                        at_preinit_2_expect
+                        at_preinit_3
+                        at_preinit_3_expect
+                        at_preinit_4
+                        at_preinit_4_expect
+                        at_preinit_5
+                        at_preinit_5_expect
+                        at_postinit_1
+                        at_postinit_1_expect
+                        at_postinit_2
+                        at_postinit_2_expect
+                        at_postinit_3
+                        at_postinit_3_expect
+                        at_postinit_4
+                        at_postinit_4_expect
+                        at_postinit_5
+                        at_postinit_5_expect
+                        at_query_battchg
+                        at_query_battchg_expect
+                        at_query_signal
+                        at_query_signal_expect
+                        at_call_idle
+                        at_call_incoming
+                        at_call_active
+                        at_call_failed
+                        at_call_calling
+                        at_indicator_noservice_string
+                        at_indicator_nosignal_string
+                        at_indicator_lowsignal_string
+                        at_indicator_lowbattchg_string
+                        at_indicator_nobattchg_string
+                        at_indicator_callactive_string
+                        at_indicator_nocallactive_string
+                        at_indicator_nocallsetup_string
+                        at_indicator_callsetupincoming_string
+                        at_indicator_callsetupoutgoing_string
+                        at_indicator_callsetupremoteringing_string
+                        sms_receiving_program
+                        alsacname
+                        alsapname
+
+                        interface_id
+                        controldevice_speed
+                        controldevprotocol
+                        at_early_audio
+                        at_after_preinit_pause
+                        at_initial_pause
+                        at_has_clcc
+                        at_has_ecam
+                        alsa_period_size
+                        alsa_periods_in_buffer
+                        celliax_sound_rate
+                        alsa_play_is_mono
+                        alsa_capture_is_mono
+                        capture_boost
+                        playback_boost
+
+
+#endif //NOTDEF
+
+
+#ifdef NEW_OLD
+static switch_status_t load_config(int reload_type)
+/* END: Changes heres */
+{
+        char *cf = "celliax.conf";
+        switch_xml_t cfg, xml, global_settings, param, interfaces, myinterface;
+        private_t *tech_pvt = NULL;
+
+        switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, celliax_module_pool);
+        if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
+                ERRORA("open of %s failed\n", CELLIAX_P_LOG, cf);
+                running = 0;
+                switch_xml_free(xml);
+                return SWITCH_STATUS_TERM;
+        }
+
+        switch_mutex_lock(globals.mutex);
+        if ((global_settings = switch_xml_child(cfg, "global_settings"))) {
+                for (param = switch_xml_child(global_settings, "param"); param; param = param->next) {
+                        char *var = (char *) switch_xml_attr_soft(param, "name");
+                        char *val = (char *) switch_xml_attr_soft(param, "value");
+
+                        if (!strcasecmp(var, "debug")) {
+                                DEBUGA_CELLIAX("globals.debug=%d\n", CELLIAX_P_LOG, globals.debug);
+                                globals.debug = atoi(val);
+                                DEBUGA_CELLIAX("globals.debug=%d\n", CELLIAX_P_LOG, globals.debug);
+                        } else if (!strcasecmp(var, "hold-music")) {
+                                switch_set_string(globals.hold_music, val);
+                                DEBUGA_CELLIAX("globals.hold_music=%s\n", CELLIAX_P_LOG, globals.hold_music);
+                        } else if (!strcmp(var, "dialplan")) {
+                                set_global_dialplan(val);
+                                DEBUGA_CELLIAX("globals.dialplan=%s\n", CELLIAX_P_LOG, globals.dialplan);
+                        } else if (!strcmp(var, "destination")) {
+                                set_global_destination(val);
+                                DEBUGA_CELLIAX("globals.destination=%s\n", CELLIAX_P_LOG, globals.destination);
+                        } else if (!strcmp(var, "context")) {
+                                set_global_context(val);
+                                DEBUGA_CELLIAX("globals.context=%s\n", CELLIAX_P_LOG, globals.context);
+
+                        }
+
+                }
+        }
+
+        if ((interfaces = switch_xml_child(cfg, "per_interface_settings"))) {
+                int i = 0;
+
+                for (myinterface = switch_xml_child(interfaces, "interface"); myinterface; myinterface = myinterface->next) {
+                        char *id = (char *) switch_xml_attr(myinterface, "id");
+                        char *name = (char *) switch_xml_attr(myinterface, "name");
+                        char *context = "default";
+                        char *dialplan = "XML";
+                        char *destination = "5000";
+                        char *controldevice_name = "/dev/ttyACM0";
+                        char *digit_timeout = NULL;
+                        char *max_digits = NULL;
+                        char *hotline = NULL;
+                        char *dial_regex = NULL;
+                        char *hold_music = NULL;
+                        char *fail_dial_regex = NULL;
+                        char *enable_callerid = "true";
+
+
+                        char *at_dial_pre_number= "ATD";
+                        char *at_dial_post_number= ";";
+                        char *at_dial_expect= "OK";
+                        char *at_hangup= "ATH";
+                        char *at_hangup_expect= "OK";
+                        char *at_answer= "ATA";
+                        char *at_answer_expect= "OK";
+                        char *at_send_dtmf= "AT+VTS";
+                        char *at_preinit_1= "";
+                        char *at_preinit_1_expect= "";
+                        char *at_preinit_2= "";
+                        char *at_preinit_2_expect= "";
+                        char *at_preinit_3= "";
+                        char *at_preinit_3_expect= "";
+                        char *at_preinit_4= "";
+                        char *at_preinit_4_expect= "";
+                        char *at_preinit_5= "";
+                        char *at_preinit_5_expect= "";
+                        char *at_postinit_1= "at+cmic=0,9";
+                        char *at_postinit_1_expect= "OK";
+                        char *at_postinit_2= "AT+CKPD=\"EEE\"";
+                        char *at_postinit_2_expect= "OK";
+                        char *at_postinit_3= "AT+CSSN=1,0";
+                        char *at_postinit_3_expect= "OK";
+                        char *at_postinit_4= "at+sidet=0";
+                        char *at_postinit_4_expect= "OK";
+                        char *at_postinit_5= "at+clvl=99";
+                        char *at_postinit_5_expect= "OK";
+                        char *at_query_battchg= "AT+CBC";
+                        char *at_query_battchg_expect= "OK";
+                        char *at_query_signal= "AT+CSQ";
+                        char *at_query_signal_expect= "OK";
+                        char *at_call_idle= "+MCST: 1";
+                        char *at_call_incoming= "+MCST: 2";
+                        char *at_call_active= "+CSSI: 7";
+                        char *at_call_failed= "+MCST: 65";
+                        char *at_call_calling= "+CSSI: 1";
+                        char *at_indicator_noservice_string= "CIEV: 2;0";
+                        char *at_indicator_nosignal_string= "CIEV: 5;0";
+                        char *at_indicator_lowsignal_string= "CIEV: 5;1";
+                        char *at_indicator_lowbattchg_string= "CIEV: 0;1";
+                        char *at_indicator_nobattchg_string= "CIEV: 0;0";
+                        char *at_indicator_callactive_string= "CIEV: 3;1";
+                        char *at_indicator_nocallactive_string= "CIEV: 3;0";
+                        char *at_indicator_nocallsetup_string= "CIEV: 6;0";
+                        char *at_indicator_callsetupincoming_string= "CIEV: 6;1";
+                        char *at_indicator_callsetupoutgoing_string= "CIEV: 6;2";
+                        char *at_indicator_callsetupremoteringing_string= "CIEV: 6;3";
+                        char *sms_receiving_program= "/usr/local/bin/ciapalo";
+                        char *alsacname= "plughw:1";
+                        char *alsapname= "plughw:1";
+
+                        uint32_t interface_id = 0, to = 0, max = 0;
+                        uint32_t controldevice_speed = B115200;
+                        uint32_t controldevprotocol = PROTOCOL_AT;
+#ifdef NOT_NUMBERS_NOW
+                        uint32_t running =1;
+                        uint32_t at_early_audio =0;
+                        uint32_t at_after_preinit_pause=500000;
+                        uint32_t at_initial_pause=500000;
+                        uint32_t at_has_clcc=0;
+                        uint32_t at_has_ecam=0;
+                        uint32_t alsa_period_size=160;
+                        uint32_t alsa_periods_in_buffer=4;
+                        uint32_t celliax_sound_rate=8000;
+                        uint32_t alsa_play_is_mono=1;
+                        uint32_t alsa_capture_is_mono=1;
+                        uint32_t capture_boost=5;
+                        uint32_t playback_boost=10;
+#endif// NOT_NUMBERS_NOW
+
+
+                        tech_pvt = NULL;
+
+                        for (param = switch_xml_child(myinterface, "param"); param; param = param->next) {
+                                char *var = (char *) switch_xml_attr_soft(param, "name");
+                                char *val = (char *) switch_xml_attr_soft(param, "value");
+
+                                if (!strcasecmp(var, "id")) {
+                                        id = val;
+                                } else if (!strcasecmp(var, "name")) {
+                                        name = val;
+                                } else if (!strcasecmp(var, "context")) {
+                                        context = val;
+                                } else if (!strcasecmp(var, "dialplan")) {
+                                        dialplan = val;
+                                } else if (!strcasecmp(var, "destination")) {
+                                        destination = val;
+                                } else if (!strcasecmp(var, "controldevice_name")) {
+                                        controldevice_name = val;
+                                } else if (!strcasecmp(var, "digit_timeout")) {
+                                        digit_timeout = val;
+                                } else if (!strcasecmp(var, "max_digits")) {
+                                        max_digits = val;
+                                } else if (!strcasecmp(var, "hotline")) {
+                                        hotline = val;
+                                } else if (!strcasecmp(var, "dial_regex")) {
+                                        dial_regex = val;
+                                } else if (!strcasecmp(var, "hold_music")) {
+                                        hold_music = val;
+                                } else if (!strcasecmp(var, "fail_dial_regex")) {
+                                        fail_dial_regex = val;
+                                } else if (!strcasecmp(var, "enable_callerid")) {
+                                        enable_callerid = val;
+                                } else if (!strcasecmp(var, "at_dial_pre_number")) {
+                                        at_dial_pre_number = val;
+                                } else if (!strcasecmp(var, "at_dial_post_number")) {
+                                        at_dial_post_number = val;
+                                } else if (!strcasecmp(var, "at_dial_expect")) {
+                                        at_dial_expect = val;
+                                } else if (!strcasecmp(var, "at_hangup")) {
+                                        at_hangup = val;
+                                } else if (!strcasecmp(var, "at_hangup_expect")) {
+                                        at_hangup_expect = val;
+                                } else if (!strcasecmp(var, "at_answer")) {
+                                        at_answer = val;
+                                } else if (!strcasecmp(var, "at_answer_expect")) {
+                                        at_answer_expect = val;
+                                } else if (!strcasecmp(var, "at_send_dtmf")) {
+                                        at_send_dtmf = val;
+                                } else if (!strcasecmp(var, "at_preinit_1")) {
+                                        at_preinit_1 = val;
+                                } else if (!strcasecmp(var, "at_preinit_1_expect")) {
+                                        at_preinit_1_expect = val;
+                                } else if (!strcasecmp(var, "at_preinit_2")) {
+                                        at_preinit_2 = val;
+                                } else if (!strcasecmp(var, "at_preinit_2_expect")) {
+                                        at_preinit_2_expect = val;
+                                } else if (!strcasecmp(var, "at_preinit_3")) {
+                                        at_preinit_3 = val;
+                                } else if (!strcasecmp(var, "at_preinit_3_expect")) {
+                                        at_preinit_3_expect = val;
+                                } else if (!strcasecmp(var, "at_preinit_4")) {
+                                        at_preinit_4 = val;
+                                } else if (!strcasecmp(var, "at_preinit_4_expect")) {
+                                        at_preinit_4_expect = val;
+                                } else if (!strcasecmp(var, "at_preinit_5")) {
+                                        at_preinit_5 = val;
+                                } else if (!strcasecmp(var, "at_preinit_5_expect")) {
+                                        at_preinit_5_expect = val;
+                                } else if (!strcasecmp(var, "at_postinit_1")) {
+                                        at_postinit_1 = val;
+                                } else if (!strcasecmp(var, "at_postinit_1_expect")) {
+                                        at_postinit_1_expect = val;
+                                } else if (!strcasecmp(var, "at_postinit_2")) {
+                                        at_postinit_2 = val;
+                                } else if (!strcasecmp(var, "at_postinit_2_expect")) {
+                                        at_postinit_2_expect = val;
+                                } else if (!strcasecmp(var, "at_postinit_3")) {
+                                        at_postinit_3 = val;
+                                } else if (!strcasecmp(var, "at_postinit_3_expect")) {
+                                        at_postinit_3_expect = val;
+                                } else if (!strcasecmp(var, "at_postinit_4")) {
+                                        at_postinit_4 = val;
+                                } else if (!strcasecmp(var, "at_postinit_4_expect")) {
+                                        at_postinit_4_expect = val;
+                                } else if (!strcasecmp(var, "at_postinit_5")) {
+                                        at_postinit_5 = val;
+                                } else if (!strcasecmp(var, "at_postinit_5_expect")) {
+                                        at_postinit_5_expect = val;
+                                } else if (!strcasecmp(var, "at_query_battchg")) {
+                                        at_query_battchg = val;
+                                } else if (!strcasecmp(var, "at_query_battchg_expect")) {
+                                        at_query_battchg_expect = val;
+                                } else if (!strcasecmp(var, "at_query_signal")) {
+                                        at_query_signal = val;
+                                } else if (!strcasecmp(var, "at_query_signal_expect")) {
+                                        at_query_signal_expect = val;
+                                } else if (!strcasecmp(var, "at_call_idle")) {
+                                        at_call_idle = val;
+                                } else if (!strcasecmp(var, "at_call_incoming")) {
+                                        at_call_incoming = val;
+                                } else if (!strcasecmp(var, "at_call_active")) {
+                                        at_call_active = val;
+                                } else if (!strcasecmp(var, "at_call_failed")) {
+                                        at_call_failed = val;
+                                } else if (!strcasecmp(var, "at_call_calling")) {
+                                        at_call_calling = val;
+                                } else if (!strcasecmp(var, "at_indicator_noservice_string")) {
+                                        at_indicator_noservice_string = val;
+                                } else if (!strcasecmp(var, "at_indicator_nosignal_string")) {
+                                        at_indicator_nosignal_string = val;
+                                } else if (!strcasecmp(var, "at_indicator_lowsignal_string")) {
+                                        at_indicator_lowsignal_string = val;
+                                } else if (!strcasecmp(var, "at_indicator_lowbattchg_string")) {
+                                        at_indicator_lowbattchg_string = val;
+                                } else if (!strcasecmp(var, "at_indicator_nobattchg_string")) {
+                                        at_indicator_nobattchg_string = val;
+                                } else if (!strcasecmp(var, "at_indicator_callactive_string")) {
+                                        at_indicator_callactive_string = val;
+                                } else if (!strcasecmp(var, "at_indicator_nocallactive_string")) {
+                                        at_indicator_nocallactive_string = val;
+                                } else if (!strcasecmp(var, "at_indicator_nocallsetup_string")) {
+                                        at_indicator_nocallsetup_string = val;
+                                } else if (!strcasecmp(var, "at_indicator_callsetupincoming_string")) {
+                                        at_indicator_callsetupincoming_string = val;
+                                } else if (!strcasecmp(var, "at_indicator_callsetupoutgoing_string")) {
+                                        at_indicator_callsetupoutgoing_string = val;
+                                } else if (!strcasecmp(var, "at_indicator_callsetupremoteringing_string")) {
+                                        at_indicator_callsetupremoteringing_string = val;
+                                } else if (!strcasecmp(var, "sms_receiving_program")) {
+                                        sms_receiving_program = val;
+                                } else if (!strcasecmp(var, "alsacname")) {
+                                        alsacname = val;
+                                } else if (!strcasecmp(var, "alsapname")) {
+                                        alsapname = val;
+
+#ifdef NOT_NUMBERS_NOW
+                                        interface_id
+                                                controldevice_speed
+                                                controldevprotocol
+                                                at_early_audio
+                                                at_after_preinit_pause
+                                                at_initial_pause
+                                                at_has_clcc
+                                                at_has_ecam
+                                                alsa_period_size
+                                                alsa_periods_in_buffer
+                                                celliax_sound_rate
+                                                alsa_play_is_mono
+                                                alsa_capture_is_mono
+                                                capture_boost
+                                                playback_boost
+#endif// NOT_NUMBERS_NOW
+
+
+                                }
+
+                        }
+
+                        /* BEGIN: Changes here */
+                        if (reload_type == SOFT_RELOAD) {
+                                char the_interface[256];
+                                sprintf(the_interface, "#%s", name);
+
+                                if (interface_exists(the_interface) == SWITCH_STATUS_SUCCESS) {
+                                        continue;
+                                }
+                        }
+                        /* END: Changes here */
+
+                        if (!id) {
+                                ERRORA("interface missing REQUIRED param 'id'\n", CELLIAX_P_LOG);
+                                continue;
+                        }
+                        if (switch_is_number(id)) {
+                                interface_id = atoi(id);
+                                DEBUGA_CELLIAX("interface_id=%d\n", CELLIAX_P_LOG, interface_id);
+                        } else {
+                                ERRORA("interface param 'id' MUST be a number, now id='%s'\n", CELLIAX_P_LOG, id);
+                                continue;
+                        }
+
+                        if (!name) {
+                                WARNINGA("interface missing param 'name', not nice, but works\n", CELLIAX_P_LOG);
+                        }
+
+                        if (!controldevice_name) {
+                                controldevice_name = "/dev/ttyACM0";
+                        }
+
+                        if (digit_timeout) {
+                                to = atoi(digit_timeout);
+                        }
+
+                        if (max_digits) {
+                                max = atoi(max_digits);
+                        }
+
+                        if (name) {
+                                DEBUGA_CELLIAX("name=%s\n", CELLIAX_P_LOG, name);
+                        }
+                        if (interface_id && interface_id < CELLIAX_MAX_INTERFACES) {
+                                private_t newconf;
+                                switch_threadattr_t *celliax_api_thread_attr = NULL;
+
+                                memset(&newconf, '\0', sizeof(newconf));
+                                globals.CELLIAX_INTERFACES[interface_id] = newconf;
+
+
+                                tech_pvt = &globals.CELLIAX_INTERFACES[interface_id];
+
+                                if (name) {
+                                        switch_set_string(globals.CELLIAX_INTERFACES[interface_id].name, name);
+                                } else {
+                                        switch_set_string(globals.CELLIAX_INTERFACES[interface_id].name, "N/A");
+                                }
+                                DEBUGA_CELLIAX("CONFIGURING interface_id=%d name=%s\n", CELLIAX_P_LOG, interface_id, name);
+
+                                switch_mutex_init(&globals.CELLIAX_INTERFACES[interface_id].controldev_lock, SWITCH_MUTEX_NESTED, celliax_module_pool);
+
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].interface_id, id);
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].context, context);
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].dialplan, dialplan);
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].destination, destination);
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].controldevice_name, controldevice_name);
+
+                                globals.CELLIAX_INTERFACES[interface_id].controldevice_speed = controldevice_speed;
+                                globals.CELLIAX_INTERFACES[interface_id].controldevprotocol = controldevprotocol;
+                                globals.CELLIAX_INTERFACES[interface_id].running = 1;
+                                globals.CELLIAX_INTERFACES[interface_id].at_early_audio = 0;
+                                globals.CELLIAX_INTERFACES[interface_id].at_after_preinit_pause = 500000;
+                                globals.CELLIAX_INTERFACES[interface_id].at_initial_pause = 500000;
+                                globals.CELLIAX_INTERFACES[interface_id].at_has_clcc = 0;
+                                globals.CELLIAX_INTERFACES[interface_id].at_has_ecam = 0;
+                                globals.CELLIAX_INTERFACES[interface_id].alsa_period_size = 160;
+                                globals.CELLIAX_INTERFACES[interface_id].alsa_periods_in_buffer = 4;
+                                globals.CELLIAX_INTERFACES[interface_id].celliax_sound_rate = 8000;
+                                globals.CELLIAX_INTERFACES[interface_id].alsa_play_is_mono = 1;
+                                globals.CELLIAX_INTERFACES[interface_id].alsa_capture_is_mono = 1;
+                                globals.CELLIAX_INTERFACES[interface_id].capture_boost = 0;
+                                globals.CELLIAX_INTERFACES[interface_id].playback_boost = 0;
+
+
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_dial_pre_number, "ATD");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_dial_post_number, ";");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_dial_expect, "OK");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_hangup, "ATH");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_hangup_expect, "OK");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_answer, "ATA");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_answer_expect, "OK");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_send_dtmf, "AT+VTS");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_preinit_1, "");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_preinit_1_expect, "");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_preinit_2, "");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_preinit_2_expect, "");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_preinit_3, "");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_preinit_3_expect, "");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_preinit_4, "");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_preinit_4_expect, "");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_preinit_5, "");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_preinit_5_expect, "");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_postinit_1, "at+cmic=0,9");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_postinit_1_expect, "OK");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_postinit_2, "AT+CKPD=\"EEE\"");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_postinit_2_expect, "OK");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_postinit_3, "AT+CSSN=1,0");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_postinit_3_expect, "OK");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_postinit_4, "at+sidet=0");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_postinit_4_expect, "OK");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_postinit_5, "at+clvl=99");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_postinit_5_expect, "OK");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_query_battchg, "AT+CBC");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_query_battchg_expect, "OK");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_query_signal, "AT+CSQ");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_query_signal_expect, "OK");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_call_idle, "+MCST: 1");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_call_incoming, "+MCST: 2");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_call_active, "+CSSI: 7");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_call_failed, "+MCST: 65");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_call_calling, "+CSSI: 1");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_noservice_string, "CIEV: 2;0");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_nosignal_string, "CIEV: 5;0");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_lowsignal_string, "CIEV: 5;1");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_lowbattchg_string, "CIEV: 0;1");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_nobattchg_string, "CIEV: 0;0");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_callactive_string, "CIEV: 3;1");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_nocallactive_string, "CIEV: 3;0");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_nocallsetup_string, "CIEV: 6;0");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_callsetupincoming_string, "CIEV: 6;1");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_callsetupoutgoing_string, "CIEV: 6;2");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].at_indicator_callsetupremoteringing_string, "CIEV: 6;3");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].sms_receiving_program, "/usr/local/bin/ciapalo");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].alsacname, "plughw:1");
+                                switch_set_string(globals.CELLIAX_INTERFACES[interface_id].alsapname, "plughw:1");
+
+                                celliax_store_boost("5", &globals.CELLIAX_INTERFACES[interface_id].capture_boost); //FIXME
+                                celliax_store_boost("10", &globals.CELLIAX_INTERFACES[interface_id].playback_boost); //FIXME
+
+
+                                DEBUGA_CELLIAX("interface_id=%d globals.CELLIAX_INTERFACES[interface_id].name=%s\n",
+                                                CELLIAX_P_LOG, interface_id, globals.CELLIAX_INTERFACES[interface_id].name);
+                                DEBUGA_CELLIAX
+                                        ("interface_id=%d globals.CELLIAX_INTERFACES[interface_id].dialplan=%s\n",
+                                         CELLIAX_P_LOG, interface_id, globals.CELLIAX_INTERFACES[interface_id].dialplan);
+                                DEBUGA_CELLIAX
+                                        ("interface_id=%d globals.CELLIAX_INTERFACES[interface_id].destination=%s\n",
+                                         CELLIAX_P_LOG, interface_id, globals.CELLIAX_INTERFACES[interface_id].destination);
+                                DEBUGA_CELLIAX
+                                        ("interface_id=%d globals.CELLIAX_INTERFACES[interface_id].context=%s\n",
+                                         CELLIAX_P_LOG, interface_id, globals.CELLIAX_INTERFACES[interface_id].context);
+                                WARNINGA("STARTING interface_id=%d\n", CELLIAX_P_LOG, interface_id);
+
+                                int res = 0;
+
+                                /* init the serial port */
+                                if (globals.CELLIAX_INTERFACES[interface_id].controldevprotocol != PROTOCOL_NO_SERIAL) {
+                                        globals.CELLIAX_INTERFACES[interface_id].controldevfd =
+                                                celliax_serial_init(&globals.CELLIAX_INTERFACES[interface_id], globals.CELLIAX_INTERFACES[interface_id].controldevice_speed);
+                                        if (globals.CELLIAX_INTERFACES[interface_id].controldevfd < 1) {
+                                                ERRORA("celliax_serial_init failed\n", CELLIAX_P_LOG);
+                                                return SWITCH_STATUS_FALSE;
+                                                //celliax_sound_shutdown(tmp);
+                                                //if (tmp)
+                                                //free(tmp);
+                                                //return NULL;
+                                        }
+                                }
+
+                                /* config the phone/modem on the serial port */
+                                if (globals.CELLIAX_INTERFACES[interface_id].controldevprotocol != PROTOCOL_NO_SERIAL) {
+                                        //int res;
+                                        res = celliax_serial_config(&globals.CELLIAX_INTERFACES[interface_id]);
+                                        if (res) {
+                                                ERRORA("celliax_serial_config failed\n", CELLIAX_P_LOG);
+                                                return SWITCH_STATUS_FALSE;
+                                                //celliax_sound_shutdown(tmp);
+                                                //if (tmp)
+                                                //free(tmp);
+                                                //return NULL;
+                                        }
+                                }
+
+
+                                switch_sleep(100000);
+                                switch_threadattr_create(&celliax_api_thread_attr, celliax_module_pool);
+                                switch_threadattr_stacksize_set(celliax_api_thread_attr, SWITCH_THREAD_STACKSIZE);
+                                switch_thread_create(&globals.CELLIAX_INTERFACES[interface_id].celliax_api_thread, celliax_api_thread_attr, celliax_do_celliaxapi_thread,
+                                                &globals.CELLIAX_INTERFACES[interface_id], celliax_module_pool);
+
+                                switch_sleep(100000);
+
+                        } else {
+                                ERRORA("interface id %d is higher than CELLIAX_MAX_INTERFACES (%d)\n", CELLIAX_P_LOG, interface_id, CELLIAX_MAX_INTERFACES);
+                                continue;
+                        }
+
+                }
+
+                for (i = 0; i < CELLIAX_MAX_INTERFACES; i++) {
+                        if (strlen(globals.CELLIAX_INTERFACES[i].name)) {
+                                /* How many real intterfaces */
+                                globals.real_interfaces = i + 1;
+
+                                tech_pvt = &globals.CELLIAX_INTERFACES[i];
+
+                                DEBUGA_CELLIAX("i=%d globals.CELLIAX_INTERFACES[%d].interface_id=%s\n", CELLIAX_P_LOG, i, i, globals.CELLIAX_INTERFACES[i].interface_id);
+                                DEBUGA_CELLIAX("i=%d globals.CELLIAX_INTERFACES[%d].name=%s\n", CELLIAX_P_LOG, i, i, globals.CELLIAX_INTERFACES[i].name);
+                                DEBUGA_CELLIAX("i=%d globals.CELLIAX_INTERFACES[%d].context=%s\n", CELLIAX_P_LOG, i, i, globals.CELLIAX_INTERFACES[i].context);
+                                DEBUGA_CELLIAX("i=%d globals.CELLIAX_INTERFACES[%d].dialplan=%s\n", CELLIAX_P_LOG, i, i, globals.CELLIAX_INTERFACES[i].dialplan);
+                                DEBUGA_CELLIAX("i=%d globals.CELLIAX_INTERFACES[%d].destination=%s\n", CELLIAX_P_LOG, i, i, globals.CELLIAX_INTERFACES[i].destination);
+                        }
+                }
+        }
+
+        switch_mutex_unlock(globals.mutex);
+        switch_xml_free(xml);
+
+        return SWITCH_STATUS_SUCCESS;
+}
+#endif// NEW_OLD
+#ifdef NOTDEF
+                                } else if (!strcasecmp(var, "context")) {
+                                        context = val;
+                                } else if (!strcasecmp(var, "dialplan")) {
+                                        dialplan = val;
+                                } else if (!strcasecmp(var, "destination")) {
+                                        destination = val;
+                                } else if (!strcasecmp(var, "dial-regex")) {
+                                        dial_regex = val;
+                                } else if (!strcasecmp(var, "enable-callerid")) {
+                                        enable_callerid = val;
+                                } else if (!strcasecmp(var, "fail-dial-regex")) {
+                                        fail_dial_regex = val;
+                                } else if (!strcasecmp(var, "hold-music")) {
+                                        hold_music = val;
+                                } else if (!strcasecmp(var, "max_digits") || !strcasecmp(var, "max-digits")) {
+                                        max_digits = val;
+                                } else if (!strcasecmp(var, "hotline")) {
+                                        hotline = val;
+
+
+                        id
+                        name
+                        context
+                        dialplan
+                        destination
+                        controldevice_name
+                        digit_timeout
+                        max_digits
+                        hotline
+                        dial_regex
+                        hold_music
+                        fail_dial_regex
+                        enable_callerid
+
+
+                        at_dial_pre_number
+                        at_dial_post_number
+                        at_dial_expect
+                        at_hangup
+                        at_hangup_expect
+                        at_answer
+                        at_answer_expect
+                        at_send_dtmf
+                        at_preinit_1
+                        at_preinit_1_expect
+                        at_preinit_2
+                        at_preinit_2_expect
+                        at_preinit_3
+                        at_preinit_3_expect
+                        at_preinit_4
+                        at_preinit_4_expect
+                        at_preinit_5
+                        at_preinit_5_expect
+                        at_postinit_1
+                        at_postinit_1_expect
+                        at_postinit_2
+                        at_postinit_2_expect
+                        at_postinit_3
+                        at_postinit_3_expect
+                        at_postinit_4
+                        at_postinit_4_expect
+                        at_postinit_5
+                        at_postinit_5_expect
+                        at_query_battchg
+                        at_query_battchg_expect
+                        at_query_signal
+                        at_query_signal_expect
+                        at_call_idle
+                        at_call_incoming
+                        at_call_active
+                        at_call_failed
+                        at_call_calling
+                        at_indicator_noservice_string
+                        at_indicator_nosignal_string
+                        at_indicator_lowsignal_string
+                        at_indicator_lowbattchg_string
+                        at_indicator_nobattchg_string
+                        at_indicator_callactive_string
+                        at_indicator_nocallactive_string
+                        at_indicator_nocallsetup_string
+                        at_indicator_callsetupincoming_string
+                        at_indicator_callsetupoutgoing_string
+                        at_indicator_callsetupremoteringing_string
+                        sms_receiving_program
+                        alsacname
+                        alsapname
+
+                        interface_id
+                        controldevice_speed
+                        controldevprotocol
+                        at_early_audio
+                        at_after_preinit_pause
+                        at_initial_pause
+                        at_has_clcc
+                        at_has_ecam
+                        alsa_period_size
+                        alsa_periods_in_buffer
+                        celliax_sound_rate
+                        alsa_play_is_mono
+                        alsa_capture_is_mono
+                        capture_boost
+                        playback_boost
+
+
+#endif //NOTDEF
+
+#ifdef WANT_OLD
+static switch_status_t load_config(int reload_type)
+/* END: Changes heres */
+{
+        char *cf = "celliax.conf";
+        switch_xml_t cfg, xml, global_settings, param, interfaces, myinterface;
+        private_t *tech_pvt = NULL;
+
+        switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, celliax_module_pool);
+        if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
+                ERRORA("open of %s failed\n", CELLIAX_P_LOG, cf);
+                running = 0;
+                switch_xml_free(xml);
+                return SWITCH_STATUS_TERM;
+        }
+
+        switch_mutex_lock(globals.mutex);
+        if ((global_settings = switch_xml_child(cfg, "global_settings"))) {
+                for (param = switch_xml_child(global_settings, "param"); param; param = param->next) {
+                        char *var = (char *) switch_xml_attr_soft(param, "name");
+                        char *val = (char *) switch_xml_attr_soft(param, "value");
+
+                        if (!strcasecmp(var, "debug")) {
+                                DEBUGA_CELLIAX("globals.debug=%d\n", CELLIAX_P_LOG, globals.debug);
+                                globals.debug = atoi(val);
+                                DEBUGA_CELLIAX("globals.debug=%d\n", CELLIAX_P_LOG, globals.debug);
+                        } else if (!strcasecmp(var, "hold-music")) {
+                                switch_set_string(globals.hold_music, val);
+                                DEBUGA_CELLIAX("globals.hold_music=%s\n", CELLIAX_P_LOG, globals.hold_music);
+                        } else if (!strcmp(var, "dialplan")) {
+                                set_global_dialplan(val);
+                                DEBUGA_CELLIAX("globals.dialplan=%s\n", CELLIAX_P_LOG, globals.dialplan);
+                        } else if (!strcmp(var, "destination")) {
+                                set_global_destination(val);
+                                DEBUGA_CELLIAX("globals.destination=%s\n", CELLIAX_P_LOG, globals.destination);
+                        } else if (!strcmp(var, "context")) {
+                                set_global_context(val);
+                                DEBUGA_CELLIAX("globals.context=%s\n", CELLIAX_P_LOG, globals.context);
+
</ins><span class="cx"> /*
</span><span class="cx">                         } else if (!strcmp(var, "port")) {
</span><span class="cx">                                 globals.port = atoi(val);
</span><span class="lines">@@ -1506,6 +2833,7 @@
</span><span class="cx">
</span><span class="cx">         return SWITCH_STATUS_SUCCESS;
</span><span class="cx"> }
</span><ins>+#endif //WANT_OLD
</ins><span class="cx"> static switch_status_t chat_send(const char *proto, const char *from, const char *to, const char *subject, const char *body, const char *type, const char *hint)
</span><span class="cx"> {
</span><span class="cx">         char *user, *host, *f_user = NULL, *f_host = NULL, *f_resource = NULL;
</span></span></pre>
</div>
</div>
<div id="footer">See you at ClueCon</div>
</body>
</html>