<h1>Project "FreeSWITCH Source" received a push.</h1>
<h2>branch: master updated</h2>
<pre>
discards b6afdadc82a3d9c95ff61bad4a7f869d220cd0f9 (commit)
discards c339d6f2e1e8111da4150974ca324d3c3b9393c0 (commit)
discards 14e931ffbb1d0e3196420b0eceb7a21fcd09abf4 (commit)
via: 6cecbca2bbb8dc7cc4511e91a992ce77cb126d17 (commit)
via: 804fc61a6c28f85321614ab74ba3986e2cd7a771 (commit)
via: 428ef9666734805fa7f97f8291c06252a4f1b798 (commit)
via: f64b03bd8b25deb191fd456a1854b02fd73626fc (commit)
via: 3830484155cfa3bd8ef09b88515e8afa6c251121 (commit)
via: bcb2262fdc48b36bd2e6bfe45adcbaecd1d091ee (commit)
via: f0a31e1bfff2d49d97bc0ee83627c426fa311bfc (commit)
via: 526e6fe48cadc9418d64f2b639bad68d8883dcdd (commit)
via: 8c12162a9d92ceac55c6305f2336efcf7157b923 (commit)
via: bab7a2392f955facbb91d0f30512682e2b38773e (commit)
via: 946ec62893014a5796d0d90b1fc62797d4102164 (commit)
via: 1cc51046c5b5b61e86394b97996a2d7833244f90 (commit)
via: 12c13e115b96e9e036bd65655c1f12a72a83510e (commit)
via: cf83f9c381a6abb988efc41b8711271b4665b79e (commit)
via: 080c5ae98167e590bebf698439c550bdb656925e (commit)
via: 0806c3880104fff154802adb010713365ef6a0ed (commit)
via: d4b5b07b2a76404ed8bf5adf8bc2bc9c0cbd9f04 (commit)
via: 2b4f163826132cf55698008a22c065374320796a (commit)
via: 7386b9f8f55e6b2648bcfb3f9dafaf62dccd772e (commit)
via: 0d5fcf65a0fef932f32874da6f4bdddb69279c53 (commit)
via: b3086c1d6b6f4900ec770e22878038ac565424d9 (commit)
via: beb829053945926447ba0f970faf1a3326d83981 (commit)
via: 294436486302d0547b34ba26e5fa402c4ebaa58f (commit)
via: 998a04d2cfa361a4d600175809d5fef02374c720 (commit)
via: e7d68a79dc7838d74e7b8985494dcde532910d32 (commit)
via: 8f565277e3a9e814c12779f3d51f2527a081ef99 (commit)
via: 20976da4114c2c5fc0213fa4cda91f7f4bf8a136 (commit)
via: e37dd41e311986015393befed7160e27a6450933 (commit)
via: b8b7266abb7a6c081ad1e1531aea69daf5d7509c (commit)
via: f4481b05ab8ae1faf6eedb438085e688371e79c6 (commit)
via: e9e33f5160fb5272c4f912dac6a29415215bba1c (commit)
via: 36f6218b8bba3233cf3fb501b01a0288a08e9f00 (commit)
via: 2ec2a9b0d335a8d6a30ab5a92448ac3ad63649ff (commit)
via: 46f6c6e42d2775ccfecb8f445ebbaaf32ab34df7 (commit)
via: b6ac001276961761b14a89270da02498b4d3e740 (commit)
via: 2d190b37abe00999a2e76861b8c88f0053e0b78f (commit)
via: dc436b82a52da05686ac178ad7854556e9688ed8 (commit)
via: bdf678e401a8077aab06b9c04004c92ef6631e26 (commit)
via: e79174cacf6abb943fe34840a5261b940b281c91 (commit)
via: 33b74ca8c710a58d245ea8903f98e0e86cffe164 (commit)
via: 68d08547f36777e2c091008b5e1207ca5b15e9e2 (commit)
via: 41dc6f46db0140b171d5ae71bfe923e7605f0cff (commit)
via: e5fb456f3bfddbf1e379c77030e8e4dd5549d12a (commit)
via: 74a0cfd1e101413a3941c41d04ee01d8df2ae418 (commit)
via: b55b4eeaeea1d1cebc5a44ffdd88b224898d5d8a (commit)
via: f60fdf653dd2d7f8d3eaa6a9086e1f68bd993c59 (commit)
via: 85913b70b43483d4d3d840d128549ddba75b56a6 (commit)
via: 257bf9a46c44f76d8b38c90f288f364bcf1c6398 (commit)
via: 4ae8282e6c6df0e296113e9b4b4a1383e1af8ad7 (commit)
via: 89c5f3bf8226bf605336b66e7761fd9f753d935a (commit)
via: 83dea0ee45a1eed53fe6c7bcac96410229c2fe3c (commit)
via: 944b99687ea3e6f14f6eeb1f6daa97a6905fbb1d (commit)
via: 57b0710bacb7cc58dee4262fe0c915048e47b7bc (commit)
via: 673678509f0f3ea0464ea45798c0cdbc4843946b (commit)
via: 10d696ebacedde5416e99f03911c928eea8889d1 (commit)
via: 43dd776c3616f3735bd8b73d965f81e9d16dab79 (commit)
via: fb66abfab4a74055c38cdc67da83e6e0175a4a0b (commit)
via: ae4b2873b0e56090658953f503157166825b66bc (commit)
via: 93b85b5a4c8abff3be692288176a40fda5b13c3f (commit)
via: 6a524a1d567f9e73d10d14067212bda5f67b7ffb (commit)
via: d72cde9b76a856cf002366300bea02c26db44ffb (commit)
via: 2404dd295aa0b6ef2e9da1598a4b3d479ee6317f (commit)
via: 45b3adda57a9281d0dd4389884d2a42eebc7dbba (commit)
via: 52bf0423e2231e7e16126baa13b8fef14132ac57 (commit)
via: 45ec088753031fc60b1b1abeb25536b7ac042374 (commit)
via: 33848eb01c327b04ad3c34bb5165bb1e01891863 (commit)
via: 53aeb1c1a71e6546950721d9f79f4a6131eb3071 (commit)
via: 2d6161e889fdaf8b03608fefdd7ef480a56ddf8b (commit)
via: e88b9639624cef4f35901146241f515730b3b118 (commit)
via: 86d5e441da872719faf72e24afdda85d8491406b (commit)
via: 9470e70057c549598d6d5e768d6cb08a2ba82104 (commit)
via: be370d45ebf5bc7fc329ef0b1abd48c2e38c8e9b (commit)
via: 1f1541b474c549d6a13b6a943d13f046d463751a (commit)
via: 766f2d61651f161b074fad2f987b4f10532a9a7a (commit)
via: 1623e5d2952d63e2e49d454cd6fdf921a8516227 (commit)
via: 256a82dbf2d7f4b4e1d7527f1e6a15d8d0d38a21 (commit)
via: c8f5c66c3520ecda8f8dbc07dc01f1d4035058e4 (commit)
via: 4371d3c804d890315ca623e2930286154d80a9a8 (commit)
via: 7c3ee98d3375dcab851ed8f4eb4b3d6a991295b1 (commit)
via: 1932b3fe3bc8de85098eaf9b810da9d3b027d865 (commit)
via: a382990d9f23096d04812cea6d66f6c3f3994e89 (commit)
via: becb94052ac619290e6825c4f985917134c6bce2 (commit)
via: 2ad81ac82f3c3c989e4d7d11f788c43c2c6f20d8 (commit)
via: 49a5effcdf2cea9e0ddcf146cf3fe85d1872e654 (commit)
via: 231a7ffaa19886653705c217a73d8e25b705503c (commit)
via: be3483b924a674e4c4f0f05734e7e4917634f3ca (commit)
via: e6e4bcea734fbfb54b901ff8b1107ddfe76b7010 (commit)
via: 068d36a5c95c5a4143f423b7c36cbe6d5cea36d5 (commit)
via: 9986f4ebf2a0c40cc99bc7f9f03f2dec6ae74645 (commit)
via: 6d3abd41cadef3a2bff8175487c094c80d7d9cf7 (commit)
via: b3ac44f555a80f8278c5f915cfb36766903905a4 (commit)
via: 9e6503a482ff533ff214b01a07c3432be14ff1ce (commit)
via: 97a2b4f9025099bdab5718a13ee36d15a6152411 (commit)
via: 68b2756970bd4280eba700b7439afdff374fd9e3 (commit)
via: 9b0c16b5d48a7b9d0ea15ac429a8ca4c8eef8693 (commit)
via: f05fe55594ffca6edc8f4e74204650aa219ed1ac (commit)
via: 08f494b80802aacf101705382f149ca4b028eb57 (commit)
via: 0d276e7d7b7b52ac5510d139d8252fc10ad37298 (commit)
via: 9a8eea27feb6f300d5adeb078cad82974681bca7 (commit)
via: f37390f0a7f1ca636d54c23d6873510fcf26e91e (commit)
via: 1388ed811a2369b26778c4cce158691f285c45b4 (commit)
via: 02082c930cc08cd65b3ac51d2e8231e502bd8f31 (commit)
via: 89253a139117b32fa0a6dc101e53e9b830361048 (commit)
via: 15e65cfafb8a46caca8bb8a63d55edf817f17f2d (commit)
via: 92a9bacc44576e7b1d41c48752af597801e41d21 (commit)
via: 8f483f41c78ae3dd1bad7c3378733f04438f6af1 (commit)
via: 0f39c8f9c3d8e8bce05c551e0168e476ce29437a (commit)
via: 6d7e019b5c0244f53c16361d2667049b430adb55 (commit)
via: 128d53c2e6a73a6136efcfffa4e880e6635e43f1 (commit)
via: 4cbdfbe481d7f9b448663418dccc88b017f9ce69 (commit)
via: e719ae662b7cb08ebd7f8e732a140e9aeb502960 (commit)
via: 439df43cae04a053a1c22befdd7f1009f6cb6dfa (commit)
via: d395b654fb0abab4889d5b8c239728683e772959 (commit)
via: acd56d2fe2a0458801010cc6b03c524023cbc597 (commit)
This update added new revisions after undoing existing revisions. That is
to say, the old revision is not a strict subset of the new revision. This
situation occurs when you --force push a change and generate a repository
containing something like this:
* -- * -- B -- O -- O -- O (b6afdadc82a3d9c95ff61bad4a7f869d220cd0f9)
\
N -- N -- N (6cecbca2bbb8dc7cc4511e91a992ce77cb126d17)
When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.
</pre>= COMMIT LOG ===========================================================
<div class="highlight"><pre>committer: David Yat Sin
comments:
freetdm: ISDN - Removed unnecessay locks since lock is now done by ftdm core
<span style="color: #000080; font-weight: bold">diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c</span>
<span style="color: #000080; font-weight: bold">index 5702b72..608b0b6 100644</span>
<span style="color: #A00000">--- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c</span>
<span style="color: #00A000">+++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c</span>
<span style="color: #800080; font-weight: bold">@@ -912,9 +912,6 @@ static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(ftdm_sangoma_isdn_outgoing_call)</span>
        sngisdn_chan_data_t *sngisdn_info = ftdmchan->call_data;
        ftdm_status_t status = FTDM_FAIL;        
        
<span style="color: #A00000">-        /* lock the channel while we check whether it is availble */</span>
<span style="color: #A00000">-        ftdm_channel_lock(ftdmchan);</span>
<span style="color: #A00000">-</span>
        switch (ftdmchan->state) {
                case FTDM_CHANNEL_STATE_DOWN:
<span style="color: #800080; font-weight: bold">@@ -939,10 +936,9 @@ static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(ftdm_sangoma_isdn_outgoing_call)</span>
                        ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Outgoing call requested channel in already in use\n");
                        status = FTDM_BREAK;
                }
<span style="color: #A00000">-                break;                 </span>
<span style="color: #00A000">+                break;</span>
        }
<span style="color: #A00000">-        ftdm_channel_unlock(ftdmchan);</span>
        return status;
}
static FIO_CHANNEL_GET_SIG_STATUS_FUNCTION(ftdm_sangoma_isdn_get_chan_sig_status)
</pre></div>
<div class="highlight"><pre>committer: David Yat Sin
comments:
Merge branch 'master' of git.sangoma.com:smg_freeswitch
</pre></div>
<div class="highlight"><pre>committer: David Yat Sin
comments:
freetdm: allow reception of FACILITY msg in any channel state when transparent facility is enabled
<span style="color: #000080; font-weight: bold">diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c</span>
<span style="color: #000080; font-weight: bold">index 578677a..bcc7d93 100644</span>
<span style="color: #A00000">--- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c</span>
<span style="color: #00A000">+++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c</span>
<span style="color: #800080; font-weight: bold">@@ -801,6 +801,23 @@ void sngisdn_process_fac_ind (sngisdn_event_data_t *sngisdn_event)</span>
        ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Processing FACILITY IND (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId);
<span style="color: #00A000">+        if (signal_data->facility_ie_decode == SNGISDN_OPT_FALSE) {</span>
<span style="color: #00A000">+                /* If Facility decoding is disabled, we do not care about current call state, just pass event up to user */</span>
<span style="color: #00A000">+                ftdm_sigmsg_t sigev;</span>
<span style="color: #00A000">+                if (facEvnt->facElmt.facStr.pres) {</span>
<span style="color: #00A000">+                        get_facility_ie_str(ftdmchan, &facEvnt->facElmt.facStr.val[2], facEvnt->facElmt.facStr.len-2);</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+                memset(&sigev, 0, sizeof(sigev));</span>
<span style="color: #00A000">+                sigev.chan_id = ftdmchan->chan_id;</span>
<span style="color: #00A000">+                sigev.span_id = ftdmchan->span_id;</span>
<span style="color: #00A000">+                sigev.channel = ftdmchan;</span>
<span style="color: #00A000">+                </span>
<span style="color: #00A000">+                sigev.event_id = FTDM_SIGEVENT_FACILITY;</span>
<span style="color: #00A000">+                ftdm_span_send_signal(ftdmchan->span, &sigev);</span>
<span style="color: #00A000">+                ISDN_FUNC_TRACE_EXIT(__FUNCTION__);</span>
<span style="color: #00A000">+                return;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
        switch (ftdmchan->state) {
                case FTDM_CHANNEL_STATE_GET_CALLERID:
                        /* Update the caller ID Name */
</pre></div>
<div class="highlight"><pre>committer: Moises Silva
comments:
Merge remote branch 'fsorig/master'
</pre></div>
<div class="highlight"><pre>committer: Moises Silva
comments:
freetdm: do not expect result_cb to be set to make the interface cleaner
<span style="color: #000080; font-weight: bold">diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c</span>
<span style="color: #000080; font-weight: bold">index 0f92f59..c9000de 100644</span>
<span style="color: #A00000">--- a/libs/freetdm/src/ftdm_io.c</span>
<span style="color: #00A000">+++ b/libs/freetdm/src/ftdm_io.c</span>
<span style="color: #800080; font-weight: bold">@@ -37,9 +37,6 @@</span>
*
*/
<span style="color: #A00000">-#ifdef MOYTEST</span>
<span style="color: #A00000">-crap</span>
<span style="color: #A00000">-#endif</span>
#define _GNU_SOURCE
#include "private/ftdm_core.h"
#include <stdarg.h>
<span style="color: #800080; font-weight: bold">@@ -2509,10 +2506,12 @@ FT_DECLARE(ftdm_status_t) _ftdm_call_place(const char *file, const char *func, i</span>
        }
        /* we have a locked channel and are not afraid of using it! */
<span style="color: #A00000">-        status = hunting->result_cb(fchan, caller_data);</span>
<span style="color: #A00000">-        if (status != FTDM_SUCCESS) {</span>
<span style="color: #A00000">-                status = FTDM_ECANCELED;</span>
<span style="color: #A00000">-                goto done;</span>
<span style="color: #00A000">+        if (hunting->result_cb) {</span>
<span style="color: #00A000">+                status = hunting->result_cb(fchan, caller_data);</span>
<span style="color: #00A000">+                if (status != FTDM_SUCCESS) {</span>
<span style="color: #00A000">+                        status = FTDM_ECANCELED;</span>
<span style="color: #00A000">+                        goto done;</span>
<span style="color: #00A000">+                }</span>
        }
        ftdm_channel_set_caller_data(fchan, caller_data);
</pre></div>
<div class="highlight"><pre>committer: Daniel Swarbrick
comments:
major factor of pgsql field handling
<span style="color: #000080; font-weight: bold">diff --git a/conf/autoload_configs/cdr_pg_csv.conf.xml b/conf/autoload_configs/cdr_pg_csv.conf.xml</span>
<span style="color: #000080; font-weight: bold">index 427bf2d..4fec817 100644</span>
<span style="color: #A00000">--- a/conf/autoload_configs/cdr_pg_csv.conf.xml</span>
<span style="color: #00A000">+++ b/conf/autoload_configs/cdr_pg_csv.conf.xml</span>
<span style="color: #800080; font-weight: bold">@@ -16,10 +16,25 @@</span>
<!-- This is like the info app but after the call is hung up -->
<!--<param name="debug" value="true"/>-->
<span style="color: #A00000">-</span>
<span style="color: #A00000">- <param name="default-template" value="example"/></span>
</settings>
<span style="color: #A00000">- <templates></span>
<span style="color: #A00000">- <template name="example">"${local_ip_v4}","${caller_id_name}","${caller_id_number}","${destination_number}","${context}","${start_stamp}","${answer_stamp}","${end_stamp}","${duration}","${billsec}","${hangup_cause}","${uuid}","${bleg_uuid}","${accountcode}","${read_codec}","${write_codec}","${sip_hangup_disposition}","${ani}"</template></span>
<span style="color: #A00000">- </templates></span>
<span style="color: #00A000">+ <schema></span>
<span style="color: #00A000">+ <field var="local_ip_v4"/></span>
<span style="color: #00A000">+ <field var="caller_id_name"/></span>
<span style="color: #00A000">+ <field var="caller_id_number"/></span>
<span style="color: #00A000">+ <field var="destination_number"/></span>
<span style="color: #00A000">+ <field var="context"/></span>
<span style="color: #00A000">+ <field var="start_stamp"/></span>
<span style="color: #00A000">+ <field var="answer_stamp"/></span>
<span style="color: #00A000">+ <field var="end_stamp"/></span>
<span style="color: #00A000">+ <field var="duration" quote="false"/></span>
<span style="color: #00A000">+ <field var="billsec" quote="false"/></span>
<span style="color: #00A000">+ <field var="hangup_cause"/></span>
<span style="color: #00A000">+ <field var="uuid"/></span>
<span style="color: #00A000">+ <field var="bleg_uuid"/></span>
<span style="color: #00A000">+ <field var="accountcode"/></span>
<span style="color: #00A000">+ <field var="read_codec"/></span>
<span style="color: #00A000">+ <field var="write_codec"/></span>
<span style="color: #00A000">+ <!-- <field var="sip_hangup_disposition"/> --></span>
<span style="color: #00A000">+ <!-- <field var="ani"/> --></span>
<span style="color: #00A000">+ </schema></span>
</configuration>
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c b/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c</span>
<span style="color: #000080; font-weight: bold">index 1ec56bd..51194f4 100644</span>
<span style="color: #A00000">--- a/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c</span>
<span style="color: #00A000">+++ b/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c</span>
<span style="color: #800080; font-weight: bold">@@ -59,28 +59,34 @@ typedef struct {</span>
        switch_mutex_t *mutex;
} cdr_fd_t;
<span style="color: #A00000">-const char *default_template =</span>
<span style="color: #A00000">-        "\"${local_ip_v4}\",\"${caller_id_name}\",\"${caller_id_number}\",\"${destination_number}\",\"${context}\",\"${start_stamp}\","</span>
<span style="color: #A00000">-        "\"${answer_stamp}\",\"${end_stamp}\",\"${duration}\",\"${billsec}\",\"${hangup_cause}\",\"${uuid}\",\"${bleg_uuid}\",\"${accountcode}\","</span>
<span style="color: #A00000">-        "\"${read_codec}\",\"${write_codec}\"";</span>
<span style="color: #00A000">+typedef struct {</span>
<span style="color: #00A000">+        char *col_name;</span>
<span style="color: #00A000">+        char *var_name;</span>
<span style="color: #00A000">+        switch_bool_t quote;</span>
<span style="color: #00A000">+        switch_bool_t not_null;</span>
<span style="color: #00A000">+} cdr_field_t;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+typedef struct {</span>
<span style="color: #00A000">+        char *columns;</span>
<span style="color: #00A000">+        cdr_field_t fields[1];</span>
<span style="color: #00A000">+} db_schema_t;</span>
static struct {
        switch_memory_pool_t *pool;
        switch_hash_t *fd_hash;
<span style="color: #A00000">-        switch_hash_t *template_hash;</span>
        int shutdown;
        char *db_info;
        char *db_table;
<span style="color: #00A000">+        db_schema_t *db_schema;</span>
        PGconn *db_connection;
<span style="color: #00A000">+        switch_mutex_t *db_mutex;</span>
        int db_online;
        cdr_leg_t legs;
        char *spool_dir;
        spool_format_t spool_format;
        int rotate;
        int debug;
<span style="color: #A00000">-        char *default_template;</span>
<span style="color: #A00000">-        switch_mutex_t *db_mutex;</span>
<span style="color: #A00000">-} globals = { 0 };</span>
<span style="color: #00A000">+} globals;</span>
static switch_xml_config_enum_item_t config_opt_cdr_leg_enum[] = {
{"a", CDR_LEG_A},
<span style="color: #800080; font-weight: bold">@@ -110,7 +116,6 @@ static switch_xml_config_item_t config_settings[] = {</span>
        /* key, type, flags, ptr, default_value, data, syntax, helptext */
        SWITCH_CONFIG_ITEM_STRING_STRDUP("db-info", CONFIG_RELOADABLE, &globals.db_info, "dbname=cdr", NULL, NULL),
        SWITCH_CONFIG_ITEM_STRING_STRDUP("db-table", CONFIG_RELOADABLE, &globals.db_table, "cdr", NULL, NULL),
<span style="color: #A00000">-        SWITCH_CONFIG_ITEM_STRING_STRDUP("default-template", CONFIG_RELOADABLE, &globals.default_template, "default", NULL, NULL),</span>
        SWITCH_CONFIG_ITEM("legs", SWITCH_CONFIG_ENUM, CONFIG_RELOADABLE, &globals.legs, (void *) CDR_LEG_A, &config_opt_cdr_leg_enum, "a|b|ab", NULL),
        SWITCH_CONFIG_ITEM("spool-format", SWITCH_CONFIG_ENUM, CONFIG_RELOADABLE, &globals.spool_format, (void *) SPOOL_FORMAT_CSV, &config_opt_spool_format_enum, "csv|sql", "Disk spool format to use if SQL insert fails."),
        SWITCH_CONFIG_ITEM("rotate-on-hup", SWITCH_CONFIG_BOOL, CONFIG_RELOADABLE, &globals.rotate, SWITCH_FALSE, NULL, NULL, NULL),
<span style="color: #800080; font-weight: bold">@@ -239,135 +244,13 @@ static void spool_cdr(const char *path, const char *log_line)</span>
        switch_safe_free(log_line_lf);
}
<span style="color: #A00000">-static switch_status_t insert_cdr(const char * const template, const char * const cdr)</span>
<span style="color: #00A000">+static switch_status_t insert_cdr(const char *values)</span>
{
<span style="color: #A00000">-        char *columns, *values;</span>
<span style="color: #A00000">-        char *p, *q;</span>
<span style="color: #A00000">-        unsigned vlen;</span>
<span style="color: #A00000">-        char *nullValues, *temp, *tp;</span>
<span style="color: #A00000">-        int nullCounter = 0, charCounter = 0;</span>
        char *sql = NULL, *path = NULL;
        PGresult *res;
<span style="color: #A00000">-        if (!template || !*template || !cdr || !*cdr) {</span>
<span style="color: #A00000">-                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Bad parameter\n");</span>
<span style="color: #A00000">-                return SWITCH_STATUS_FALSE;</span>
<span style="color: #A00000">-        }</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-        /* Build comma-separated list of field names by dropping $ { } ; chars */</span>
<span style="color: #A00000">-        switch_strdup(columns, template);</span>
<span style="color: #A00000">-        for (p = columns, q = columns; *p; ++p) {</span>
<span style="color: #A00000">-                switch (*p) {</span>
<span style="color: #A00000">-                        case '$': case '"': case '{': case '}': case ';':</span>
<span style="color: #A00000">-                                break;</span>
<span style="color: #A00000">-                        default:</span>
<span style="color: #A00000">-                                *q++ = *p;</span>
<span style="color: #A00000">-                }</span>
<span style="color: #A00000">-        }</span>
<span style="color: #A00000">-        *q = '\0';</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-        /*</span>
<span style="color: #A00000">-         * In the expanded vars, replace double quotes (") with single quotes (')</span>
<span style="color: #A00000">-         * for correct PostgreSQL syntax, and replace semi-colon with space to</span>
<span style="color: #A00000">-         * prevent SQL injection attacks</span>
<span style="color: #A00000">-         */</span>
<span style="color: #A00000">-        switch_strdup(values, cdr);</span>
<span style="color: #A00000">-        for (p = values; *p; ++p) {</span>
<span style="color: #A00000">-                switch(*p) {</span>
<span style="color: #A00000">-                        case '"':</span>
<span style="color: #A00000">-                                *p = '\'';</span>
<span style="color: #A00000">-                                break;</span>
<span style="color: #A00000">-                        case ';':</span>
<span style="color: #A00000">-                                *p = ' ';</span>
<span style="color: #A00000">-                                break;</span>
<span style="color: #A00000">-                }</span>
<span style="color: #A00000">-        }</span>
<span style="color: #A00000">-        vlen = p - values;</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-        /*</span>
<span style="color: #A00000">-         * Patch for changing empty strings ('') in the expanded variables to</span>
<span style="color: #A00000">-         * PostgreSQL null</span>
<span style="color: #A00000">-         */</span>
<span style="color: #A00000">-        for (p = values; *p; ++p) {</span>
<span style="color: #A00000">-                if (*p == ',') {</span>
<span style="color: #A00000">-                        if (charCounter == 0) {</span>
<span style="color: #A00000">-                                nullCounter++;</span>
<span style="color: #A00000">-                        }</span>
<span style="color: #A00000">-                        charCounter = 0;</span>
<span style="color: #A00000">-                } else if (*p != ' ' && *p != '\'') {</span>
<span style="color: #A00000">-                        charCounter++;</span>
<span style="color: #A00000">-                }</span>
<span style="color: #A00000">-        }</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-        if (charCounter == 0) {</span>
<span style="color: #A00000">-                nullCounter++;</span>
<span style="color: #A00000">-        }</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-        nullCounter *= 4;</span>
<span style="color: #A00000">-        vlen += nullCounter;</span>
<span style="color: #A00000">-        switch_zmalloc(nullValues, strlen(values) + nullCounter + 1);</span>
<span style="color: #A00000">-        charCounter = 0;</span>
<span style="color: #A00000">-        temp = nullValues;</span>
<span style="color: #A00000">-        tp = nullValues;</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-        for (p = values; *p; ++tp, ++p) {</span>
<span style="color: #A00000">-                if (*p == ',') {</span>
<span style="color: #A00000">-                        if (charCounter == 0) {</span>
<span style="color: #A00000">-                                temp++;</span>
<span style="color: #A00000">-                                *temp = 'n';</span>
<span style="color: #A00000">-                                temp++;</span>
<span style="color: #A00000">-                                if (temp == tp) tp++;</span>
<span style="color: #A00000">-                                *temp = 'u';</span>
<span style="color: #A00000">-                                temp++;</span>
<span style="color: #A00000">-                                if (temp == tp) tp++;</span>
<span style="color: #A00000">-                                *temp = 'l';</span>
<span style="color: #A00000">-                                temp++;</span>
<span style="color: #A00000">-                                if (temp == tp) tp++;</span>
<span style="color: #A00000">-                                *temp = 'l';</span>
<span style="color: #A00000">-                                temp++;</span>
<span style="color: #A00000">-                                while (temp != tp) {</span>
<span style="color: #A00000">-                                        *temp = ' ';</span>
<span style="color: #A00000">-                                        temp++;</span>
<span style="color: #A00000">-                                }</span>
<span style="color: #A00000">-                        }</span>
<span style="color: #A00000">-                        charCounter = 0;</span>
<span style="color: #A00000">-                        temp = tp;</span>
<span style="color: #A00000">-                } else if (*p != ' ' && *p != '\'') {</span>
<span style="color: #A00000">-                        charCounter++;</span>
<span style="color: #A00000">-                }</span>
<span style="color: #A00000">-                *tp = *p;</span>
<span style="color: #A00000">-        }</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-        if (charCounter == 0) {</span>
<span style="color: #A00000">-                temp++;</span>
<span style="color: #A00000">-                *temp = 'n';</span>
<span style="color: #A00000">-                temp++;</span>
<span style="color: #A00000">-                if (temp == tp) tp++;</span>
<span style="color: #A00000">-                *temp = 'u';</span>
<span style="color: #A00000">-                temp++;</span>
<span style="color: #A00000">-                if (temp == tp) tp++;</span>
<span style="color: #A00000">-                *temp = 'l';</span>
<span style="color: #A00000">-                temp++;</span>
<span style="color: #A00000">-                if (temp == tp) tp++;</span>
<span style="color: #A00000">-                *temp = 'l';</span>
<span style="color: #A00000">-                temp++;</span>
<span style="color: #A00000">-                while (temp != tp) {</span>
<span style="color: #A00000">-                        *temp = ' ';</span>
<span style="color: #A00000">-                        temp++;</span>
<span style="color: #A00000">-                }</span>
<span style="color: #A00000">-        }</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-        charCounter = 0;</span>
<span style="color: #A00000">-        temp = tp;</span>
<span style="color: #A00000">-        *tp = 0;</span>
<span style="color: #A00000">-        tp = values;</span>
<span style="color: #A00000">-        values = nullValues;</span>
<span style="color: #A00000">-        switch_safe_free(tp);</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-        sql = switch_mprintf("INSERT INTO %s (%s) VALUES (%s);", globals.db_table, columns, values);</span>
<span style="color: #00A000">+        sql = switch_mprintf("INSERT INTO %s (%s) VALUES (%s);", globals.db_table, globals.db_schema->columns, values);</span>
        assert(sql);
<span style="color: #A00000">-        switch_safe_free(columns);</span>
<span style="color: #A00000">-        switch_safe_free(values);</span>
        if (globals.debug) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Query: \"%s\"\n", sql);
<span style="color: #800080; font-weight: bold">@@ -415,7 +298,7 @@ static switch_status_t insert_cdr(const char * const template, const char * cons</span>
        } else {
                path = switch_mprintf("%s%scdr-spool.csv", globals.spool_dir, SWITCH_PATH_SEPARATOR);
                assert(path);
<span style="color: #A00000">-                spool_cdr(path, cdr);</span>
<span style="color: #00A000">+                spool_cdr(path, values);</span>
        }
        switch_safe_free(path);
<span style="color: #800080; font-weight: bold">@@ -428,8 +311,10 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)</span>
{
        switch_channel_t *channel = switch_core_session_get_channel(session);
        switch_status_t status = SWITCH_STATUS_SUCCESS;
<span style="color: #A00000">-        const char *template_str = NULL;</span>
<span style="color: #A00000">-        char *expanded_vars = NULL;</span>
<span style="color: #00A000">+        char *values = NULL, *tmp = NULL, *pq_var = NULL;</span>
<span style="color: #00A000">+        const char *var = NULL;</span>
<span style="color: #00A000">+        cdr_field_t *cdr_field = NULL;</span>
<span style="color: #00A000">+        switch_size_t len, offset;</span>
        if (globals.shutdown) {
                return SWITCH_STATUS_SUCCESS;
<span style="color: #800080; font-weight: bold">@@ -465,24 +350,40 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)</span>
                }
        }
<span style="color: #A00000">-        template_str = (const char *) switch_core_hash_find(globals.template_hash, globals.default_template);</span>
<span style="color: #00A000">+        switch_zmalloc(values, 1);</span>
<span style="color: #00A000">+        offset = 0;</span>
<span style="color: #A00000">-        if (!template_str) {</span>
<span style="color: #A00000">-                template_str = default_template;</span>
<span style="color: #A00000">-        }</span>
<span style="color: #00A000">+        for (cdr_field = globals.db_schema->fields; cdr_field->var_name; cdr_field++) {</span>
<span style="color: #00A000">+                if ((var = switch_channel_get_variable(channel, cdr_field->var_name))) {</span>
<span style="color: #00A000">+                        /* Allocate sufficient buffer for PQescapeString */</span>
<span style="color: #00A000">+                        len = strlen(var);</span>
<span style="color: #00A000">+                        tmp = switch_core_session_alloc(session, len * 2 + 1);</span>
<span style="color: #00A000">+                        PQescapeString(tmp, var, len);</span>
<span style="color: #00A000">+                        var = tmp;</span>
<span style="color: #00A000">+                }</span>
<span style="color: #A00000">-        expanded_vars = switch_channel_expand_variables(channel, template_str);</span>
<span style="color: #00A000">+                if (cdr_field->quote) {</span>
<span style="color: #00A000">+                        if ((cdr_field->not_null == SWITCH_FALSE) && zstr(var)) {</span>
<span style="color: #00A000">+                                pq_var = switch_mprintf("null,", var);</span>
<span style="color: #00A000">+                        } else {</span>
<span style="color: #00A000">+                                pq_var = switch_mprintf("'%s',", var);</span>
<span style="color: #00A000">+                        }</span>
<span style="color: #00A000">+                } else {</span>
<span style="color: #00A000">+                        pq_var = switch_mprintf("%s,", var);</span>
<span style="color: #00A000">+                }</span>
<span style="color: #A00000">-        if (!expanded_vars) {</span>
<span style="color: #A00000">-                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error expanding CDR variables.\n");</span>
<span style="color: #A00000">-                return SWITCH_STATUS_FALSE;</span>
<span style="color: #00A000">+                /* Resize values buffer to accomodate next var */</span>
<span style="color: #00A000">+                len = strlen(pq_var);</span>
<span style="color: #00A000">+                tmp = realloc(values, offset + len);</span>
<span style="color: #00A000">+                values = tmp;</span>
<span style="color: #00A000">+                memcpy(values + offset, pq_var, len);</span>
<span style="color: #00A000">+                switch_safe_free(pq_var);</span>
<span style="color: #00A000">+                offset += len;</span>
        }
<span style="color: #00A000">+        *(values + --offset) = '\0';</span>
<span style="color: #A00000">-        insert_cdr(template_str, expanded_vars);</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-        if (expanded_vars != template_str) {</span>
<span style="color: #A00000">-                switch_safe_free(expanded_vars);</span>
<span style="color: #A00000">-        }</span>
<span style="color: #00A000">+        insert_cdr(values);</span>
<span style="color: #00A000">+        switch_safe_free(values);</span>
        return status;
}
<span style="color: #800080; font-weight: bold">@@ -532,9 +433,13 @@ static switch_state_handler_table_t state_handlers = {</span>
static switch_status_t load_config(switch_memory_pool_t *pool)
{
<span style="color: #A00000">-        char *cf = "cdr_pg_csv.conf";</span>
<span style="color: #A00000">-        switch_xml_t cfg, xml, settings, param;</span>
        switch_status_t status = SWITCH_STATUS_SUCCESS;
<span style="color: #00A000">+        char *cf = "cdr_pg_csv.conf", *ptr;</span>
<span style="color: #00A000">+        switch_xml_t cfg, xml, schema, field;</span>
<span style="color: #00A000">+        const char *attr;</span>
<span style="color: #00A000">+        int num_fields = 0;</span>
<span style="color: #00A000">+        switch_size_t len = 0;</span>
<span style="color: #00A000">+        cdr_field_t *cdr_field;</span>
        if (globals.db_online) {
                PQfinish(globals.db_connection);
<span style="color: #800080; font-weight: bold">@@ -544,32 +449,69 @@ static switch_status_t load_config(switch_memory_pool_t *pool)</span>
        memset(&globals, 0, sizeof(globals));
        switch_core_hash_init(&globals.fd_hash, pool);
<span style="color: #A00000">-        switch_core_hash_init(&globals.template_hash, pool);</span>
        switch_mutex_init(&globals.db_mutex, SWITCH_MUTEX_NESTED, pool);
        globals.pool = pool;
<span style="color: #A00000">-        switch_core_hash_insert(globals.template_hash, "default", default_template);</span>
<span style="color: #A00000">-        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Adding default template.\n");</span>
<span style="color: #A00000">-        globals.legs = CDR_LEG_A;</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-        if (switch_xml_config_parse_module_settings("cdr_pg_csv.conf", SWITCH_FALSE, config_settings) != SWITCH_STATUS_SUCCESS) {</span>
<span style="color: #00A000">+        if (switch_xml_config_parse_module_settings(cf, SWITCH_FALSE, config_settings) != SWITCH_STATUS_SUCCESS) {</span>
                return SWITCH_STATUS_FALSE;
        }
        if ((xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
<span style="color: #A00000">-                if ((settings = switch_xml_child(cfg, "templates"))) {</span>
<span style="color: #A00000">-                        for (param = switch_xml_child(settings, "template"); param; param = param->next) {</span>
<span style="color: #A00000">-                                char *var = (char *) switch_xml_attr(param, "name");</span>
<span style="color: #A00000">-                                if (var) {</span>
<span style="color: #A00000">-                                        char *tpl;</span>
<span style="color: #A00000">-                                        tpl = switch_core_strdup(pool, param->txt);</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                                        switch_core_hash_insert(globals.template_hash, var, tpl);</span>
<span style="color: #A00000">-                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Adding template %s.\n", var);</span>
<span style="color: #00A000">+                if ((schema = switch_xml_child(cfg, "schema"))) {</span>
<span style="color: #00A000">+                        /* Count fields in schema so we can calculate required buffer size */</span>
<span style="color: #00A000">+                        for (field = switch_xml_child(schema, "field"); field; field = field->next) {</span>
<span style="color: #00A000">+                                if (switch_xml_attr(field, "var")) {</span>
<span style="color: #00A000">+                                        num_fields++;</span>
                                }
                        }
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                        globals.db_schema = switch_core_alloc(pool, (num_fields + 1) * sizeof(cdr_field_t));</span>
<span style="color: #00A000">+                        cdr_field = globals.db_schema->fields;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                        for (field = switch_xml_child(schema, "field"); field; field = field->next) {</span>
<span style="color: #00A000">+                                if ((attr = switch_xml_attr(field, "var"))) {</span>
<span style="color: #00A000">+                                        cdr_field->var_name = switch_core_strdup(pool, attr);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                                        /* Assume SQL column name is the same as FreeSWITCH channel var name, unless specified otherwise */</span>
<span style="color: #00A000">+                                        if ((attr = switch_xml_attr(field, "column"))) {</span>
<span style="color: #00A000">+                                                cdr_field->col_name = switch_core_strdup(pool, attr);</span>
<span style="color: #00A000">+                                        } else {</span>
<span style="color: #00A000">+                                                cdr_field->col_name = switch_core_strdup(pool, cdr_field->var_name);</span>
<span style="color: #00A000">+                                        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                                        /* Assume all fields should be quoted (treated as strings), unless specified otherwise */</span>
<span style="color: #00A000">+                                        if ((attr = switch_xml_attr(field, "quote")) && !strncmp(attr, "false", 5)) {</span>
<span style="color: #00A000">+                                                cdr_field->quote = SWITCH_FALSE;</span>
<span style="color: #00A000">+                                        } else {</span>
<span style="color: #00A000">+                                                cdr_field->quote = SWITCH_TRUE;</span>
<span style="color: #00A000">+                                        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                                        /* Assume all fields allow SQL nulls, unless specified otherwise */</span>
<span style="color: #00A000">+                                        if ((attr = switch_xml_attr(field, "not-null")) && !strncmp(attr, "true", 4)) {</span>
<span style="color: #00A000">+                                                cdr_field->not_null = SWITCH_TRUE;</span>
<span style="color: #00A000">+                                        } else {</span>
<span style="color: #00A000">+                                                cdr_field->not_null = SWITCH_FALSE;</span>
<span style="color: #00A000">+                                        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                                        len += strlen(cdr_field->col_name) + 1;</span>
<span style="color: #00A000">+                                        cdr_field++;</span>
<span style="color: #00A000">+                                }</span>
<span style="color: #00A000">+                        }</span>
<span style="color: #00A000">+                        cdr_field->var_name = 0;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                        globals.db_schema->columns = switch_core_alloc(pool, len);</span>
<span style="color: #00A000">+                        ptr = globals.db_schema->columns;</span>
<span style="color: #00A000">+                        for (cdr_field = globals.db_schema->fields; cdr_field->col_name; cdr_field++) {</span>
<span style="color: #00A000">+                                len = strlen(cdr_field->col_name);</span>
<span style="color: #00A000">+                                memcpy(ptr, cdr_field->col_name, len);</span>
<span style="color: #00A000">+                                ptr += len;</span>
<span style="color: #00A000">+                                *ptr = ',';</span>
<span style="color: #00A000">+                                ptr++;</span>
<span style="color: #00A000">+                        }</span>
<span style="color: #00A000">+                        *--ptr = '\0';</span>
                }
<span style="color: #00A000">+</span>
                switch_xml_free(xml);
        }
<span style="color: #800080; font-weight: bold">@@ -596,7 +538,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_cdr_pg_csv_load)</span>
        switch_core_add_state_handler(&state_handlers);
        *module_interface = switch_loadable_module_create_module_interface(pool, modname);
<span style="color: #A00000">-</span>
        return status;
}
</pre></div>
<div class="highlight"><pre>committer: Anthony Minessale
comments:
default to 10
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c</span>
<span style="color: #000080; font-weight: bold">index c78aac7..c683203 100644</span>
<span style="color: #A00000">--- a/src/mod/endpoints/mod_sofia/mod_sofia.c</span>
<span style="color: #00A000">+++ b/src/mod/endpoints/mod_sofia/mod_sofia.c</span>
<span style="color: #800080; font-weight: bold">@@ -3708,7 +3708,7 @@ SWITCH_STANDARD_API(sofia_function)</span>
                                if (argc > 2) {
                                        if (strstr(argv[2], "presence")) {
<span style="color: #A00000">-                                                mod_sofia_globals.debug_presence = 1;</span>
<span style="color: #00A000">+                                                mod_sofia_globals.debug_presence = 10;</span>
                                                stream->write_function(stream, "+OK Debugging presence\n");
                                        }
                                        
</pre></div>
<div class="highlight"><pre>committer: Anthony Minessale
comments:
FS-3038
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c</span>
<span style="color: #000080; font-weight: bold">index 807770a..f34042a 100644</span>
<span style="color: #A00000">--- a/src/mod/applications/mod_commands/mod_commands.c</span>
<span style="color: #00A000">+++ b/src/mod/applications/mod_commands/mod_commands.c</span>
<span style="color: #800080; font-weight: bold">@@ -4439,19 +4439,23 @@ SWITCH_STANDARD_API(strftime_tz_api_function)</span>
                if ((format = strchr(mycmd, ' '))) {
                        *format++ = '\0';
<span style="color: #A00000">-                }</span>
                
<span style="color: #A00000">-                if ((p = strchr(format, '|'))) {</span>
<span style="color: #A00000">-                        *p++ = '\0';</span>
<span style="color: #A00000">-                        when = atol(format);</span>
<span style="color: #A00000">-                        format = p;</span>
<span style="color: #00A000">+                        if (format && (p = strchr(format, '|'))) {</span>
<span style="color: #00A000">+                                *p++ = '\0';</span>
<span style="color: #00A000">+                                when = atol(format);</span>
<span style="color: #00A000">+                                format = p;</span>
<span style="color: #00A000">+                        }</span>
                }
        }
<span style="color: #A00000">-        if (switch_strftime_tz(tz_name, format, date, sizeof(date), when * 1000000) == SWITCH_STATUS_SUCCESS) {        /* The lookup of the zone may fail. */</span>
<span style="color: #00A000">+        if (zstr(format)) {</span>
<span style="color: #00A000">+                format = "%Y-%m-%d";</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        </span>
<span style="color: #00A000">+        if (format && switch_strftime_tz(tz_name, format, date, sizeof(date), when * 1000000) == SWITCH_STATUS_SUCCESS) {        /* The lookup of the zone may fail. */</span>
                stream->write_function(stream, "%s", date);
        } else {
<span style="color: #A00000">-                stream->write_function(stream, "-ERR Invalid Timezone\n");</span>
<span style="color: #00A000">+                stream->write_function(stream, "-ERR Invalid Timezone/Format\n");</span>
        }
        switch_safe_free(mycmd);
</pre></div>
<div class="highlight"><pre>committer: Anthony Minessale
comments:
FS-3040
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c</span>
<span style="color: #000080; font-weight: bold">index f829e57..bea8214 100644</span>
<span style="color: #A00000">--- a/src/mod/applications/mod_voicemail/mod_voicemail.c</span>
<span style="color: #00A000">+++ b/src/mod/applications/mod_voicemail/mod_voicemail.c</span>
<span style="color: #800080; font-weight: bold">@@ -1277,9 +1277,14 @@ static void message_count(vm_profile_t *profile, const char *id_in, const char *</span>
        myid = resolve_id(id_in, domain_name, "message-count");
<span style="color: #A00000">-        switch_snprintf(sql, sizeof(sql), "select 1, read_flags, count(read_epoch) from voicemail_msgs where username='%s' and domain='%s' and in_folder='%s' "</span>
<span style="color: #A00000">-                                                                         "and read_epoch=0 group by read_flags union select 0, read_flags, count(read_epoch) from voicemail_msgs where username='%s' "</span>
<span style="color: #A00000">-                                                                         "and domain='%s' and in_folder='%s' and read_epoch<>0 group by read_flags;", myid, domain_name, myfolder);</span>
<span style="color: #00A000">+        switch_snprintf(sql, sizeof(sql), "select 1, read_flags, count(read_epoch) from voicemail_msgs where "</span>
<span style="color: #00A000">+                                        "username='%s' and domain='%s' and in_folder='%s' "</span>
<span style="color: #00A000">+                                        "and read_epoch=0 group by read_flags union select 0, read_flags, count(read_epoch) from voicemail_msgs where username='%s' "</span>
<span style="color: #00A000">+                                        "and domain='%s' and in_folder='%s' and read_epoch<>0 group by read_flags;", </span>
<span style="color: #00A000">+                                        myid, domain_name, myfolder, myid, domain_name, myfolder);</span>
<span style="color: #00A000">+                                        </span>
<span style="color: #00A000">+                                 </span>
<span style="color: #00A000">+</span>
        vm_execute_sql_callback(profile, profile->mutex, sql, message_count_callback, &cbt);
        *total_new_messages = cbt.total_new_messages + cbt.total_new_urgent_messages;
</pre></div>
<div class="highlight"><pre>committer: Daniel Swarbrick
comments:
refactor config parsing
<span style="color: #000080; font-weight: bold">diff --git a/conf/autoload_configs/cdr_pg_csv.conf.xml b/conf/autoload_configs/cdr_pg_csv.conf.xml</span>
<span style="color: #000080; font-weight: bold">index 2f2efa9..427bf2d 100644</span>
<span style="color: #A00000">--- a/conf/autoload_configs/cdr_pg_csv.conf.xml</span>
<span style="color: #00A000">+++ b/conf/autoload_configs/cdr_pg_csv.conf.xml</span>
<span style="color: #800080; font-weight: bold">@@ -1,19 +1,23 @@</span>
<configuration name="cdr_pg_csv.conf" description="CDR PG CSV Format">
<settings>
<span style="color: #A00000">- <!-- Log a-leg (a), b-leg (b) or both (ab) --></span>
<span style="color: #A00000">- <param name="legs" value="a"/></span>
<!-- See parameters for PQconnectdb() at http://www.postgresql.org/docs/8.4/static/libpq-connect.html -->
<param name="db-info" value="host=localhost dbname=cdr connect_timeout=10" />
<!-- CDR table name -->
<!--<param name="db-table" value="cdr"/>-->
<span style="color: #A00000">- <param name="default-template" value="example"/></span>
<span style="color: #A00000">- <!-- 'cdr-pg-csv' will always be appended to log-base --></span>
<span style="color: #A00000">- <!--<param name="log-base" value="/var/log"/>--></span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+ <!-- Log a-leg (a), b-leg (b) or both (ab) --></span>
<span style="color: #00A000">+ <param name="legs" value="a"/></span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+ <!-- Directory in which to spool failed SQL inserts --></span>
<span style="color: #00A000">+ <!-- <param name="spool-dir" value="$${base_dir}/log/cdr-pg-csv"/> --></span>
<!-- Disk spool format if DB connection/insert fails - csv (default) or sql -->
<param name="spool-format" value="csv"/>
<param name="rotate-on-hup" value="true"/>
<span style="color: #00A000">+</span>
<!-- This is like the info app but after the call is hung up -->
<!--<param name="debug" value="true"/>-->
<span style="color: #00A000">+</span>
<span style="color: #00A000">+ <param name="default-template" value="example"/></span>
</settings>
<templates>
<template name="example">"${local_ip_v4}","${caller_id_name}","${caller_id_number}","${destination_number}","${context}","${start_stamp}","${answer_stamp}","${end_stamp}","${duration}","${billsec}","${hangup_cause}","${uuid}","${bleg_uuid}","${accountcode}","${read_codec}","${write_codec}","${sip_hangup_disposition}","${ani}"</template>
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c b/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c</span>
<span style="color: #000080; font-weight: bold">index 5227161..1ec56bd 100644</span>
<span style="color: #A00000">--- a/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c</span>
<span style="color: #00A000">+++ b/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c</span>
<span style="color: #800080; font-weight: bold">@@ -37,18 +37,27 @@</span>
#include <switch.h>
#include <libpq-fe.h>
<span style="color: #00A000">+SWITCH_MODULE_LOAD_FUNCTION(mod_cdr_pg_csv_load);</span>
<span style="color: #00A000">+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_cdr_pg_csv_shutdown);</span>
<span style="color: #00A000">+SWITCH_MODULE_DEFINITION(mod_cdr_pg_csv, mod_cdr_pg_csv_load, mod_cdr_pg_csv_shutdown, NULL);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
typedef enum {
        CDR_LEG_A = (1 << 0),
        CDR_LEG_B = (1 << 1)
} cdr_leg_t;
<span style="color: #A00000">-struct cdr_fd {</span>
<span style="color: #00A000">+typedef enum {</span>
<span style="color: #00A000">+        SPOOL_FORMAT_CSV,</span>
<span style="color: #00A000">+        SPOOL_FORMAT_SQL</span>
<span style="color: #00A000">+} spool_format_t;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+typedef struct {</span>
        int fd;
        char *path;
        int64_t bytes;
        switch_mutex_t *mutex;
<span style="color: #A00000">-};</span>
<span style="color: #A00000">-typedef struct cdr_fd cdr_fd_t;</span>
<span style="color: #00A000">+} cdr_fd_t;</span>
const char *default_template =
        "\"${local_ip_v4}\",\"${caller_id_name}\",\"${caller_id_number}\",\"${destination_number}\",\"${context}\",\"${start_stamp}\","
<span style="color: #800080; font-weight: bold">@@ -59,23 +68,59 @@ static struct {</span>
        switch_memory_pool_t *pool;
        switch_hash_t *fd_hash;
        switch_hash_t *template_hash;
<span style="color: #A00000">-        char *log_dir;</span>
<span style="color: #A00000">-        char *default_template;</span>
        int shutdown;
<span style="color: #A00000">-        int rotate;</span>
<span style="color: #A00000">-        int debug;</span>
<span style="color: #A00000">-        cdr_leg_t legs;</span>
        char *db_info;
        char *db_table;
<span style="color: #A00000">-        char *spool_format;</span>
        PGconn *db_connection;
        int db_online;
<span style="color: #00A000">+        cdr_leg_t legs;</span>
<span style="color: #00A000">+        char *spool_dir;</span>
<span style="color: #00A000">+        spool_format_t spool_format;</span>
<span style="color: #00A000">+        int rotate;</span>
<span style="color: #00A000">+        int debug;</span>
<span style="color: #00A000">+        char *default_template;</span>
        switch_mutex_t *db_mutex;
} globals = { 0 };
<span style="color: #A00000">-SWITCH_MODULE_LOAD_FUNCTION(mod_cdr_pg_csv_load);</span>
<span style="color: #A00000">-SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_cdr_pg_csv_shutdown);</span>
<span style="color: #A00000">-SWITCH_MODULE_DEFINITION(mod_cdr_pg_csv, mod_cdr_pg_csv_load, mod_cdr_pg_csv_shutdown, NULL);</span>
<span style="color: #00A000">+static switch_xml_config_enum_item_t config_opt_cdr_leg_enum[] = {</span>
<span style="color: #00A000">+ {"a", CDR_LEG_A},</span>
<span style="color: #00A000">+ {"b", CDR_LEG_B},</span>
<span style="color: #00A000">+ {"ab", CDR_LEG_A | CDR_LEG_B},</span>
<span style="color: #00A000">+ {NULL, 0}</span>
<span style="color: #00A000">+};</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+static switch_xml_config_enum_item_t config_opt_spool_format_enum[] = {</span>
<span style="color: #00A000">+ {"csv", SPOOL_FORMAT_CSV},</span>
<span style="color: #00A000">+ {"sql", SPOOL_FORMAT_SQL},</span>
<span style="color: #00A000">+ {NULL, 0}</span>
<span style="color: #00A000">+};</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+static switch_status_t config_validate_spool_dir(switch_xml_config_item_t *item, const char *newvalue, switch_config_callback_type_t callback_type, switch_bool_t changed)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        if ((callback_type == CONFIG_LOAD || callback_type == CONFIG_RELOAD)) {</span>
<span style="color: #00A000">+                if (zstr(newvalue)) {</span>
<span style="color: #00A000">+                        globals.spool_dir = switch_core_sprintf(globals.pool, "%s%scdr-pg-csv", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR);</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return SWITCH_STATUS_SUCCESS;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+static switch_xml_config_item_t config_settings[] = {</span>
<span style="color: #00A000">+        /* key, type, flags, ptr, default_value, data, syntax, helptext */</span>
<span style="color: #00A000">+        SWITCH_CONFIG_ITEM_STRING_STRDUP("db-info", CONFIG_RELOADABLE, &globals.db_info, "dbname=cdr", NULL, NULL),</span>
<span style="color: #00A000">+        SWITCH_CONFIG_ITEM_STRING_STRDUP("db-table", CONFIG_RELOADABLE, &globals.db_table, "cdr", NULL, NULL),</span>
<span style="color: #00A000">+        SWITCH_CONFIG_ITEM_STRING_STRDUP("default-template", CONFIG_RELOADABLE, &globals.default_template, "default", NULL, NULL),</span>
<span style="color: #00A000">+        SWITCH_CONFIG_ITEM("legs", SWITCH_CONFIG_ENUM, CONFIG_RELOADABLE, &globals.legs, (void *) CDR_LEG_A, &config_opt_cdr_leg_enum, "a|b|ab", NULL),</span>
<span style="color: #00A000">+        SWITCH_CONFIG_ITEM("spool-format", SWITCH_CONFIG_ENUM, CONFIG_RELOADABLE, &globals.spool_format, (void *) SPOOL_FORMAT_CSV, &config_opt_spool_format_enum, "csv|sql", "Disk spool format to use if SQL insert fails."),</span>
<span style="color: #00A000">+        SWITCH_CONFIG_ITEM("rotate-on-hup", SWITCH_CONFIG_BOOL, CONFIG_RELOADABLE, &globals.rotate, SWITCH_FALSE, NULL, NULL, NULL),</span>
<span style="color: #00A000">+        SWITCH_CONFIG_ITEM("debug", SWITCH_CONFIG_BOOL, CONFIG_RELOADABLE, &globals.debug, SWITCH_FALSE, NULL, NULL, NULL),</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* key, type, flags, ptr, defaultvalue, function, functiondata, syntax, helptext */</span>
<span style="color: #00A000">+        SWITCH_CONFIG_ITEM_CALLBACK("spool-dir", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, &globals.spool_dir, NULL, config_validate_spool_dir, NULL, NULL, NULL),</span>
<span style="color: #00A000">+        SWITCH_CONFIG_ITEM_END()</span>
<span style="color: #00A000">+};</span>
<span style="color: #00A000">+</span>
static off_t fd_size(int fd)
{
<span style="color: #800080; font-weight: bold">@@ -363,12 +408,12 @@ static switch_status_t insert_cdr(const char * const template, const char * cons</span>
        switch_mutex_unlock(globals.db_mutex);
        /* SQL INSERT failed for whatever reason. Spool the attempted query to disk */
<span style="color: #A00000">-        if (!strcasecmp(globals.spool_format, "sql")) {</span>
<span style="color: #A00000">-                path = switch_mprintf("%s%scdr-spool.sql", globals.log_dir, SWITCH_PATH_SEPARATOR);</span>
<span style="color: #00A000">+        if (globals.spool_format == SPOOL_FORMAT_SQL) {</span>
<span style="color: #00A000">+                path = switch_mprintf("%s%scdr-spool.sql", globals.spool_dir, SWITCH_PATH_SEPARATOR);</span>
                assert(path);
                spool_cdr(path, sql);
        } else {
<span style="color: #A00000">-                path = switch_mprintf("%s%scdr-spool.csv", globals.log_dir, SWITCH_PATH_SEPARATOR);</span>
<span style="color: #00A000">+                path = switch_mprintf("%s%scdr-spool.csv", globals.spool_dir, SWITCH_PATH_SEPARATOR);</span>
                assert(path);
                spool_cdr(path, cdr);
        }
<span style="color: #800080; font-weight: bold">@@ -402,8 +447,8 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)</span>
                }
        }
<span style="color: #A00000">-        if (switch_dir_make_recursive(globals.log_dir, SWITCH_DEFAULT_DIR_PERMS, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {</span>
<span style="color: #A00000">-                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error creating %s\n", globals.log_dir);</span>
<span style="color: #00A000">+        if (switch_dir_make_recursive(globals.spool_dir, SWITCH_DEFAULT_DIR_PERMS, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {</span>
<span style="color: #00A000">+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error creating %s\n", globals.spool_dir);</span>
                return SWITCH_STATUS_FALSE;
        }
<span style="color: #800080; font-weight: bold">@@ -485,7 +530,6 @@ static switch_state_handler_table_t state_handlers = {</span>
};
<span style="color: #A00000">-</span>
static switch_status_t load_config(switch_memory_pool_t *pool)
{
        char *cf = "cdr_pg_csv.conf";
<span style="color: #800080; font-weight: bold">@@ -509,40 +553,11 @@ static switch_status_t load_config(switch_memory_pool_t *pool)</span>
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Adding default template.\n");
        globals.legs = CDR_LEG_A;
<span style="color: #A00000">-        if ((xml = switch_xml_open_cfg(cf, &cfg, NULL))) {</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                if ((settings = switch_xml_child(cfg, "settings"))) {</span>
<span style="color: #A00000">-                        for (param = switch_xml_child(settings, "param"); param; param = param->next) {</span>
<span style="color: #A00000">-                                char *var = (char *) switch_xml_attr_soft(param, "name");</span>
<span style="color: #A00000">-                                char *val = (char *) switch_xml_attr_soft(param, "value");</span>
<span style="color: #A00000">-                                if (!strcasecmp(var, "debug")) {</span>
<span style="color: #A00000">-                                        globals.debug = switch_true(val);</span>
<span style="color: #A00000">-                                } else if (!strcasecmp(var, "legs")) {</span>
<span style="color: #A00000">-                                        globals.legs = 0;</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                                        if (strchr(val, 'a')) {</span>
<span style="color: #A00000">-                                                globals.legs |= CDR_LEG_A;</span>
<span style="color: #A00000">-                                        }</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                                        if (strchr(val, 'b')) {</span>
<span style="color: #A00000">-                                                globals.legs |= CDR_LEG_B;</span>
<span style="color: #A00000">-                                        }</span>
<span style="color: #A00000">-                                } else if (!strcasecmp(var, "log-base")) {</span>
<span style="color: #A00000">-                                        globals.log_dir = switch_core_sprintf(pool, "%s%scdr-pg-csv", val, SWITCH_PATH_SEPARATOR);</span>
<span style="color: #A00000">-                                } else if (!strcasecmp(var, "rotate-on-hup")) {</span>
<span style="color: #A00000">-                                        globals.rotate = switch_true(val);</span>
<span style="color: #A00000">-                                } else if (!strcasecmp(var, "db-info")) {</span>
<span style="color: #A00000">-                                        globals.db_info = switch_core_strdup(pool, val);</span>
<span style="color: #A00000">-                                } else if (!strcasecmp(var, "db-table") || !strcasecmp(var, "g-table")) {</span>
<span style="color: #A00000">-                                        globals.db_table = switch_core_strdup(pool, val);</span>
<span style="color: #A00000">-                                } else if (!strcasecmp(var, "default-template")) {</span>
<span style="color: #A00000">-                                        globals.default_template = switch_core_strdup(pool, val);</span>
<span style="color: #A00000">-                                } else if (!strcasecmp(var, "spool-format")) {</span>
<span style="color: #A00000">-                                        globals.spool_format = switch_core_strdup(pool, val);</span>
<span style="color: #A00000">-                                }</span>
<span style="color: #A00000">-                        }</span>
<span style="color: #A00000">-                }</span>
<span style="color: #00A000">+        if (switch_xml_config_parse_module_settings("cdr_pg_csv.conf", SWITCH_FALSE, config_settings) != SWITCH_STATUS_SUCCESS) {</span>
<span style="color: #00A000">+                return SWITCH_STATUS_FALSE;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        if ((xml = switch_xml_open_cfg(cf, &cfg, NULL))) {</span>
                if ((settings = switch_xml_child(cfg, "templates"))) {
                        for (param = switch_xml_child(settings, "template"); param; param = param->next) {
                                char *var = (char *) switch_xml_attr(param, "name");
<span style="color: #800080; font-weight: bold">@@ -558,26 +573,6 @@ static switch_status_t load_config(switch_memory_pool_t *pool)</span>
                switch_xml_free(xml);
        }
<span style="color: #A00000">-        if (!globals.log_dir) {</span>
<span style="color: #A00000">-                globals.log_dir = switch_core_sprintf(pool, "%s%scdr-pg-csv", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR);</span>
<span style="color: #A00000">-        }</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-        if (zstr(globals.db_info)) {</span>
<span style="color: #A00000">-                globals.db_info = switch_core_strdup(pool, "dbname=cdr");</span>
<span style="color: #A00000">-        }</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-        if (zstr(globals.db_table)) {</span>
<span style="color: #A00000">-                globals.db_table = switch_core_strdup(pool, "cdr");</span>
<span style="color: #A00000">-        }</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-        if (zstr(globals.default_template)) {</span>
<span style="color: #A00000">-                globals.default_template = switch_core_strdup(pool, "default");</span>
<span style="color: #A00000">-        }</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-        if (zstr(globals.spool_format)) {</span>
<span style="color: #A00000">-                globals.spool_format = switch_core_strdup(pool, "csv");</span>
<span style="color: #A00000">-        }</span>
<span style="color: #A00000">-</span>
        return status;
}
<span style="color: #800080; font-weight: bold">@@ -588,8 +583,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_cdr_pg_csv_load)</span>
        load_config(pool);
<span style="color: #A00000">-        if ((status = switch_dir_make_recursive(globals.log_dir, SWITCH_DEFAULT_DIR_PERMS, pool)) != SWITCH_STATUS_SUCCESS) {</span>
<span style="color: #A00000">-                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error creating %s\n", globals.log_dir);</span>
<span style="color: #00A000">+        if ((status = switch_dir_make_recursive(globals.spool_dir, SWITCH_DEFAULT_DIR_PERMS, pool)) != SWITCH_STATUS_SUCCESS) {</span>
<span style="color: #00A000">+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error creating %s\n", globals.spool_dir);</span>
                return status;
        }
</pre></div>
<div class="highlight"><pre>committer: Konrad Hammel
comments:
freemtdm: ss7 - SPC no long in sng_gen...new configuration file
<span style="color: #000080; font-weight: bold">diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c</span>
<span style="color: #000080; font-weight: bold">index 01d1013..20bcc3a 100644</span>
<span style="color: #A00000">--- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c</span>
<span style="color: #00A000">+++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c</span>
<span style="color: #800080; font-weight: bold">@@ -99,6 +99,7 @@ int ft_to_sngss7_cfg_all(void)</span>
                        return 1;
                } else {
                        SS7_INFO("Started Stack Manager!\n");
<span style="color: #00A000">+                        sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_SM);</span>
                }
                /* check if the configuration had a Relay Channel */
<span style="color: #800080; font-weight: bold">@@ -575,12 +576,10 @@ int ftmod_ss7_mtp3_gen_config(void)</span>
        cfg.t.cfg.s.snGen.typeSP                = LSN_TYPE_SP;                /* type of signalling postatic int */
<span style="color: #A00000">-        cfg.t.cfg.s.snGen.spCode1                = g_ftdm_sngss7_data.cfg.spc;        /* our DPC for CCITT version */</span>
<span style="color: #A00000">-</span>
<span style="color: #00A000">+        cfg.t.cfg.s.snGen.spCode1                = 0;                                /* our DPC for CCITT version */</span>
#if (SS7_ANS92 || SS7_ANS88 || SS7_ANS96 || SS7_CHINA || defined(TDS_ROLL_UPGRADE_SUPPORT))
<span style="color: #A00000">-        cfg.t.cfg.s.snGen.spCode2                = g_ftdm_sngss7_data.cfg.spc;        /* our DPC for ANSI or CHINA version */</span>
<span style="color: #00A000">+        cfg.t.cfg.s.snGen.spCode2                = 0;                                /* our DPC for ANSI or CHINA version */</span>
#endif
<span style="color: #A00000">-</span>
        cfg.t.cfg.s.snGen.ssfValid                = TRUE;                                /* ssf validation required */
        cfg.t.cfg.s.snGen.nmbDLSap                = MAX_SN_LINKS;                /* number of MTP Data Link SAPs */
        cfg.t.cfg.s.snGen.nmbNSap                = MAX_SN_ROUTES;        /* number of Upper Layer Saps */
<span style="color: #000080; font-weight: bold">diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c</span>
<span style="color: #000080; font-weight: bold">index ad52827..2f2e502 100644</span>
<span style="color: #A00000">--- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c</span>
<span style="color: #00A000">+++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c</span>
<span style="color: #800080; font-weight: bold">@@ -1598,7 +1598,9 @@ static FIO_SIG_UNLOAD_FUNCTION(ftdm_sangoma_ss7_unload)</span>
                sngss7_clear_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_RY);
        }
<span style="color: #A00000">-        sng_isup_free_sm();</span>
<span style="color: #00A000">+        if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_SM)) {</span>
<span style="color: #00A000">+                sng_isup_free_sm();</span>
<span style="color: #00A000">+        }</span>
        sng_isup_free_gen();
<span style="color: #000080; font-weight: bold">diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c</span>
<span style="color: #000080; font-weight: bold">index dc6428d..46df990 100644</span>
<span style="color: #A00000">--- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c</span>
<span style="color: #00A000">+++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c</span>
<span style="color: #800080; font-weight: bold">@@ -464,11 +464,6 @@ static int ftmod_ss7_parse_sng_gen(ftdm_conf_node_t *sng_gen)</span>
                        SS7_DEBUG("Found license file = %s\n", g_ftdm_sngss7_data.cfg.license);
                        SS7_DEBUG("Found signature file = %s\n", g_ftdm_sngss7_data.cfg.signature);        
                /**********************************************************************/
<span style="color: #A00000">-                } else if (!strcasecmp(parm->var, "spc")) {</span>
<span style="color: #A00000">-                /**********************************************************************/</span>
<span style="color: #A00000">-                        g_ftdm_sngss7_data.cfg.spc = atoi(parm->val);</span>
<span style="color: #A00000">-                        SS7_DEBUG("Found SPC = %d\n", g_ftdm_sngss7_data.cfg.spc);</span>
<span style="color: #A00000">-                /**********************************************************************/</span>
                } else {
                /**********************************************************************/
                        SS7_ERROR("Found an invalid parameter \"%s\"!\n", parm->val);
</pre></div>
<div class="highlight"><pre>committer: Konrad Hammel
comments:
freetdm: ss7 - only unload layers when they are loaded freetdm: ss7 - configuration updated to allow a route to use multiple linksets...new configuration file
<span style="color: #000080; font-weight: bold">diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c</span>
<span style="color: #000080; font-weight: bold">index 15fc1ef..01d1013 100644</span>
<span style="color: #A00000">--- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c</span>
<span style="color: #00A000">+++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c</span>
<span style="color: #800080; font-weight: bold">@@ -74,6 +74,7 @@ int ftmod_ss7_relay_chan_config(int id);</span>
int ft_to_sngss7_cfg_all(void)
{
        int x = 0;
<span style="color: #00A000">+        int ret = 0;</span>
        /* check if we have done gen_config already */
        if (!(g_ftdm_sngss7_data.gen_config)) {
<span style="color: #800080; font-weight: bold">@@ -289,15 +290,17 @@ int ft_to_sngss7_cfg_all(void)</span>
                /* check if this link has been configured already */
                if (!(g_ftdm_sngss7_data.cfg.nsap[x].flags & SNGSS7_CONFIGURED)) {
<span style="color: #A00000">-                        if (ftmod_ss7_mtp3_nsap_config(x)) {</span>
<span style="color: #A00000">-                                SS7_CRITICAL("MTP3 NSAP %d configuration FAILED!\n", x);</span>
<span style="color: #00A000">+                        ret = ftmod_ss7_mtp3_nsap_config(x);</span>
<span style="color: #00A000">+                        if (ret) {</span>
<span style="color: #00A000">+                                SS7_CRITICAL("MTP3 NSAP %d configuration FAILED!(%s)\n", x, DECODE_LCM_REASON(ret));</span>
                                return 1;
                        } else {
                                SS7_INFO("MTP3 NSAP %d configuration DONE!\n", x);
                        }
<span style="color: #A00000">-                        if (ftmod_ss7_isup_nsap_config(x)) {</span>
<span style="color: #A00000">-                                SS7_CRITICAL("ISUP NSAP %d configuration FAILED!\n", x);</span>
<span style="color: #00A000">+                        ret = ftmod_ss7_isup_nsap_config(x);</span>
<span style="color: #00A000">+                        if (ret) {</span>
<span style="color: #00A000">+                                SS7_CRITICAL("ISUP NSAP %d configuration FAILED!(%s)\n", x, DECODE_LCM_REASON(ret));</span>
                                return 1;
                        } else {
                                SS7_INFO("ISUP NSAP %d configuration DONE!\n", x);
<span style="color: #800080; font-weight: bold">@@ -580,7 +583,7 @@ int ftmod_ss7_mtp3_gen_config(void)</span>
        cfg.t.cfg.s.snGen.ssfValid                = TRUE;                                /* ssf validation required */
        cfg.t.cfg.s.snGen.nmbDLSap                = MAX_SN_LINKS;                /* number of MTP Data Link SAPs */
<span style="color: #A00000">-        cfg.t.cfg.s.snGen.nmbNSap                = MAX_SN_VARIANTS;        /* number of Upper Layer Saps */</span>
<span style="color: #00A000">+        cfg.t.cfg.s.snGen.nmbNSap                = MAX_SN_ROUTES;        /* number of Upper Layer Saps */</span>
        cfg.t.cfg.s.snGen.nmbRouts                = MAX_SN_ROUTES;        /* maximum number of routing entries */
        cfg.t.cfg.s.snGen.nmbLnkSets        = MAX_SN_LINKSETS;        /* number of link sets */
        cfg.t.cfg.s.snGen.nmbRteInst        = MAX_SN_ROUTES*16;        /* number of simultaneous Rte instances */
<span style="color: #000080; font-weight: bold">diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c</span>
<span style="color: #000080; font-weight: bold">index 4ab4359..0298429 100644</span>
<span style="color: #A00000">--- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c</span>
<span style="color: #00A000">+++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c</span>
<span style="color: #800080; font-weight: bold">@@ -1131,45 +1131,56 @@ static ftdm_status_t handle_show_status(ftdm_stream_handle_t *stream, int span,</span>
                                        ss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj;
                                        ftdmchan = ss7_info->ftdmchan;
<span style="color: #A00000">-                                        /* grab the signaling_status */</span>
<span style="color: #A00000">-                                        ftdm_channel_get_sig_status(ftdmchan, &sigstatus);</span>
<span style="color: #A00000">-        </span>
<span style="color: #A00000">-                                        stream->write_function(stream, "span=%2d|chan=%2d|cic=%4d|sig_status=%4s|state=%s|",</span>
<span style="color: #A00000">-                                                                                                        ckt->span,</span>
<span style="color: #A00000">-                                                                                                        ckt->chan,</span>
<span style="color: #A00000">-                                                                                                        ckt->cic,</span>
<span style="color: #A00000">-                                                                                                        ftdm_signaling_status2str(sigstatus),</span>
<span style="color: #A00000">-                                                                                                        ftdm_channel_state2str(ftdmchan->state));</span>
<span style="color: #A00000">-        </span>
<span style="color: #A00000">-                                        if((sngss7_test_ckt_flag(ss7_info, FLAG_CKT_MN_BLOCK_TX)) || (sngss7_test_ckt_flag(ss7_info, FLAG_GRP_MN_BLOCK_TX))) {</span>
<span style="color: #A00000">-                                                stream->write_function(stream, "l_mn=Y|");</span>
<span style="color: #A00000">-                                        }else {</span>
<span style="color: #A00000">-                                                stream->write_function(stream, "l_mn=N|");</span>
<span style="color: #A00000">-                                        }</span>
<span style="color: #A00000">-        </span>
<span style="color: #A00000">-                                        if((sngss7_test_ckt_flag(ss7_info, FLAG_CKT_MN_BLOCK_RX)) || (sngss7_test_ckt_flag(ss7_info, FLAG_GRP_MN_BLOCK_RX))) {</span>
<span style="color: #A00000">-                                                stream->write_function(stream, "r_mn=Y|");</span>
<span style="color: #A00000">-                                        }else {</span>
<span style="color: #A00000">-                                                stream->write_function(stream, "r_mn=N|");</span>
<span style="color: #A00000">-                                        }</span>
<span style="color: #A00000">-        </span>
<span style="color: #A00000">-                                        if(sngss7_test_ckt_flag(ss7_info, FLAG_GRP_HW_BLOCK_TX)) {</span>
<span style="color: #A00000">-                                                stream->write_function(stream, "l_hw=Y|");</span>
<span style="color: #A00000">-                                        }else {</span>
<span style="color: #A00000">-                                                stream->write_function(stream, "l_hw=N|");</span>
<span style="color: #A00000">-                                        }</span>
<span style="color: #00A000">+                                        if (ftdmchan == NULL) {</span>
<span style="color: #00A000">+                                                /* this should never happen!!! */</span>
<span style="color: #00A000">+                                                stream->write_function(stream, "span=%2d|chan=%2d|cic=%4d|FTDMCHAN DOES NOT EXISTS",</span>
<span style="color: #00A000">+                                                                                                                ckt->span,</span>
<span style="color: #00A000">+                                                                                                                ckt->chan,</span>
<span style="color: #00A000">+                                                                                                                ckt->cic);</span>
<span style="color: #00A000">+                                                </span>
<span style="color: #00A000">+                                        } else {</span>
<span style="color: #00A000">+                                                /* grab the signaling_status */</span>
<span style="color: #00A000">+                                                ftdm_channel_get_sig_status(ftdmchan, &sigstatus);</span>
<span style="color: #00A000">+                </span>
<span style="color: #00A000">+                                                stream->write_function(stream, "span=%2d|chan=%2d|cic=%4d|sig_status=%4s|state=%s|",</span>
<span style="color: #00A000">+                                                                                                                ckt->span,</span>
<span style="color: #00A000">+                                                                                                                ckt->chan,</span>
<span style="color: #00A000">+                                                                                                                ckt->cic,</span>
<span style="color: #00A000">+                                                                                                                ftdm_signaling_status2str(sigstatus),</span>
<span style="color: #00A000">+                                                                                                                ftdm_channel_state2str(ftdmchan->state));</span>
<span style="color: #00A000">+                </span>
<span style="color: #00A000">+                                                if ((sngss7_test_ckt_flag(ss7_info, FLAG_CKT_MN_BLOCK_TX)) || </span>
<span style="color: #00A000">+                                                        (sngss7_test_ckt_flag(ss7_info, FLAG_GRP_MN_BLOCK_TX))) {</span>
<span style="color: #00A000">+                                                        stream->write_function(stream, "l_mn=Y|");</span>
<span style="color: #00A000">+                                                }else {</span>
<span style="color: #00A000">+                                                        stream->write_function(stream, "l_mn=N|");</span>
<span style="color: #00A000">+                                                }</span>
<span style="color: #00A000">+                </span>
<span style="color: #00A000">+                                                if ((sngss7_test_ckt_flag(ss7_info, FLAG_CKT_MN_BLOCK_RX)) || </span>
<span style="color: #00A000">+                                                        (sngss7_test_ckt_flag(ss7_info, FLAG_GRP_MN_BLOCK_RX))) {</span>
<span style="color: #00A000">+                                                        stream->write_function(stream, "r_mn=Y|");</span>
<span style="color: #00A000">+                                                }else {</span>
<span style="color: #00A000">+                                                        stream->write_function(stream, "r_mn=N|");</span>
<span style="color: #00A000">+                                                }</span>
<span style="color: #00A000">+                </span>
<span style="color: #00A000">+                                                if (sngss7_test_ckt_flag(ss7_info, FLAG_GRP_HW_BLOCK_TX)) {</span>
<span style="color: #00A000">+                                                        stream->write_function(stream, "l_hw=Y|");</span>
<span style="color: #00A000">+                                                }else {</span>
<span style="color: #00A000">+                                                        stream->write_function(stream, "l_hw=N|");</span>
<span style="color: #00A000">+                                                }</span>
<span style="color: #00A000">+                </span>
<span style="color: #00A000">+                                                if (sngss7_test_ckt_flag(ss7_info, FLAG_GRP_HW_BLOCK_RX)) {</span>
<span style="color: #00A000">+                                                        stream->write_function(stream, "r_hw=Y|");</span>
<span style="color: #00A000">+                                                }else {</span>
<span style="color: #00A000">+                                                        stream->write_function(stream, "r_hw=N|");</span>
<span style="color: #00A000">+                                                }</span>
        
<span style="color: #A00000">-                                        if(sngss7_test_ckt_flag(ss7_info, FLAG_GRP_HW_BLOCK_RX)) {</span>
<span style="color: #A00000">-                                                stream->write_function(stream, "r_hw=Y|");</span>
<span style="color: #A00000">-                                        }else {</span>
<span style="color: #A00000">-                                                stream->write_function(stream, "r_hw=N|");</span>
<span style="color: #00A000">+                                                if (sngss7_test_ckt_flag(ss7_info, FLAG_RELAY_DOWN)) {</span>
<span style="color: #00A000">+                                                        stream->write_function(stream, "relay=Y|");</span>
<span style="color: #00A000">+                                                }else {</span>
<span style="color: #00A000">+                                                        stream->write_function(stream, "relay=N|");</span>
<span style="color: #00A000">+                                                }</span>
                                        }
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                                        if(sngss7_test_ckt_flag(ss7_info, FLAG_RELAY_DOWN)) {</span>
<span style="color: #A00000">-                                                stream->write_function(stream, "relay=Y|");</span>
<span style="color: #A00000">-                                        }else {</span>
<span style="color: #A00000">-                                                stream->write_function(stream, "relay=N|");</span>
<span style="color: #A00000">-                                        }                </span>
        
                                        stream->write_function(stream, "flags=0x%X",ss7_info->ckt_flags);
        
<span style="color: #000080; font-weight: bold">diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c</span>
<span style="color: #000080; font-weight: bold">index adee000..ad52827 100644</span>
<span style="color: #A00000">--- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c</span>
<span style="color: #00A000">+++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c</span>
<span style="color: #800080; font-weight: bold">@@ -1570,26 +1570,33 @@ static FIO_SIG_UNLOAD_FUNCTION(ftdm_sangoma_ss7_unload)</span>
        if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_CC)) {
                sng_isup_free_cc();
<span style="color: #00A000">+                sngss7_clear_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_CC);</span>
        }
        if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_ISUP)) {
                ftmod_ss7_shutdown_isup();
                sng_isup_free_isup();
<span style="color: #00A000">+                sngss7_clear_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_ISUP);</span>
        }
        if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP3)) {
                ftmod_ss7_shutdown_mtp3();
                sng_isup_free_mtp3();
<span style="color: #00A000">+                sngss7_clear_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP3);</span>
        }
        if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP2)) {
                ftmod_ss7_shutdown_mtp2();
                sng_isup_free_mtp2();
                sng_isup_free_mtp1();
<span style="color: #00A000">+                sngss7_clear_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP2);</span>
        }
<span style="color: #A00000">-        ftmod_ss7_shutdown_relay();</span>
<span style="color: #A00000">-        sng_isup_free_relay();</span>
<span style="color: #00A000">+        if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_RY)) {</span>
<span style="color: #00A000">+                ftmod_ss7_shutdown_relay();</span>
<span style="color: #00A000">+                sng_isup_free_relay();</span>
<span style="color: #00A000">+                sngss7_clear_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_RY);</span>
<span style="color: #00A000">+        }</span>
        sng_isup_free_sm();
<span style="color: #000080; font-weight: bold">diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h</span>
<span style="color: #000080; font-weight: bold">index 5272aa8..fe291fb 100644</span>
<span style="color: #A00000">--- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h</span>
<span style="color: #00A000">+++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h</span>
<span style="color: #800080; font-weight: bold">@@ -219,13 +219,18 @@ typedef struct sng_link_set {</span>
        uint32_t                links[16];
} sng_link_set_t;
<span style="color: #00A000">+typedef struct sng_link_set_list {</span>
<span style="color: #00A000">+        uint32_t                                        lsId;</span>
<span style="color: #00A000">+        struct sng_link_set_list        *next;</span>
<span style="color: #00A000">+} sng_link_set_list_t;</span>
<span style="color: #00A000">+</span>
typedef struct sng_route {
        char                        name[MAX_NAME_LEN];
        uint32_t                flags;
        uint32_t                id;
        uint32_t                dpc;
        uint32_t                cmbLinkSetId;
<span style="color: #A00000">-        uint32_t                linkSetId;</span>
<span style="color: #00A000">+        struct sng_link_set_list        lnkSets;</span>
        uint32_t                linkType;
        uint32_t                switchType;
        uint32_t                ssf;
<span style="color: #000080; font-weight: bold">diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c</span>
<span style="color: #000080; font-weight: bold">index d2fa973..dc6428d 100644</span>
<span style="color: #A00000">--- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c</span>
<span style="color: #00A000">+++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c</span>
<span style="color: #800080; font-weight: bold">@@ -1268,9 +1268,9 @@ static int ftmod_ss7_parse_mtp_route(ftdm_conf_node_t *mtp_route)</span>
        ftdm_conf_parameter_t        *parm = mtp_route->parameters;
        int                                                 num_parms = mtp_route->n_parameters;
        int                                                 i;
<span style="color: #00A000">+        sng_link_set_list_t                *lnkSet;</span>
        ftdm_conf_node_t                *linkset;
<span style="color: #A00000">-        int                                                ls_id;</span>
        int                                                numLinks;
        /* initalize the mtpRoute structure */
<span style="color: #800080; font-weight: bold">@@ -1383,42 +1383,50 @@ static int ftmod_ss7_parse_mtp_route(ftdm_conf_node_t *mtp_route)</span>
        }
        /* fill in the rest of the values in the mtpRoute struct */
<span style="color: #A00000">-        mtpRoute.nwId = mtpRoute.id;</span>
<span style="color: #00A000">+        mtpRoute.nwId = 0;</span>
        mtpRoute.cmbLinkSetId = mtpRoute.id;
        /* parse in the list of linksets this route is reachable by */
        linkset = mtp_route->child->child;
<span style="color: #00A000">+        /* initalize the link-list of linkSet Ids */</span>
<span style="color: #00A000">+        lnkSet = &mtpRoute.lnkSets;</span>
<span style="color: #00A000">+</span>
        while (linkset != NULL) {
        /**************************************************************************/
                /* extract the linkset Id */
<span style="color: #A00000">-                ls_id = atoi(linkset->parameters->val);</span>
<span style="color: #00A000">+                lnkSet->lsId = atoi(linkset->parameters->val);</span>
<span style="color: #A00000">-                if (g_ftdm_sngss7_data.cfg.mtpLinkSet[ls_id].id != 0) {</span>
<span style="color: #A00000">-                        SS7_DEBUG("Found mtpRoute linkset id = %d that is valid\n",ls_id);</span>
<span style="color: #00A000">+                if (g_ftdm_sngss7_data.cfg.mtpLinkSet[lnkSet->lsId].id != 0) {</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found mtpRoute linkset id = %d that is valid\n",lnkSet->lsId);</span>
                } else {
<span style="color: #A00000">-                        SS7_ERROR("Found mtpRoute linkset id = %d that is invalid\n",ls_id);</span>
<span style="color: #00A000">+                        SS7_ERROR("Found mtpRoute linkset id = %d that is invalid\n",lnkSet->lsId);</span>
                        goto move_along;
                }
                /* pull up the linktype, switchtype, and SSF from the linkset */
<span style="color: #A00000">-                mtpRoute.linkType = g_ftdm_sngss7_data.cfg.mtpLinkSet[ls_id].linkType;</span>
<span style="color: #A00000">-                mtpRoute.switchType = g_ftdm_sngss7_data.cfg.mtpLinkSet[ls_id].switchType;</span>
<span style="color: #A00000">-                mtpRoute.ssf = g_ftdm_sngss7_data.cfg.mtpLinkSet[ls_id].ssf;</span>
<span style="color: #00A000">+                mtpRoute.linkType = g_ftdm_sngss7_data.cfg.mtpLinkSet[lnkSet->lsId].linkType;</span>
<span style="color: #00A000">+                mtpRoute.switchType = g_ftdm_sngss7_data.cfg.mtpLinkSet[lnkSet->lsId].switchType;</span>
<span style="color: #00A000">+                mtpRoute.ssf = g_ftdm_sngss7_data.cfg.mtpLinkSet[lnkSet->lsId].ssf;</span>
                
                /* extract the number of cmbLinkSetId aleady on this linkset */
<span style="color: #A00000">-                numLinks = g_ftdm_sngss7_data.cfg.mtpLinkSet[ls_id].numLinks;</span>
<span style="color: #00A000">+                numLinks = g_ftdm_sngss7_data.cfg.mtpLinkSet[lnkSet->lsId].numLinks;</span>
                
                /* add this routes cmbLinkSetId to the list */
<span style="color: #A00000">-                g_ftdm_sngss7_data.cfg.mtpLinkSet[ls_id].links[numLinks] = mtpRoute.cmbLinkSetId;</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtpLinkSet[lnkSet->lsId].links[numLinks] = mtpRoute.cmbLinkSetId;</span>
                /* increment the number of cmbLinkSets on this linkset */
<span style="color: #A00000">-                g_ftdm_sngss7_data.cfg.mtpLinkSet[ls_id].numLinks++;</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtpLinkSet[lnkSet->lsId].numLinks++;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                /* update the linked list */</span>
<span style="color: #00A000">+                lnkSet->next = ftdm_malloc(sizeof(sng_link_set_list_t));</span>
<span style="color: #00A000">+                lnkSet = lnkSet->next;</span>
<span style="color: #00A000">+                lnkSet->lsId = 0;</span>
<span style="color: #00A000">+                lnkSet->next = NULL;</span>
move_along:
                /* move to the next linkset element */
                linkset = linkset->next;
<span style="color: #A00000">-</span>
        /**************************************************************************/
        } /* while (linkset != null) */
<span style="color: #800080; font-weight: bold">@@ -1465,6 +1473,7 @@ static int ftmod_ss7_parse_isup_interface(ftdm_conf_node_t *isup_interface)</span>
{
        sng_isup_inf_t                        sng_isup;
        sng_isap_t                                sng_isap;
<span style="color: #00A000">+        sng_link_set_list_t                *lnkSet;</span>
        ftdm_conf_parameter_t        *parm = isup_interface->parameters;
        int                                                num_parms = isup_interface->n_parameters;
        int                                                i;
<span style="color: #800080; font-weight: bold">@@ -1500,7 +1509,6 @@ static int ftmod_ss7_parse_isup_interface(ftdm_conf_node_t *isup_interface)</span>
                } else if (!strcasecmp(parm->var, "spc")) {
                /**********************************************************************/
                        sng_isup.spc = atoi(parm->val);
<span style="color: #A00000">-                        g_ftdm_sngss7_data.cfg.spc = sng_isup.spc;</span>
                        SS7_DEBUG("Found an isup SPC = %d\n", sng_isup.spc);
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "mtprouteId")) {
<span style="color: #800080; font-weight: bold">@@ -1747,17 +1755,14 @@ static int ftmod_ss7_parse_isup_interface(ftdm_conf_node_t *isup_interface)</span>
        sngss7_set_flag(&sng_isup, SNGSS7_PAUSED);
        /* trickle down the SPC to all sub entities */
<span style="color: #A00000">-        int        linkSetId;</span>
<span style="color: #00A000">+        lnkSet = &g_ftdm_sngss7_data.cfg.mtpRoute[sng_isup.mtpRouteId].lnkSets;</span>
<span style="color: #A00000">-        linkSetId = g_ftdm_sngss7_data.cfg.mtpRoute[sng_isup.mtpRouteId].linkSetId;</span>
<span style="color: #00A000">+        g_ftdm_sngss7_data.cfg.mtp3Link[lnkSet->lsId].spc = sng_isup.spc;</span>
<span style="color: #00A000">+        lnkSet = lnkSet->next;</span>
<span style="color: #A00000">-        i = 1;</span>
<span style="color: #A00000">-        while (g_ftdm_sngss7_data.cfg.mtp3Link[i].id != 0) {</span>
<span style="color: #A00000">-                if (g_ftdm_sngss7_data.cfg.mtp3Link[i].linkSetId == linkSetId) {</span>
<span style="color: #A00000">-                        g_ftdm_sngss7_data.cfg.mtp3Link[i].spc = g_ftdm_sngss7_data.cfg.spc;</span>
<span style="color: #A00000">-                }</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                i++;</span>
<span style="color: #00A000">+        while (lnkSet->next != NULL) {</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtp3Link[lnkSet->lsId].spc = sng_isup.spc;</span>
<span style="color: #00A000">+                lnkSet = lnkSet->next;</span>
        }
        /* pull values from the lower levels */
<span style="color: #800080; font-weight: bold">@@ -2342,7 +2347,10 @@ static int ftmod_ss7_fill_in_mtpLinkSet(sng_link_set_t *mtpLinkSet)</span>
/******************************************************************************/
static int ftmod_ss7_fill_in_mtp3_route(sng_route_t *mtp3_route)
{
<span style="color: #A00000">-        int i = mtp3_route->id;</span>
<span style="color: #00A000">+        sng_link_set_list_t        *lnkSet = NULL;</span>
<span style="color: #00A000">+        int                                 i = mtp3_route->id;</span>
<span style="color: #00A000">+        int                                        tmp = 0;</span>
<span style="color: #00A000">+</span>
        /* check if this id value has been used already */
        if (g_ftdm_sngss7_data.cfg.mtpRoute[i].id == 0) {
<span style="color: #800080; font-weight: bold">@@ -2355,10 +2363,19 @@ static int ftmod_ss7_fill_in_mtp3_route(sng_route_t *mtp3_route)</span>
        }
        /* fill in the cmbLinkSet in the linkset structure */
<span style="color: #A00000">-        int tmp = g_ftdm_sngss7_data.cfg.mtpLinkSet[mtp3_route->linkSetId].numLinks;</span>
<span style="color: #00A000">+        lnkSet = &mtp3_route->lnkSets;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        tmp = g_ftdm_sngss7_data.cfg.mtpLinkSet[lnkSet->lsId].numLinks;</span>
<span style="color: #00A000">+        g_ftdm_sngss7_data.cfg.mtpLinkSet[lnkSet->lsId].links[tmp] = mtp3_route->cmbLinkSetId;</span>
<span style="color: #00A000">+        g_ftdm_sngss7_data.cfg.mtpLinkSet[lnkSet->lsId].numLinks++;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        while (lnkSet->next != NULL) {</span>
<span style="color: #00A000">+                tmp = g_ftdm_sngss7_data.cfg.mtpLinkSet[lnkSet->lsId].numLinks;</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtpLinkSet[lnkSet->lsId].links[tmp] = mtp3_route->cmbLinkSetId;</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtpLinkSet[lnkSet->lsId].numLinks++;</span>
<span style="color: #A00000">-        g_ftdm_sngss7_data.cfg.mtpLinkSet[mtp3_route->linkSetId].links[tmp] = mtp3_route->cmbLinkSetId;</span>
<span style="color: #A00000">-        g_ftdm_sngss7_data.cfg.mtpLinkSet[mtp3_route->linkSetId].numLinks++;</span>
<span style="color: #00A000">+                lnkSet = lnkSet->next;</span>
<span style="color: #00A000">+        }</span>
        strcpy((char *)g_ftdm_sngss7_data.cfg.mtpRoute[i].name, (char *)mtp3_route->name);
<span style="color: #800080; font-weight: bold">@@ -2369,7 +2386,7 @@ static int ftmod_ss7_fill_in_mtp3_route(sng_route_t *mtp3_route)</span>
        g_ftdm_sngss7_data.cfg.mtpRoute[i].cmbLinkSetId        = mtp3_route->cmbLinkSetId;
        g_ftdm_sngss7_data.cfg.mtpRoute[i].isSTP                = mtp3_route->isSTP;
        g_ftdm_sngss7_data.cfg.mtpRoute[i].nwId                        = mtp3_route->nwId;
<span style="color: #A00000">-        g_ftdm_sngss7_data.cfg.mtpRoute[i].linkSetId        = mtp3_route->linkSetId;</span>
<span style="color: #00A000">+        g_ftdm_sngss7_data.cfg.mtpRoute[i].lnkSets                = mtp3_route->lnkSets;</span>
        g_ftdm_sngss7_data.cfg.mtpRoute[i].ssf                        = mtp3_route->ssf;
        if (mtp3_route->t6 != 0) {
                g_ftdm_sngss7_data.cfg.mtpRoute[i].t6                = mtp3_route->t6;
<span style="color: #800080; font-weight: bold">@@ -2439,8 +2456,7 @@ static int ftmod_ss7_fill_in_nsap(sng_route_t *mtp3_route)</span>
        i = 1;
        while (g_ftdm_sngss7_data.cfg.nsap[i].id != 0) {
                if ((g_ftdm_sngss7_data.cfg.nsap[i].linkType == mtp3_route->linkType) &&
<span style="color: #A00000">-                        (g_ftdm_sngss7_data.cfg.nsap[i].switchType == mtp3_route->switchType) &&</span>
<span style="color: #A00000">-                        (g_ftdm_sngss7_data.cfg.nsap[i].ssf == mtp3_route->ssf)) {</span>
<span style="color: #00A000">+                        (g_ftdm_sngss7_data.cfg.nsap[i].switchType == mtp3_route->switchType)) {</span>
                        /* we have a match so break out of this loop */
                        break;
<span style="color: #800080; font-weight: bold">@@ -2789,6 +2805,7 @@ static int ftmod_ss7_fill_in_ccSpan(sng_ccSpan_t *ccSpan)</span>
        sngss7_chan_data_t        *ss7_info = NULL;
        int                                        x;
        int                                        count = 1;
<span style="color: #00A000">+        int                                        flag;</span>
        while (ccSpan->ch_map[0] != '\0') {
        /**************************************************************************/
<span style="color: #800080; font-weight: bold">@@ -2799,13 +2816,45 @@ static int ftmod_ss7_fill_in_ccSpan(sng_ccSpan_t *ccSpan)</span>
                        return FTDM_FAIL;
                }
<span style="color: #A00000">-                /* find the spot in master array for this circuit */</span>
<span style="color: #A00000">-                x = (ccSpan->procId * 1000) + count;</span>
<span style="color: #00A000">+                /* find a spot for this circuit in the global structure */</span>
<span style="color: #00A000">+                x = (ccSpan->procId * 1000);</span>
<span style="color: #00A000">+                flag = 0;</span>
<span style="color: #00A000">+                while (flag == 0) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        /* check the id value ( 0 = new, 0 > circuit can be existing) */</span>
<span style="color: #00A000">+                        if (g_ftdm_sngss7_data.cfg.isupCkt[x].id == 0) {</span>
<span style="color: #00A000">+                                /* we're at the end of the list of circuitsl aka this is new */</span>
<span style="color: #00A000">+                                SS7_DEBUG("Found a new circuit %d, ccSpanId=%d, chan=%d\n",</span>
<span style="color: #00A000">+                                                        x, </span>
<span style="color: #00A000">+                                                        ccSpan->id, </span>
<span style="color: #00A000">+                                                        count);</span>
<span style="color: #A00000">-                /* check if this circuit has already been filled in */</span>
<span style="color: #A00000">-                if (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) {</span>
<span style="color: #A00000">-                        SS7_DEVEL_DEBUG("Filling in circuit that already exists...%d\n", x);</span>
<span style="color: #A00000">-                }</span>
<span style="color: #00A000">+                                /* throw the flag to end the loop */</span>
<span style="color: #00A000">+                                flag = 1;</span>
<span style="color: #00A000">+                        } else {</span>
<span style="color: #00A000">+                                /* check the ccspan.id and chan to see if the circuit already exists */</span>
<span style="color: #00A000">+                                if ((g_ftdm_sngss7_data.cfg.isupCkt[x].ccSpanId == ccSpan->id) &&</span>
<span style="color: #00A000">+                                        (g_ftdm_sngss7_data.cfg.isupCkt[x].chan == count)) {</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                                        /* we are processing a circuit that already exists */</span>
<span style="color: #00A000">+                                        SS7_DEBUG("Found an existing circuit %d, ccSpanId=%d, chan%d\n",</span>
<span style="color: #00A000">+                                                                x, </span>
<span style="color: #00A000">+                                                                ccSpan->id, </span>
<span style="color: #00A000">+                                                                count);</span>
<span style="color: #00A000">+        </span>
<span style="color: #00A000">+                                        /* throw the flag to end the loop */</span>
<span style="color: #00A000">+                                        flag = 1;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                                        /* not supporting reconfig at this time */</span>
<span style="color: #00A000">+                                        SS7_DEBUG("Not supporting ckt reconfig at this time!\n");</span>
<span style="color: #00A000">+                                        goto move_along;</span>
<span style="color: #00A000">+                                } else {</span>
<span style="color: #00A000">+                                        /* this is not the droid you are looking for */</span>
<span style="color: #00A000">+                                        x++;</span>
<span style="color: #00A000">+                                }</span>
<span style="color: #00A000">+                        }</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } /* while (flag == 0) */</span>
                /* prepare the global info sturcture */
                ss7_info = ftdm_calloc(1, sizeof(sngss7_chan_data_t));
<span style="color: #800080; font-weight: bold">@@ -2901,6 +2950,7 @@ static int ftmod_ss7_fill_in_ccSpan(sng_ccSpan_t *ccSpan)</span>
                                        g_ftdm_sngss7_data.cfg.isupCkt[x].cic,
                                        g_ftdm_sngss7_data.cfg.isupCkt[x].id);
<span style="color: #00A000">+move_along:</span>
                /* increment the span channel count */
                count++;
</pre></div>
<div class="highlight"><pre>committer: cypromis
comments:
more formatting mistakes *sigh*
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c</span>
<span style="color: #000080; font-weight: bold">index 1684127..f829e57 100644</span>
<span style="color: #A00000">--- a/src/mod/applications/mod_voicemail/mod_voicemail.c</span>
<span style="color: #00A000">+++ b/src/mod/applications/mod_voicemail/mod_voicemail.c</span>
<span style="color: #800080; font-weight: bold">@@ -1277,9 +1277,9 @@ static void message_count(vm_profile_t *profile, const char *id_in, const char *</span>
        myid = resolve_id(id_in, domain_name, "message-count");
<span style="color: #A00000">-        switch_snprintf(sql, sizeof(sql), "select 1, read_flags, count(read_epoch) from voicemail_msgs where username='%s' and domain='%s' and in_folder='%s' and read_epoch=0 group by read_flags union </span>
<span style="color: #A00000">-        select 0, read_flags, count(read_epoch) from voicemail_msgs where username='%s' and domain='%s' and in_folder='%s' and read_epoch<>0 group by read_flags;",        myid, domain_name, myfolder);</span>
<span style="color: #A00000">-</span>
<span style="color: #00A000">+        switch_snprintf(sql, sizeof(sql), "select 1, read_flags, count(read_epoch) from voicemail_msgs where username='%s' and domain='%s' and in_folder='%s' "</span>
<span style="color: #00A000">+                                                                         "and read_epoch=0 group by read_flags union select 0, read_flags, count(read_epoch) from voicemail_msgs where username='%s' "</span>
<span style="color: #00A000">+                                                                         "and domain='%s' and in_folder='%s' and read_epoch<>0 group by read_flags;", myid, domain_name, myfolder);</span>
        vm_execute_sql_callback(profile, profile->mutex, sql, message_count_callback, &cbt);
        *total_new_messages = cbt.total_new_messages + cbt.total_new_urgent_messages;
</pre></div>
<div class="highlight"><pre>committer: cypromis
comments:
seems whitespaces are unpopular on some linux/gcc combinations
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c</span>
<span style="color: #000080; font-weight: bold">index f868c3a..1684127 100644</span>
<span style="color: #A00000">--- a/src/mod/applications/mod_voicemail/mod_voicemail.c</span>
<span style="color: #00A000">+++ b/src/mod/applications/mod_voicemail/mod_voicemail.c</span>
<span style="color: #800080; font-weight: bold">@@ -1277,11 +1277,8 @@ static void message_count(vm_profile_t *profile, const char *id_in, const char *</span>
        myid = resolve_id(id_in, domain_name, "message-count");
<span style="color: #A00000">-        switch_snprintf(sql, sizeof(sql),</span>
<span style="color: #A00000">-                                        "select 1, read_flags, count(read_epoch) from voicemail_msgs where username='%s' and domain='%s' and in_folder='%s' and read_epoch=0 group by read_flags </span>
<span style="color: #A00000">-                                        union </span>
<span style="color: #A00000">-                                        select 0, read_flags, count(read_epoch) from voicemail_msgs where username='%s' and domain='%s' and in_folder='%s' and read_epoch<>0 group by read_flags;",        </span>
<span style="color: #A00000">-                                        myid, domain_name, myfolder);</span>
<span style="color: #00A000">+        switch_snprintf(sql, sizeof(sql), "select 1, read_flags, count(read_epoch) from voicemail_msgs where username='%s' and domain='%s' and in_folder='%s' and read_epoch=0 group by read_flags union </span>
<span style="color: #00A000">+        select 0, read_flags, count(read_epoch) from voicemail_msgs where username='%s' and domain='%s' and in_folder='%s' and read_epoch<>0 group by read_flags;",        myid, domain_name, myfolder);</span>
        vm_execute_sql_callback(profile, profile->mutex, sql, message_count_callback, &cbt);
</pre></div>
<div class="highlight"><pre>committer: cypromis
comments:
FS-1742 - Make Voicemail use 1 SQL query instead of 4 to get the message count use in MWI - Now also working on your more favourite and less favourite databases
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c</span>
<span style="color: #000080; font-weight: bold">index 80b011e..f868c3a 100644</span>
<span style="color: #A00000">--- a/src/mod/applications/mod_voicemail/mod_voicemail.c</span>
<span style="color: #00A000">+++ b/src/mod/applications/mod_voicemail/mod_voicemail.c</span>
<span style="color: #800080; font-weight: bold">@@ -1278,7 +1278,9 @@ static void message_count(vm_profile_t *profile, const char *id_in, const char *</span>
        myid = resolve_id(id_in, domain_name, "message-count");
        switch_snprintf(sql, sizeof(sql),
<span style="color: #A00000">-                                        "select read_epoch=0, read_flags, count(read_epoch) from voicemail_msgs where username='%s' and domain='%s' and in_folder='%s' group by read_epoch=0,read_flags;",</span>
<span style="color: #00A000">+                                        "select 1, read_flags, count(read_epoch) from voicemail_msgs where username='%s' and domain='%s' and in_folder='%s' and read_epoch=0 group by read_flags </span>
<span style="color: #00A000">+                                        union </span>
<span style="color: #00A000">+                                        select 0, read_flags, count(read_epoch) from voicemail_msgs where username='%s' and domain='%s' and in_folder='%s' and read_epoch<>0 group by read_flags;",        </span>
                                        myid, domain_name, myfolder);
        vm_execute_sql_callback(profile, profile->mutex, sql, message_count_callback, &cbt);
</pre></div>
<div class="highlight"><pre>committer: Leon de Rooij
comments:
Merge branch 'master' of ssh://git.freeswitch.org/freeswitch
</pre></div>
<div class="highlight"><pre>committer: Leon de Rooij
comments:
reswig mod_lua for freeswitch.email
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/languages/mod_lua/mod_lua_wrap.cpp b/src/mod/languages/mod_lua/mod_lua_wrap.cpp</span>
<span style="color: #000080; font-weight: bold">index 1d84a39..559d403 100644</span>
<span style="color: #A00000">--- a/src/mod/languages/mod_lua/mod_lua_wrap.cpp</span>
<span style="color: #00A000">+++ b/src/mod/languages/mod_lua/mod_lua_wrap.cpp</span>
<span style="color: #800080; font-weight: bold">@@ -1582,6 +1582,55 @@ fail:</span>
}
<span style="color: #00A000">+static int _wrap_email(lua_State* L) {</span>
<span style="color: #00A000">+ int SWIG_arg = -1;</span>
<span style="color: #00A000">+ char *arg1 = (char *) 0 ;</span>
<span style="color: #00A000">+ char *arg2 = (char *) 0 ;</span>
<span style="color: #00A000">+ char *arg3 = (char *) NULL ;</span>
<span style="color: #00A000">+ char *arg4 = (char *) NULL ;</span>
<span style="color: #00A000">+ char *arg5 = (char *) NULL ;</span>
<span style="color: #00A000">+ char *arg6 = (char *) NULL ;</span>
<span style="color: #00A000">+ char *arg7 = (char *) NULL ;</span>
<span style="color: #00A000">+ bool result;</span>
<span style="color: #00A000">+ </span>
<span style="color: #00A000">+ SWIG_check_num_args("email",2,7)</span>
<span style="color: #00A000">+ if(!lua_isstring(L,1)) SWIG_fail_arg("email",1,"char *");</span>
<span style="color: #00A000">+ if(!lua_isstring(L,2)) SWIG_fail_arg("email",2,"char *");</span>
<span style="color: #00A000">+ if(lua_gettop(L)>=3 && !lua_isstring(L,3)) SWIG_fail_arg("email",3,"char *");</span>
<span style="color: #00A000">+ if(lua_gettop(L)>=4 && !lua_isstring(L,4)) SWIG_fail_arg("email",4,"char *");</span>
<span style="color: #00A000">+ if(lua_gettop(L)>=5 && !lua_isstring(L,5)) SWIG_fail_arg("email",5,"char *");</span>
<span style="color: #00A000">+ if(lua_gettop(L)>=6 && !lua_isstring(L,6)) SWIG_fail_arg("email",6,"char *");</span>
<span style="color: #00A000">+ if(lua_gettop(L)>=7 && !lua_isstring(L,7)) SWIG_fail_arg("email",7,"char *");</span>
<span style="color: #00A000">+ arg1 = (char *)lua_tostring(L, 1);</span>
<span style="color: #00A000">+ arg2 = (char *)lua_tostring(L, 2);</span>
<span style="color: #00A000">+ if(lua_gettop(L)>=3){</span>
<span style="color: #00A000">+ arg3 = (char *)lua_tostring(L, 3);</span>
<span style="color: #00A000">+ }</span>
<span style="color: #00A000">+ if(lua_gettop(L)>=4){</span>
<span style="color: #00A000">+ arg4 = (char *)lua_tostring(L, 4);</span>
<span style="color: #00A000">+ }</span>
<span style="color: #00A000">+ if(lua_gettop(L)>=5){</span>
<span style="color: #00A000">+ arg5 = (char *)lua_tostring(L, 5);</span>
<span style="color: #00A000">+ }</span>
<span style="color: #00A000">+ if(lua_gettop(L)>=6){</span>
<span style="color: #00A000">+ arg6 = (char *)lua_tostring(L, 6);</span>
<span style="color: #00A000">+ }</span>
<span style="color: #00A000">+ if(lua_gettop(L)>=7){</span>
<span style="color: #00A000">+ arg7 = (char *)lua_tostring(L, 7);</span>
<span style="color: #00A000">+ }</span>
<span style="color: #00A000">+ result = (bool)email(arg1,arg2,arg3,arg4,arg5,arg6,arg7);</span>
<span style="color: #00A000">+ SWIG_arg=0;</span>
<span style="color: #00A000">+ lua_pushboolean(L,(int)(result==true)); SWIG_arg++;</span>
<span style="color: #00A000">+ return SWIG_arg;</span>
<span style="color: #00A000">+ </span>
<span style="color: #00A000">+ if(0) SWIG_fail;</span>
<span style="color: #00A000">+ </span>
<span style="color: #00A000">+fail:</span>
<span style="color: #00A000">+ lua_error(L);</span>
<span style="color: #00A000">+ return SWIG_arg;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
static int _wrap_new_IVRMenu(lua_State* L) {
int SWIG_arg = -1;
IVRMenu *arg1 = (IVRMenu *) 0 ;
<span style="color: #800080; font-weight: bold">@@ -7525,6 +7574,7 @@ static swig_lua_class _wrap_class_LUA_Dbh = { "Dbh", &SWIGTYPE_p_LUA__Dbh,_wrap_</span>
static const struct luaL_reg swig_commands[] = {
{ "consoleLog", _wrap_consoleLog},
{ "consoleCleanLog", _wrap_consoleCleanLog},
<span style="color: #00A000">+ { "email", _wrap_email},</span>
{ "console_log", _wrap_console_log},
{ "console_clean_log", _wrap_console_clean_log},
{ "msleep", _wrap_msleep},
</pre></div>
<div class="highlight"><pre>committer: Mathieu Rene
comments:
Add libjpeg-dev to apt prereqs
<span style="color: #000080; font-weight: bold">diff --git a/support-d/prereq.sh b/support-d/prereq.sh</span>
<span style="color: #000080; font-weight: bold">index 4e214cf..8bc454d 100755</span>
<span style="color: #A00000">--- a/support-d/prereq.sh</span>
<span style="color: #00A000">+++ b/support-d/prereq.sh</span>
<span style="color: #800080; font-weight: bold">@@ -2,7 +2,7 @@ UNAME=`uname`</span>
NEEDED_PACKAGES_YUM='automake autoconf libtool screen gdb gcc-c++ compat-gcc-32 compat-gcc-32-c++ subversion ncurses-devel unixODBC-devel make wget'
<span style="color: #A00000">-NEEDED_PACAKGES_APT='automake autoconf libtool screen gdb libncurses5-dev unixodbc-dev subversion emacs22-nox gcc g++ make'</span>
<span style="color: #00A000">+NEEDED_PACAKGES_APT='automake autoconf libtool screen gdb libncurses5-dev unixodbc-dev subversion emacs22-nox gcc g++ make libjpeg-dev'</span>
NEEDED_PACKAGES_PKG_ADD=''
</pre></div>
<div class="highlight"><pre>committer: Mathieu Rene
comments:
Add session.ringReady() to check for CF_RING_READY
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c b/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c</span>
<span style="color: #000080; font-weight: bold">index 1d6ee8d..a818c1d 100644</span>
<span style="color: #A00000">--- a/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c</span>
<span style="color: #00A000">+++ b/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c</span>
<span style="color: #800080; font-weight: bold">@@ -2126,6 +2126,15 @@ static JSBool session_media_ready(JSContext * cx, JSObject * obj, uintN argc, js</span>
}
<span style="color: #00A000">+static JSBool session_ring_ready(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        struct js_session *jss = JS_GetPrivate(cx, obj);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        *rval = BOOLEAN_TO_JSVAL((jss && jss->session && switch_channel_test_flag(switch_core_session_get_channel(jss->session), CF_RING_READY)) ? JS_TRUE : JS_FALSE);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return JS_TRUE;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
static JSBool session_answered(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
{
        struct js_session *jss = JS_GetPrivate(cx, obj);
<span style="color: #800080; font-weight: bold">@@ -2673,6 +2682,7 @@ static JSFunctionSpec session_methods[] = {</span>
        {"ready", session_ready, 0},
        {"answered", session_answered, 0},
        {"mediaReady", session_media_ready, 0},
<span style="color: #00A000">+        {"ringReady", session_ring_ready, 0},</span>
        {"waitForAnswer", session_wait_for_answer, 0},
        {"waitForMedia", session_wait_for_media, 0},
        {"getEvent", session_get_event, 0},
</pre></div>
<div class="highlight"><pre>committer: Mathieu Rene
comments:
xml_config: change min/max enforcements to >= instead of >
<span style="color: #000080; font-weight: bold">diff --git a/src/switch_xml_config.c b/src/switch_xml_config.c</span>
<span style="color: #000080; font-weight: bold">index b6b37bd..5ade057 100644</span>
<span style="color: #A00000">--- a/src/switch_xml_config.c</span>
<span style="color: #00A000">+++ b/src/switch_xml_config.c</span>
<span style="color: #800080; font-weight: bold">@@ -177,7 +177,7 @@ SWITCH_DECLARE(switch_status_t) switch_xml_config_parse_event(switch_event_t *ev</span>
                                        if (int_options) {
                                                /* Enforce validation options */
<span style="color: #A00000">-                                                if ((int_options->enforce_min && !(intval > int_options->min)) || (int_options->enforce_max && !(intval < int_options->max))) {</span>
<span style="color: #00A000">+                                                if ((int_options->enforce_min && !(intval >= int_options->min)) || (int_options->enforce_max && !(intval <= int_options->max))) {</span>
                                                        /* Validation failed, set default */
                                                        intval = (int) (intptr_t) item->defaultvalue;
                                                        /* Then complain */
</pre></div>
<div class="highlight"><pre>committer: Leon de Rooij
comments:
Merge branch 'master' of ssh://git.freeswitch.org/freeswitch
</pre></div>
<div class="highlight"><pre>committer: David Yat Sin
comments:
chlog: freetdm: isdn: fix for 4ESS call clearing procedures
<span style="color: #000080; font-weight: bold">diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c</span>
<span style="color: #000080; font-weight: bold">index 97984fb..5702b72 100644</span>
<span style="color: #A00000">--- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c</span>
<span style="color: #00A000">+++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c</span>
<span style="color: #800080; font-weight: bold">@@ -801,12 +801,14 @@ static ftdm_status_t ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdm</span>
                                                sngisdn_snd_release(ftdmchan, 0);
                                                break;
                                        case FTDM_CHANNEL_STATE_PROCEED:
<span style="color: #A00000">-                                                if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND) &&</span>
<span style="color: #A00000">-                                                        ((sngisdn_span_data_t*)(ftdmchan->span->signal_data))->switchtype == SNGISDN_SWITCH_5ESS) {</span>
<span style="color: #00A000">+                                                if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) {</span>
<span style="color: #00A000">+                                                        if (((sngisdn_span_data_t*)(ftdmchan->span->signal_data))->switchtype == SNGISDN_SWITCH_4ESS ||</span>
<span style="color: #00A000">+                                                         ((sngisdn_span_data_t*)(ftdmchan->span->signal_data))->switchtype == SNGISDN_SWITCH_5ESS) {</span>
                                                        
<span style="color: #A00000">-                                                        /* When using 5ESS, if the user wants to clear an inbound call, the correct procedure is to send a PROGRESS with in-band info available, and play tones. Then send a DISCONNECT. If we reached this point, it means user did not try to play-tones, so send a RELEASE because remote side does not expect DISCONNECT in state 3 */</span>
<span style="color: #A00000">-                                                        sngisdn_snd_release(ftdmchan, 0);</span>
<span style="color: #A00000">-                                                        break;</span>
<span style="color: #00A000">+                                                                /* When using 5ESS, if the user wants to clear an inbound call, the correct procedure is to send a PROGRESS with in-band info available, and play tones. Then send a DISCONNECT. If we reached this point, it means user did not try to play-tones, so send a RELEASE because remote side does not expect DISCONNECT in state 3 */</span>
<span style="color: #00A000">+                                                                sngisdn_snd_release(ftdmchan, 0);</span>
<span style="color: #00A000">+                                                                break;</span>
<span style="color: #00A000">+                                                        }</span>
                                                }
                                                /* fall-through */
                                        default:
</pre></div>
<div class="highlight"><pre>committer: Anthony Minessale
comments:
nm 40 doesn't work yet
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/codecs/mod_opus/mod_opus.c b/src/mod/codecs/mod_opus/mod_opus.c</span>
<span style="color: #000080; font-weight: bold">index 0234ed8..b9a3120 100644</span>
<span style="color: #A00000">--- a/src/mod/codecs/mod_opus/mod_opus.c</span>
<span style="color: #00A000">+++ b/src/mod/codecs/mod_opus/mod_opus.c</span>
<span style="color: #800080; font-weight: bold">@@ -159,7 +159,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_opus_load)</span>
        SWITCH_ADD_CODEC(codec_interface, "OPUS (BETA 0.9.0)");
<span style="color: #A00000">-        for (x = 0; x < 3; x++) {</span>
<span style="color: #00A000">+        for (x = 0; x < 2; x++) {</span>
                switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,        /* enumeration defining the type of the codec */
                                                                                         115,        /* the IANA code number */
                                                                                         "Opus-0.9.0",/* the IANA code name */
</pre></div>
<div class="highlight"><pre>committer: Anthony Minessale
comments:
add 10 20 and 40ms
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/codecs/mod_opus/mod_opus.c b/src/mod/codecs/mod_opus/mod_opus.c</span>
<span style="color: #000080; font-weight: bold">index ddb5a7a..0234ed8 100644</span>
<span style="color: #A00000">--- a/src/mod/codecs/mod_opus/mod_opus.c</span>
<span style="color: #00A000">+++ b/src/mod/codecs/mod_opus/mod_opus.c</span>
<span style="color: #800080; font-weight: bold">@@ -147,52 +147,43 @@ static switch_status_t switch_opus_decode(switch_codec_t *codec,</span>
SWITCH_MODULE_LOAD_FUNCTION(mod_opus_load)
{
        switch_codec_interface_t *codec_interface;
<span style="color: #00A000">+        int samples = 80;</span>
<span style="color: #00A000">+        int bytes = 960;</span>
<span style="color: #00A000">+        int mss = 10000;</span>
<span style="color: #00A000">+        int x = 0;</span>
<span style="color: #00A000">+        int rate = 48000;</span>
<span style="color: #00A000">+        int bits = 32000;</span>
        /* connect my internal structure to the blank pointer passed to me */
        *module_interface = switch_loadable_module_create_module_interface(pool, modname);
        SWITCH_ADD_CODEC(codec_interface, "OPUS (BETA 0.9.0)");
<span style="color: #A00000">-        switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,        /* enumeration defining the type of the codec */</span>
<span style="color: #A00000">-                                                                                 115,        /* the IANA code number */</span>
<span style="color: #A00000">-                                                                                 "Opus-0.9.0",/* the IANA code name */</span>
<span style="color: #A00000">-                                                                                 NULL,        /* default fmtp to send (can be overridden by the init function) */</span>
<span style="color: #A00000">-                                                                                 48000,        /* samples transferred per second */</span>
<span style="color: #A00000">-                                                                                 48000,        /* actual samples transferred per second */</span>
<span style="color: #A00000">-                                                                                 32000,        /* bits transferred per second */</span>
<span style="color: #A00000">-                                                                                 10000,        /* number of microseconds per frame */</span>
<span style="color: #A00000">-                                                                                 80,        /* number of samples per frame */</span>
<span style="color: #A00000">-                                                                                 960,        /* number of bytes per frame decompressed */</span>
<span style="color: #A00000">-                                                                                 0,        /* number of bytes per frame compressed */</span>
<span style="color: #A00000">-                                                                                 1,        /* number of channels represented */</span>
<span style="color: #A00000">-                                                                                 1,        /* number of frames per network packet */</span>
<span style="color: #A00000">-                                                                                 switch_opus_init,        /* function to initialize a codec handle using this implementation */</span>
<span style="color: #A00000">-                                                                                 switch_opus_encode,        /* function to encode raw data into encoded data */</span>
<span style="color: #A00000">-                                                                                 switch_opus_decode,        /* function to decode encoded data into raw data */</span>
<span style="color: #A00000">-                                                                                 switch_opus_destroy);        /* deinitalize a codec handle using this implementation */</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-        switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,        /* enumeration defining the type of the codec */</span>
<span style="color: #A00000">-                                                                                 115,        /* the IANA code number */</span>
<span style="color: #A00000">-                                                                                 "Opus-0.9.0",        /* the IANA code name */</span>
<span style="color: #A00000">-                                                                                 NULL,        /* default fmtp to send (can be overridden by the init function) */</span>
<span style="color: #A00000">-                                                                                 48000,        /* samples transferred per second */</span>
<span style="color: #A00000">-                                                                                 48000,        /* actual samples transferred per second */</span>
<span style="color: #A00000">-                                                                                 32000,        /* bits transferred per second */</span>
<span style="color: #A00000">-                                                                                 20000,        /* number of microseconds per frame */</span>
<span style="color: #A00000">-                                                                                 160,        /* number of samples per frame */</span>
<span style="color: #A00000">-                                                                                 1920,        /* number of bytes per frame decompressed */</span>
<span style="color: #A00000">-                                                                                 0,        /* number of bytes per frame compressed */</span>
<span style="color: #A00000">-                                                                                 1,        /* number of channels represented */</span>
<span style="color: #A00000">-                                                                                 1,        /* number of frames per network packet */</span>
<span style="color: #A00000">-                                                                                 switch_opus_init,        /* function to initialize a codec handle using this implementation */</span>
<span style="color: #A00000">-                                                                                 switch_opus_encode,        /* function to encode raw data into encoded data */</span>
<span style="color: #A00000">-                                                                                 switch_opus_decode,        /* function to decode encoded data into raw data */</span>
<span style="color: #A00000">-                                                                                 switch_opus_destroy);        /* deinitalize a codec handle using this implementation */</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-</span>
<span style="color: #00A000">+        for (x = 0; x < 3; x++) {</span>
<span style="color: #00A000">+                switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,        /* enumeration defining the type of the codec */</span>
<span style="color: #00A000">+                                                                                         115,        /* the IANA code number */</span>
<span style="color: #00A000">+                                                                                         "Opus-0.9.0",/* the IANA code name */</span>
<span style="color: #00A000">+                                                                                         NULL,        /* default fmtp to send (can be overridden by the init function) */</span>
<span style="color: #00A000">+                                                                                         rate,        /* samples transferred per second */</span>
<span style="color: #00A000">+                                                                                         rate,        /* actual samples transferred per second */</span>
<span style="color: #00A000">+                                                                                         bits,        /* bits transferred per second */</span>
<span style="color: #00A000">+                                                                                         mss,        /* number of microseconds per frame */</span>
<span style="color: #00A000">+                                                                                         samples,        /* number of samples per frame */</span>
<span style="color: #00A000">+                                                                                         bytes,        /* number of bytes per frame decompressed */</span>
<span style="color: #00A000">+                                                                                         0,        /* number of bytes per frame compressed */</span>
<span style="color: #00A000">+                                                                                         1,        /* number of channels represented */</span>
<span style="color: #00A000">+                                                                                         1,        /* number of frames per network packet */</span>
<span style="color: #00A000">+                                                                                         switch_opus_init,        /* function to initialize a codec handle using this implementation */</span>
<span style="color: #00A000">+                                                                                         switch_opus_encode,        /* function to encode raw data into encoded data */</span>
<span style="color: #00A000">+                                                                                         switch_opus_decode,        /* function to decode encoded data into raw data */</span>
<span style="color: #00A000">+                                                                                         switch_opus_destroy);        /* deinitalize a codec handle using this implementation */</span>
<span style="color: #00A000">+                </span>
<span style="color: #00A000">+                bytes *= 2;</span>
<span style="color: #00A000">+                samples *= 2;</span>
<span style="color: #00A000">+                mss *= 2;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        </span>
        /* indicate that the module should continue to be loaded */
        return SWITCH_STATUS_SUCCESS;
}
</pre></div>
<div class="highlight"><pre>committer: Anthony Minessale
comments:
change signalling name to avoid polluting the namespace before its ready
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/codecs/mod_opus/mod_opus.c b/src/mod/codecs/mod_opus/mod_opus.c</span>
<span style="color: #000080; font-weight: bold">index 341254f..ddb5a7a 100644</span>
<span style="color: #A00000">--- a/src/mod/codecs/mod_opus/mod_opus.c</span>
<span style="color: #00A000">+++ b/src/mod/codecs/mod_opus/mod_opus.c</span>
<span style="color: #800080; font-weight: bold">@@ -151,11 +151,11 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_opus_load)</span>
        /* connect my internal structure to the blank pointer passed to me */
        *module_interface = switch_loadable_module_create_module_interface(pool, modname);
<span style="color: #A00000">-        SWITCH_ADD_CODEC(codec_interface, "OPUS (BETA)");</span>
<span style="color: #00A000">+        SWITCH_ADD_CODEC(codec_interface, "OPUS (BETA 0.9.0)");</span>
        switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,        /* enumeration defining the type of the codec */
                                                                                 115,        /* the IANA code number */
<span style="color: #A00000">-                                                                                 "OPUS",        /* the IANA code name */</span>
<span style="color: #00A000">+                                                                                 "Opus-0.9.0",/* the IANA code name */</span>
                                                                                 NULL,        /* default fmtp to send (can be overridden by the init function) */
                                                                                 48000,        /* samples transferred per second */
                                                                                 48000,        /* actual samples transferred per second */
<span style="color: #800080; font-weight: bold">@@ -174,7 +174,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_opus_load)</span>
        switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,        /* enumeration defining the type of the codec */
                                                                                 115,        /* the IANA code number */
<span style="color: #A00000">-                                                                                 "OPUS",        /* the IANA code name */</span>
<span style="color: #00A000">+                                                                                 "Opus-0.9.0",        /* the IANA code name */</span>
                                                                                 NULL,        /* default fmtp to send (can be overridden by the init function) */
                                                                                 48000,        /* samples transferred per second */
                                                                                 48000,        /* actual samples transferred per second */
</pre></div>
<div class="highlight"><pre>committer: Anthony Minessale
comments:
add mod_opus
<span style="color: #000080; font-weight: bold">diff --git a/build/modules.conf.in b/build/modules.conf.in</span>
<span style="color: #000080; font-weight: bold">index 84a9e9a..8d3dfaa 100644</span>
<span style="color: #A00000">--- a/build/modules.conf.in</span>
<span style="color: #00A000">+++ b/build/modules.conf.in</span>
<span style="color: #800080; font-weight: bold">@@ -48,6 +48,7 @@ codecs/mod_ilbc</span>
codecs/mod_speex
codecs/mod_siren
#codecs/mod_celt
<span style="color: #00A000">+#codecs/mod_opus</span>
#codecs/mod_sangoma_codec
#codecs/mod_dahdi_codec
#dialplans/mod_dialplan_directory
<span style="color: #000080; font-weight: bold">diff --git a/conf/autoload_configs/modules.conf.xml b/conf/autoload_configs/modules.conf.xml</span>
<span style="color: #000080; font-weight: bold">index 2e7ebfa..8b4a4e7 100644</span>
<span style="color: #A00000">--- a/conf/autoload_configs/modules.conf.xml</span>
<span style="color: #00A000">+++ b/conf/autoload_configs/modules.conf.xml</span>
<span style="color: #800080; font-weight: bold">@@ -78,6 +78,7 @@</span>
<load module="mod_h26x"/>
<load module="mod_siren"/>
<!--<load module="mod_celt"/>-->
<span style="color: #00A000">+ <!--<load module="mod_opus"/>--></span>
<!-- File Format Interfaces -->
<load module="mod_sndfile"/>
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/codecs/mod_opus/Makefile b/src/mod/codecs/mod_opus/Makefile</span>
new file mode 100644
<span style="color: #000080; font-weight: bold">index 0000000..a346956</span>
<span style="color: #A00000">--- /dev/null</span>
<span style="color: #00A000">+++ b/src/mod/codecs/mod_opus/Makefile</span>
<span style="color: #800080; font-weight: bold">@@ -0,0 +1,28 @@</span>
<span style="color: #00A000">+BASE=../../../..</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+OPUS=opus-0.9.0</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+OPUS_DIR=$(switch_srcdir)/libs/$(OPUS)</span>
<span style="color: #00A000">+OPUS_BUILDDIR=$(switch_builddir)/libs/$(OPUS)</span>
<span style="color: #00A000">+LOCAL_CFLAGS=-I$(OPUS_DIR)/src -g -O2</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+IETF_LA=$(OPUS_BUILDDIR)/src/.libs/libietfcodec.a</span>
<span style="color: #00A000">+CELT_LA=$(OPUS_BUILDDIR)/celt/libcelt/.libs/libcelt0.a</span>
<span style="color: #00A000">+SILK_LA=$(OPUS_BUILDDIR)/silk/.libs/libSKP_SILK_SDK.a</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+LOCAL_LIBADD=$(IETF_LA) $(CELT_LA) $(SILK_LA) -lm -lz</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+include $(BASE)/build/modmake.rules</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+$(OPUS_DIR):</span>
<span style="color: #00A000">+        $(GETLIB) $(OPUS).tar.gz</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+$(OPUS_BUILDDIR)/Makefile: $(OPUS_DIR)</span>
<span style="color: #00A000">+        mkdir -p $(OPUS_BUILDDIR)</span>
<span style="color: #00A000">+        cd $(OPUS_BUILDDIR) && $(DEFAULT_VARS) $(OPUS_DIR)/configure --disable-shared --with-pic --srcdir=$(OPUS_DIR)</span>
<span style="color: #00A000">+        $(TOUCH_TARGET)</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+$(IETF_LA): $(OPUS_BUILDDIR)/Makefile</span>
<span style="color: #00A000">+        cd $(OPUS_BUILDDIR) && $(MAKE)</span>
<span style="color: #00A000">+        $(TOUCH_TARGET)</span>
<span style="color: #00A000">+</span>
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/codecs/mod_opus/mod_opus.c b/src/mod/codecs/mod_opus/mod_opus.c</span>
new file mode 100644
<span style="color: #000080; font-weight: bold">index 0000000..341254f</span>
<span style="color: #A00000">--- /dev/null</span>
<span style="color: #00A000">+++ b/src/mod/codecs/mod_opus/mod_opus.c</span>
<span style="color: #800080; font-weight: bold">@@ -0,0 +1,209 @@</span>
<span style="color: #00A000">+/* </span>
<span style="color: #00A000">+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application</span>
<span style="color: #00A000">+ * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org></span>
<span style="color: #00A000">+ *</span>
<span style="color: #00A000">+ * Version: MPL 1.1</span>
<span style="color: #00A000">+ *</span>
<span style="color: #00A000">+ * The contents of this file are subject to the Mozilla Public License Version</span>
<span style="color: #00A000">+ * 1.1 (the "License"); you may not use this file except in compliance with</span>
<span style="color: #00A000">+ * the License. You may obtain a copy of the License at</span>
<span style="color: #00A000">+ * http://www.mozilla.org/MPL/</span>
<span style="color: #00A000">+ *</span>
<span style="color: #00A000">+ * Software distributed under the License is distributed on an "AS IS" basis,</span>
<span style="color: #00A000">+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License</span>
<span style="color: #00A000">+ * for the specific language governing rights and limitations under the</span>
<span style="color: #00A000">+ * License.</span>
<span style="color: #00A000">+ *</span>
<span style="color: #00A000">+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application</span>
<span style="color: #00A000">+ *</span>
<span style="color: #00A000">+ * The Initial Developer of the Original Code is</span>
<span style="color: #00A000">+ * Anthony Minessale II <anthm@freeswitch.org></span>
<span style="color: #00A000">+ * Portions created by the Initial Developer are Copyright (C)</span>
<span style="color: #00A000">+ * the Initial Developer. All Rights Reserved.</span>
<span style="color: #00A000">+ *</span>
<span style="color: #00A000">+ * Contributor(s):</span>
<span style="color: #00A000">+ * </span>
<span style="color: #00A000">+ * Brian K. West <brian@freeswitch.org></span>
<span style="color: #00A000">+ *</span>
<span style="color: #00A000">+ * mod_opus.c -- The OPUS ultra-low delay audio codec (http://www.opus-codec.org/)</span>
<span style="color: #00A000">+ *</span>
<span style="color: #00A000">+ */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+#include "switch.h"</span>
<span style="color: #00A000">+#include "opus.h"</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+SWITCH_MODULE_LOAD_FUNCTION(mod_opus_load);</span>
<span style="color: #00A000">+SWITCH_MODULE_DEFINITION(mod_opus, mod_opus_load, NULL, NULL);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+struct opus_context {</span>
<span style="color: #00A000">+        OpusEncoder *encoder_object;</span>
<span style="color: #00A000">+        OpusDecoder *decoder_object;</span>
<span style="color: #00A000">+        int frame_size;</span>
<span style="color: #00A000">+};</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+static switch_status_t switch_opus_init(switch_codec_t *codec, switch_codec_flag_t flags, const switch_codec_settings_t *codec_settings)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        struct opus_context *context = NULL;</span>
<span style="color: #00A000">+        int encoding = (flags & SWITCH_CODEC_FLAG_ENCODE);</span>
<span style="color: #00A000">+        int decoding = (flags & SWITCH_CODEC_FLAG_DECODE);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if (!(encoding || decoding) || (!(context = switch_core_alloc(codec->memory_pool, sizeof(*context))))) {</span>
<span style="color: #00A000">+                return SWITCH_STATUS_FALSE;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        context->frame_size = codec->implementation->samples_per_packet;</span>
<span style="color: #00A000">+        </span>
<span style="color: #00A000">+        if (encoding) {</span>
<span style="color: #00A000">+                /* come up with a way to specify these */</span>
<span style="color: #00A000">+                int bitrate_bps = codec->implementation->bits_per_second;</span>
<span style="color: #00A000">+                int mode = MODE_HYBRID;</span>
<span style="color: #00A000">+                int use_vbr = 1;</span>
<span style="color: #00A000">+                int complexity = 10;</span>
<span style="color: #00A000">+                int use_inbandfec = 1;</span>
<span style="color: #00A000">+                int use_dtx = 1;</span>
<span style="color: #00A000">+                int bandwidth = BANDWIDTH_FULLBAND;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                context->encoder_object = opus_encoder_create(codec->implementation->actual_samples_per_second, codec->implementation->number_of_channels);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                opus_encoder_ctl(context->encoder_object, OPUS_SET_MODE(mode));</span>
<span style="color: #00A000">+                opus_encoder_ctl(context->encoder_object, OPUS_SET_BITRATE(bitrate_bps));</span>
<span style="color: #00A000">+                opus_encoder_ctl(context->encoder_object, OPUS_SET_BANDWIDTH(bandwidth));</span>
<span style="color: #00A000">+                opus_encoder_ctl(context->encoder_object, OPUS_SET_VBR_FLAG(use_vbr));</span>
<span style="color: #00A000">+                opus_encoder_ctl(context->encoder_object, OPUS_SET_COMPLEXITY(complexity));</span>
<span style="color: #00A000">+                opus_encoder_ctl(context->encoder_object, OPUS_SET_INBAND_FEC_FLAG(use_inbandfec));</span>
<span style="color: #00A000">+                opus_encoder_ctl(context->encoder_object, OPUS_SET_DTX_FLAG(use_dtx));</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        </span>
<span style="color: #00A000">+        if (decoding) {</span>
<span style="color: #00A000">+                context->decoder_object = opus_decoder_create(codec->implementation->actual_samples_per_second, codec->implementation->number_of_channels);</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        codec->private_info = context;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return SWITCH_STATUS_SUCCESS;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+static switch_status_t switch_opus_destroy(switch_codec_t *codec)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        codec->private_info = NULL;</span>
<span style="color: #00A000">+        return SWITCH_STATUS_SUCCESS;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+static switch_status_t switch_opus_encode(switch_codec_t *codec,</span>
<span style="color: #00A000">+                                                                                 switch_codec_t *other_codec,</span>
<span style="color: #00A000">+                                                                                 void *decoded_data,</span>
<span style="color: #00A000">+                                                                                 uint32_t decoded_data_len,</span>
<span style="color: #00A000">+                                                                                 uint32_t decoded_rate, void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate,</span>
<span style="color: #00A000">+                                                                                 unsigned int *flag)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        struct opus_context *context = codec->private_info;</span>
<span style="color: #00A000">+        int bytes = 0;</span>
<span style="color: #00A000">+        int len = (int) *encoded_data_len;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if (!context) {</span>
<span style="color: #00A000">+                return SWITCH_STATUS_FALSE;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if (len > 1275) len = 1275;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        bytes = opus_encode(context->encoder_object, (void *) decoded_data, decoded_data_len / 2, (unsigned char *) encoded_data, len);</span>
<span style="color: #00A000">+        </span>
<span style="color: #00A000">+        if (bytes > 0) {</span>
<span style="color: #00A000">+                *encoded_data_len = (uint32_t) bytes;</span>
<span style="color: #00A000">+                return SWITCH_STATUS_SUCCESS;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Encoder Error!\n");</span>
<span style="color: #00A000">+        return SWITCH_STATUS_GENERR;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+static switch_status_t switch_opus_decode(switch_codec_t *codec,</span>
<span style="color: #00A000">+                                                                                 switch_codec_t *other_codec,</span>
<span style="color: #00A000">+                                                                                 void *encoded_data,</span>
<span style="color: #00A000">+                                                                                 uint32_t encoded_data_len,</span>
<span style="color: #00A000">+                                                                                 uint32_t encoded_rate, void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate,</span>
<span style="color: #00A000">+                                                                                 unsigned int *flag)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        struct opus_context *context = codec->private_info;</span>
<span style="color: #00A000">+        int samples = 0;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if (!context) {</span>
<span style="color: #00A000">+                return SWITCH_STATUS_FALSE;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        </span>
<span style="color: #00A000">+        samples = opus_decode(context->decoder_object, encoded_data, encoded_data_len, decoded_data, *decoded_data_len);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if (samples < 0) {</span>
<span style="color: #00A000">+                return SWITCH_STATUS_GENERR;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        *decoded_data_len = samples * 2;</span>
<span style="color: #00A000">+        </span>
<span style="color: #00A000">+        return SWITCH_STATUS_SUCCESS;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+SWITCH_MODULE_LOAD_FUNCTION(mod_opus_load)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        switch_codec_interface_t *codec_interface;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* connect my internal structure to the blank pointer passed to me */</span>
<span style="color: #00A000">+        *module_interface = switch_loadable_module_create_module_interface(pool, modname);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        SWITCH_ADD_CODEC(codec_interface, "OPUS (BETA)");</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,        /* enumeration defining the type of the codec */</span>
<span style="color: #00A000">+                                                                                 115,        /* the IANA code number */</span>
<span style="color: #00A000">+                                                                                 "OPUS",        /* the IANA code name */</span>
<span style="color: #00A000">+                                                                                 NULL,        /* default fmtp to send (can be overridden by the init function) */</span>
<span style="color: #00A000">+                                                                                 48000,        /* samples transferred per second */</span>
<span style="color: #00A000">+                                                                                 48000,        /* actual samples transferred per second */</span>
<span style="color: #00A000">+                                                                                 32000,        /* bits transferred per second */</span>
<span style="color: #00A000">+                                                                                 10000,        /* number of microseconds per frame */</span>
<span style="color: #00A000">+                                                                                 80,        /* number of samples per frame */</span>
<span style="color: #00A000">+                                                                                 960,        /* number of bytes per frame decompressed */</span>
<span style="color: #00A000">+                                                                                 0,        /* number of bytes per frame compressed */</span>
<span style="color: #00A000">+                                                                                 1,        /* number of channels represented */</span>
<span style="color: #00A000">+                                                                                 1,        /* number of frames per network packet */</span>
<span style="color: #00A000">+                                                                                 switch_opus_init,        /* function to initialize a codec handle using this implementation */</span>
<span style="color: #00A000">+                                                                                 switch_opus_encode,        /* function to encode raw data into encoded data */</span>
<span style="color: #00A000">+                                                                                 switch_opus_decode,        /* function to decode encoded data into raw data */</span>
<span style="color: #00A000">+                                                                                 switch_opus_destroy);        /* deinitalize a codec handle using this implementation */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,        /* enumeration defining the type of the codec */</span>
<span style="color: #00A000">+                                                                                 115,        /* the IANA code number */</span>
<span style="color: #00A000">+                                                                                 "OPUS",        /* the IANA code name */</span>
<span style="color: #00A000">+                                                                                 NULL,        /* default fmtp to send (can be overridden by the init function) */</span>
<span style="color: #00A000">+                                                                                 48000,        /* samples transferred per second */</span>
<span style="color: #00A000">+                                                                                 48000,        /* actual samples transferred per second */</span>
<span style="color: #00A000">+                                                                                 32000,        /* bits transferred per second */</span>
<span style="color: #00A000">+                                                                                 20000,        /* number of microseconds per frame */</span>
<span style="color: #00A000">+                                                                                 160,        /* number of samples per frame */</span>
<span style="color: #00A000">+                                                                                 1920,        /* number of bytes per frame decompressed */</span>
<span style="color: #00A000">+                                                                                 0,        /* number of bytes per frame compressed */</span>
<span style="color: #00A000">+                                                                                 1,        /* number of channels represented */</span>
<span style="color: #00A000">+                                                                                 1,        /* number of frames per network packet */</span>
<span style="color: #00A000">+                                                                                 switch_opus_init,        /* function to initialize a codec handle using this implementation */</span>
<span style="color: #00A000">+                                                                                 switch_opus_encode,        /* function to encode raw data into encoded data */</span>
<span style="color: #00A000">+                                                                                 switch_opus_decode,        /* function to decode encoded data into raw data */</span>
<span style="color: #00A000">+                                                                                 switch_opus_destroy);        /* deinitalize a codec handle using this implementation */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* indicate that the module should continue to be loaded */</span>
<span style="color: #00A000">+        return SWITCH_STATUS_SUCCESS;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/* For Emacs:</span>
<span style="color: #00A000">+ * Local Variables:</span>
<span style="color: #00A000">+ * mode:c</span>
<span style="color: #00A000">+ * indent-tabs-mode:t</span>
<span style="color: #00A000">+ * tab-width:4</span>
<span style="color: #00A000">+ * c-basic-offset:4</span>
<span style="color: #00A000">+ * End:</span>
<span style="color: #00A000">+ * For VIM:</span>
<span style="color: #00A000">+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:</span>
<span style="color: #00A000">+ */</span>
</pre></div>
<div class="highlight"><pre>committer: Christopher Rienzo
comments:
forgot this spot when closing speech channel
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c b/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c</span>
<span style="color: #000080; font-weight: bold">index 812744c..734ef21 100644</span>
<span style="color: #A00000">--- a/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c</span>
<span style="color: #00A000">+++ b/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c</span>
<span style="color: #800080; font-weight: bold">@@ -1362,6 +1362,8 @@ static switch_status_t speech_channel_stop(speech_channel_t *schannel)</span>
                        goto done;
                }
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) %s stopped\n", schannel->name, speech_channel_type_to_string(schannel->type));
<span style="color: #00A000">+        } else if (schannel->state == SPEECH_CHANNEL_DONE) {</span>
<span style="color: #00A000">+                speech_channel_set_state(schannel, SPEECH_CHANNEL_READY);</span>
        }
done:
</pre></div>
<div class="highlight"><pre>committer: Christopher Rienzo
comments:
FS-3201 fix truncated TTS
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c b/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c</span>
<span style="color: #000080; font-weight: bold">index 5db1491..812744c 100644</span>
<span style="color: #A00000">--- a/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c</span>
<span style="color: #00A000">+++ b/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c</span>
<span style="color: #800080; font-weight: bold">@@ -260,6 +260,7 @@ static switch_status_t audio_queue_create(audio_queue_t ** queue, const char *na</span>
static switch_status_t audio_queue_write(audio_queue_t *queue, void *data, switch_size_t *data_len);
static switch_status_t audio_queue_read(audio_queue_t *queue, void *data, switch_size_t *data_len, int block);
static switch_status_t audio_queue_clear(audio_queue_t *queue);
<span style="color: #00A000">+static switch_status_t audio_queue_signal(audio_queue_t *queue);</span>
static switch_status_t audio_queue_destroy(audio_queue_t *queue);
/*********************************************************************************************************************************************
<span style="color: #800080; font-weight: bold">@@ -287,6 +288,8 @@ enum speech_channel_state {</span>
        SPEECH_CHANNEL_READY,
        /** processing speech request */
        SPEECH_CHANNEL_PROCESSING,
<span style="color: #00A000">+        /** finished processing speech request */</span>
<span style="color: #00A000">+        SPEECH_CHANNEL_DONE,</span>
        /** error opening channel */
        SPEECH_CHANNEL_ERROR
};
<span style="color: #800080; font-weight: bold">@@ -667,10 +670,12 @@ static switch_status_t audio_queue_create(audio_queue_t ** audio_queue, const ch</span>
static switch_status_t audio_queue_write(audio_queue_t *queue, void *data, switch_size_t *data_len)
{
        switch_status_t status = SWITCH_STATUS_SUCCESS;
<span style="color: #00A000">+#ifdef MOD_UNIMRCP_DEBUG_AUDIO_QUEUE</span>
<span style="color: #00A000">+        switch_size_t len = *data_len;</span>
<span style="color: #00A000">+#endif</span>
        switch_mutex_lock(queue->mutex);
#ifdef MOD_UNIMRCP_DEBUG_AUDIO_QUEUE
<span style="color: #A00000">-        switch_size_t len = *data_len;</span>
        if (queue->file_write) {
                switch_file_write(queue->file_write, data, &len);
        }
<span style="color: #800080; font-weight: bold">@@ -708,6 +713,9 @@ static switch_status_t audio_queue_read(audio_queue_t *queue, void *data, switch</span>
{
        switch_size_t requested = *data_len;
        switch_status_t status = SWITCH_STATUS_SUCCESS;
<span style="color: #00A000">+#ifdef MOD_UNIMRCP_DEBUG_AUDIO_QUEUE</span>
<span style="color: #00A000">+        switch_size_t len = *data_len;</span>
<span style="color: #00A000">+#endif</span>
        switch_mutex_lock(queue->mutex);
        /* wait for data, if allowed */
<span style="color: #800080; font-weight: bold">@@ -736,7 +744,6 @@ static switch_status_t audio_queue_read(audio_queue_t *queue, void *data, switch</span>
#ifdef MOD_UNIMRCP_DEBUG_AUDIO_QUEUE
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) audio queue read total = %ld\tread = %ld\trequested = %ld\n", queue->name,
                                         queue->read_bytes, *data_len, requested);
<span style="color: #A00000">-        switch_size_t len = *data_len;</span>
        if (queue->file_read) {
                switch_file_write(queue->file_read, data, &len);
        }
<span style="color: #800080; font-weight: bold">@@ -764,6 +771,20 @@ static switch_status_t audio_queue_clear(audio_queue_t *queue)</span>
}
/**
<span style="color: #00A000">+ * Wake any threads waiting on this queue</span>
<span style="color: #00A000">+ *</span>
<span style="color: #00A000">+ * @param queue the queue to empty</span>
<span style="color: #00A000">+ * @return SWITCH_STATUS_SUCCESS</span>
<span style="color: #00A000">+ */</span>
<span style="color: #00A000">+static switch_status_t audio_queue_signal(audio_queue_t *queue)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        switch_mutex_lock(queue->mutex);</span>
<span style="color: #00A000">+        switch_thread_cond_signal(queue->cond);</span>
<span style="color: #00A000">+        switch_mutex_unlock(queue->mutex);</span>
<span style="color: #00A000">+        return SWITCH_STATUS_SUCCESS;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/**</span>
* Destroy the audio queue
*
* @param queue the queue to clean up
<span style="color: #800080; font-weight: bold">@@ -1438,9 +1459,19 @@ static switch_status_t speech_channel_read(speech_channel_t *schannel, void *dat</span>
        }
        switch_mutex_lock(schannel->mutex);
<span style="color: #A00000">-        if (schannel->state == SPEECH_CHANNEL_PROCESSING) {</span>
<span style="color: #00A000">+        switch (schannel->state) {</span>
<span style="color: #00A000">+        case SPEECH_CHANNEL_DONE:</span>
<span style="color: #00A000">+                /* pull any remaining audio - never blocking */</span>
<span style="color: #00A000">+                if (audio_queue_read(schannel->audio_queue, data, len, 0) == SWITCH_STATUS_FALSE) {</span>
<span style="color: #00A000">+                        /* all frames read */</span>
<span style="color: #00A000">+                        status = SWITCH_STATUS_BREAK;</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+                break;</span>
<span style="color: #00A000">+        case SPEECH_CHANNEL_PROCESSING:</span>
<span style="color: #00A000">+                /* IN-PROGRESS */</span>
                audio_queue_read(schannel->audio_queue, data, len, block);
<span style="color: #A00000">-        } else {</span>
<span style="color: #00A000">+                break;</span>
<span style="color: #00A000">+        default:</span>
                status = SWITCH_STATUS_BREAK;
        }
        switch_mutex_unlock(schannel->mutex);
<span style="color: #800080; font-weight: bold">@@ -1463,6 +1494,8 @@ static const char *speech_channel_state_to_string(speech_channel_state_t state)</span>
                return "READY";
        case SPEECH_CHANNEL_PROCESSING:
                return "PROCESSING";
<span style="color: #00A000">+        case SPEECH_CHANNEL_DONE:</span>
<span style="color: #00A000">+                return "DONE";</span>
        case SPEECH_CHANNEL_ERROR:
                return "ERROR";
        }
<span style="color: #800080; font-weight: bold">@@ -1498,7 +1531,7 @@ static switch_status_t speech_channel_set_state_unlocked(speech_channel_t *schan</span>
{
        if (schannel->state == SPEECH_CHANNEL_PROCESSING && state != SPEECH_CHANNEL_PROCESSING) {
                /* wake anyone waiting for audio data */
<span style="color: #A00000">-                audio_queue_clear(schannel->audio_queue);</span>
<span style="color: #00A000">+                audio_queue_signal(schannel->audio_queue);</span>
        }
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) %s ==> %s\n", schannel->name, speech_channel_state_to_string(schannel->state),
<span style="color: #800080; font-weight: bold">@@ -1651,6 +1684,8 @@ static switch_status_t synth_speech_read_tts(switch_speech_handle_t *sh, void *d</span>
                        memset((uint8_t *) data + bytes_read, schannel->silence, *datalen - bytes_read);
                }
        } else {
<span style="color: #00A000">+                /* ready for next speak request */</span>
<span style="color: #00A000">+                speech_channel_set_state(schannel, SPEECH_CHANNEL_READY);</span>
                *datalen = 0;
                status = SWITCH_STATUS_BREAK;
        }
<span style="color: #800080; font-weight: bold">@@ -1878,7 +1913,7 @@ static apt_bool_t synth_on_message_receive(mrcp_application_t *application, mrcp</span>
                        if (message->start_line.request_state == MRCP_REQUEST_STATE_COMPLETE) {
                                /* got COMPLETE */
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) COMPLETE\n", schannel->name);
<span style="color: #A00000">-                                speech_channel_set_state(schannel, SPEECH_CHANNEL_READY);</span>
<span style="color: #00A000">+                                speech_channel_set_state(schannel, SPEECH_CHANNEL_DONE);</span>
                        } else {
                                /* received unexpected request state */
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) unexpected STOP response, request_state = %d\n", schannel->name,
<span style="color: #800080; font-weight: bold">@@ -1896,7 +1931,7 @@ static apt_bool_t synth_on_message_receive(mrcp_application_t *application, mrcp</span>
                if (message->start_line.method_id == SYNTHESIZER_SPEAK_COMPLETE) {
                        /* got SPEAK-COMPLETE */
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) SPEAK-COMPLETE\n", schannel->name);
<span style="color: #A00000">-                        speech_channel_set_state(schannel, SPEECH_CHANNEL_READY);</span>
<span style="color: #00A000">+                        speech_channel_set_state(schannel, SPEECH_CHANNEL_DONE);</span>
                } else {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) unexpected event, method_id = %d\n", schannel->name,
                                                         (int) message->start_line.method_id);
</pre></div>
<div class="highlight"><pre>committer: Anthony Minessale
comments:
add default to conf to demonstrate min-idle-cpu
<span style="color: #000080; font-weight: bold">diff --git a/conf/autoload_configs/switch.conf.xml b/conf/autoload_configs/switch.conf.xml</span>
<span style="color: #000080; font-weight: bold">index 8342f12..32cb76f 100644</span>
<span style="color: #A00000">--- a/conf/autoload_configs/switch.conf.xml</span>
<span style="color: #00A000">+++ b/conf/autoload_configs/switch.conf.xml</span>
<span style="color: #800080; font-weight: bold">@@ -23,6 +23,10 @@</span>
<settings>
<!--Colorize the Console -->
<param name="colorize-console" value="true"/>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+ <!-- minimum idle CPU before refusing calls --></span>
<span style="color: #00A000">+ <param name="min-idle-cpu" value="25"/></span>
<span style="color: #00A000">+</span>
<!--
        Max number of sessions to allow at any given time.
        
</pre></div>
<div class="highlight"><pre>committer: Anthony Minessale
comments:
fix sql err
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c</span>
<span style="color: #000080; font-weight: bold">index a38a61e..2313cb7 100644</span>
<span style="color: #A00000">--- a/src/mod/endpoints/mod_sofia/sofia_presence.c</span>
<span style="color: #00A000">+++ b/src/mod/endpoints/mod_sofia/sofia_presence.c</span>
<span style="color: #800080; font-weight: bold">@@ -2576,7 +2576,7 @@ uint32_t sofia_presence_contact_count(sofia_profile_t *profile, const char *cont</span>
        char buf[32] = "";
        char *sql;
        
<span style="color: #A00000">-        sql = switch_mprintf("select count(*) from sip_subscriptions where profile_name='%q' and contact_str='%q'", profile->name, contact_str);</span>
<span style="color: #00A000">+        sql = switch_mprintf("select count(*) from sip_subscriptions where profile_name='%q' and contact='%q'", profile->name, contact_str);</span>
        
        sofia_glue_execute_sql2str(profile, profile->ireg_mutex, sql, buf, sizeof(buf));
        switch_safe_free(sql);
</pre></div>
<div class="highlight"><pre>committer: Jeff Lenk
comments:
FS-3033 VS2010 libportaudio project improvements for DirectX builds and switch to build DirectX by default
<span style="color: #000080; font-weight: bold">diff --git a/Freeswitch.2010.sln b/Freeswitch.2010.sln</span>
<span style="color: #000080; font-weight: bold">index edee701..464cb2e 100644</span>
<span style="color: #A00000">--- a/Freeswitch.2010.sln</span>
<span style="color: #00A000">+++ b/Freeswitch.2010.sln</span>
<span style="color: #800080; font-weight: bold">@@ -1569,18 +1569,18 @@ Global</span>
                {0A18A071-125E-442F-AFF7-A3F68ABECF99}.All|x64 Setup.ActiveCfg = Release DirectSound|x64
                {0A18A071-125E-442F-AFF7-A3F68ABECF99}.All|x64 Setup.Build.0 = Release DirectSound|x64
                {0A18A071-125E-442F-AFF7-A3F68ABECF99}.All|x86 Setup.ActiveCfg = Release DirectSound|x64
<span style="color: #A00000">-                {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Debug|Win32.ActiveCfg = Debug|Win32</span>
<span style="color: #A00000">-                {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Debug|Win32.Build.0 = Debug|Win32</span>
<span style="color: #A00000">-                {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Debug|x64.ActiveCfg = Debug|x64</span>
<span style="color: #A00000">-                {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Debug|x64.Build.0 = Debug|x64</span>
<span style="color: #A00000">-                {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Debug|x64 Setup.ActiveCfg = Debug|x64</span>
<span style="color: #A00000">-                {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Debug|x86 Setup.ActiveCfg = Debug|Win32</span>
<span style="color: #A00000">-                {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release|Win32.ActiveCfg = Release|Win32</span>
<span style="color: #A00000">-                {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release|Win32.Build.0 = Release|Win32</span>
<span style="color: #A00000">-                {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release|x64.ActiveCfg = Release|x64</span>
<span style="color: #A00000">-                {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release|x64.Build.0 = Release|x64</span>
<span style="color: #A00000">-                {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release|x64 Setup.ActiveCfg = Release|x64</span>
<span style="color: #A00000">-                {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release|x86 Setup.ActiveCfg = Release|Win32</span>
<span style="color: #00A000">+                {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Debug|Win32.ActiveCfg = Debug DirectSound|Win32</span>
<span style="color: #00A000">+                {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Debug|Win32.Build.0 = Debug DirectSound|Win32</span>
<span style="color: #00A000">+                {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Debug|x64.ActiveCfg = Debug DirectSound|x64</span>
<span style="color: #00A000">+                {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Debug|x64.Build.0 = Debug DirectSound|x64</span>
<span style="color: #00A000">+                {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Debug|x64 Setup.ActiveCfg = Debug DirectSound|x64</span>
<span style="color: #00A000">+                {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Debug|x86 Setup.ActiveCfg = Debug DirectSound|Win32</span>
<span style="color: #00A000">+                {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release|Win32.ActiveCfg = Release DirectSound|Win32</span>
<span style="color: #00A000">+                {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release|Win32.Build.0 = Release DirectSound|Win32</span>
<span style="color: #00A000">+                {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release|x64.ActiveCfg = Release DirectSound|x64</span>
<span style="color: #00A000">+                {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release|x64.Build.0 = Release DirectSound|x64</span>
<span style="color: #00A000">+                {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release|x64 Setup.ActiveCfg = Release DirectSound|x64</span>
<span style="color: #00A000">+                {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release|x86 Setup.ActiveCfg = Release DirectSound|Win32</span>
                {08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.All|Win32.ActiveCfg = Release|x64
                {08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.All|x64.ActiveCfg = Release|x64
                {08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.All|x64.Build.0 = Release|x64
<span style="color: #000080; font-weight: bold">diff --git a/libs/portaudio/build/msvc/portaudio.2010.vcxproj b/libs/portaudio/build/msvc/portaudio.2010.vcxproj</span>
<span style="color: #000080; font-weight: bold">index b4eca56..10b4c25 100644</span>
<span style="color: #A00000">--- a/libs/portaudio/build/msvc/portaudio.2010.vcxproj</span>
<span style="color: #00A000">+++ b/libs/portaudio/build/msvc/portaudio.2010.vcxproj</span>
<span style="color: #800080; font-weight: bold">@@ -41,11 +41,11 @@</span>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release DirectSound|Win32'" Label="Configuration">
<span style="color: #A00000">- <ConfigurationType>DynamicLibrary</ConfigurationType></span>
<span style="color: #00A000">+ <ConfigurationType>StaticLibrary</ConfigurationType></span>
<UseOfMfc>false</UseOfMfc>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug DirectSound|Win32'" Label="Configuration">
<span style="color: #A00000">- <ConfigurationType>DynamicLibrary</ConfigurationType></span>
<span style="color: #00A000">+ <ConfigurationType>StaticLibrary</ConfigurationType></span>
<UseOfMfc>false</UseOfMfc>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<span style="color: #800080; font-weight: bold">@@ -57,11 +57,11 @@</span>
<UseOfMfc>false</UseOfMfc>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release DirectSound|x64'" Label="Configuration">
<span style="color: #A00000">- <ConfigurationType>DynamicLibrary</ConfigurationType></span>
<span style="color: #00A000">+ <ConfigurationType>StaticLibrary</ConfigurationType></span>
<UseOfMfc>false</UseOfMfc>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug DirectSound|x64'" Label="Configuration">
<span style="color: #A00000">- <ConfigurationType>DynamicLibrary</ConfigurationType></span>
<span style="color: #00A000">+ <ConfigurationType>StaticLibrary</ConfigurationType></span>
<UseOfMfc>false</UseOfMfc>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<span style="color: #800080; font-weight: bold">@@ -77,9 +77,11 @@</span>
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release DirectSound|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<span style="color: #00A000">+ <Import Project="..\..\..\..\w32\extlib.props" /></span>
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug DirectSound|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<span style="color: #00A000">+ <Import Project="..\..\..\..\w32\extlib.props" /></span>
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<span style="color: #800080; font-weight: bold">@@ -92,10 +94,12 @@</span>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release DirectSound|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
<span style="color: #00A000">+ <Import Project="..\..\..\..\w32\extlib.props" /></span>
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug DirectSound|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
<span style="color: #00A000">+ <Import Project="..\..\..\..\w32\extlib.props" /></span>
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<span style="color: #800080; font-weight: bold">@@ -110,18 +114,6 @@</span>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<span style="color: #A00000">- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug DirectSound|Win32'">$(Configuration)\</OutDir></span>
<span style="color: #A00000">- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug DirectSound|Win32'">$(Configuration)\</IntDir></span>
<span style="color: #A00000">- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug DirectSound|Win32'">true</LinkIncremental></span>
<span style="color: #A00000">- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug DirectSound|x64'">$(Platform)\$(Configuration)\</OutDir></span>
<span style="color: #A00000">- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug DirectSound|x64'">$(Platform)\$(Configuration)\</IntDir></span>
<span style="color: #A00000">- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug DirectSound|x64'">true</LinkIncremental></span>
<span style="color: #A00000">- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release DirectSound|Win32'">$(Configuration)\</OutDir></span>
<span style="color: #A00000">- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release DirectSound|Win32'">$(Configuration)\</IntDir></span>
<span style="color: #A00000">- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release DirectSound|Win32'">false</LinkIncremental></span>
<span style="color: #A00000">- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release DirectSound|x64'">$(Platform)\$(Configuration)\</OutDir></span>
<span style="color: #A00000">- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release DirectSound|x64'">$(Platform)\$(Configuration)\</IntDir></span>
<span style="color: #A00000">- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release DirectSound|x64'">false</LinkIncremental></span>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Midl>
<span style="color: #800080; font-weight: bold">@@ -231,45 +223,23 @@</span>
<MkTypLibCompatible>true</MkTypLibCompatible>
<SuppressStartupBanner>true</SuppressStartupBanner>
<TargetEnvironment>Win32</TargetEnvironment>
<span style="color: #A00000">- <TypeLibraryName>.\Debug_x86/portaudio.tlb</TypeLibraryName></span>
<span style="color: #A00000">- <HeaderFileName></span>
<span style="color: #A00000">- </HeaderFileName></span>
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\src\common;..\..\include;.\;..\..\src\os\win;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<span style="color: #A00000">- <PreprocessorDefinitions>WIN32;_DEBUG;_USRDLL;PA_ENABLE_DEBUG_OUTPUT;_CRT_SECURE_NO_DEPRECATE;PA_NO_ASIO;PAWIN_USE_WDMKS_DEVICE_INFO;%(PreprocessorDefinitions)</PreprocessorDefinitions></span>
<span style="color: #00A000">+ <PreprocessorDefinitions>WIN32;_DEBUG;_USRDLL;PA_ENABLE_DEBUG_OUTPUT;_CRT_SECURE_NO_DEPRECATE;PA_NO_ASIO;PA_NO_WMME;PAWIN_USE_WDMKS_DEVICE_INFO;%(PreprocessorDefinitions)</PreprocessorDefinitions></span>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<span style="color: #A00000">- <PrecompiledHeaderOutputFile>$(Platform)\$(Configuration)/portaudio.pch</PrecompiledHeaderOutputFile></span>
<span style="color: #A00000">- <AssemblerListingLocation>$(Platform)\$(Configuration)\</AssemblerListingLocation></span>
<span style="color: #A00000">- <ObjectFileName>$(Platform)\$(Configuration)\</ObjectFileName></span>
<span style="color: #A00000">- <ProgramDataBaseFileName>$(Platform)\$(Configuration)\</ProgramDataBaseFileName></span>
<WarningLevel>Level3</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<span style="color: #A00000">- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat></span>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
</ResourceCompile>
<span style="color: #A00000">- <Link></span>
<span style="color: #A00000">- <AdditionalDependencies>ksuser.lib;%(AdditionalDependencies)</AdditionalDependencies></span>
<span style="color: #A00000">- <OutputFile>$(Platform)\$(Configuration)\portaudio_x86.dll</OutputFile></span>
<span style="color: #A00000">- <SuppressStartupBanner>true</SuppressStartupBanner></span>
<span style="color: #A00000">- <ModuleDefinitionFile>.\portaudio.def</ModuleDefinitionFile></span>
<span style="color: #A00000">- <GenerateDebugInformation>true</GenerateDebugInformation></span>
<span style="color: #A00000">- <ProgramDatabaseFile>$(Platform)\$(Configuration)\portaudio_x86.pdb</ProgramDatabaseFile></span>
<span style="color: #A00000">- <RandomizedBaseAddress>false</RandomizedBaseAddress></span>
<span style="color: #A00000">- <DataExecutionPrevention></span>
<span style="color: #A00000">- </DataExecutionPrevention></span>
<span style="color: #A00000">- <ImportLibrary>$(Platform)\$(Configuration)\portaudio_x86.lib</ImportLibrary></span>
<span style="color: #A00000">- <TargetMachine>MachineX86</TargetMachine></span>
<span style="color: #A00000">- </Link></span>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
<span style="color: #A00000">- <OutputFile>$(Platform)\$(Configuration)\portaudio.bsc</OutputFile></span>
</Bscmake>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug DirectSound|x64'">
<span style="color: #800080; font-weight: bold">@@ -278,45 +248,23 @@</span>
<MkTypLibCompatible>true</MkTypLibCompatible>
<SuppressStartupBanner>true</SuppressStartupBanner>
<TargetEnvironment>X64</TargetEnvironment>
<span style="color: #A00000">- <TypeLibraryName>.\Debug_x86/portaudio.tlb</TypeLibraryName></span>
<span style="color: #A00000">- <HeaderFileName></span>
<span style="color: #A00000">- </HeaderFileName></span>
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\src\common;..\..\include;.\;..\..\src\os\win;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<span style="color: #A00000">- <PreprocessorDefinitions>WIN32;_DEBUG;_USRDLL;PA_ENABLE_DEBUG_OUTPUT;_CRT_SECURE_NO_DEPRECATE;PAWIN_USE_WDMKS_DEVICE_INFO;%(PreprocessorDefinitions)</PreprocessorDefinitions></span>
<span style="color: #00A000">+ <PreprocessorDefinitions>WIN32;_DEBUG;_USRDLL;PA_ENABLE_DEBUG_OUTPUT;_CRT_SECURE_NO_DEPRECATE;PA_NO_ASIO;PA_NO_WMME;PAWIN_USE_WDMKS_DEVICE_INFO;%(PreprocessorDefinitions)</PreprocessorDefinitions></span>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<span style="color: #A00000">- <PrecompiledHeaderOutputFile>$(Platform)\$(Configuration)\portaudio.pch</PrecompiledHeaderOutputFile></span>
<span style="color: #A00000">- <AssemblerListingLocation>$(Platform)\$(Configuration)\</AssemblerListingLocation></span>
<span style="color: #A00000">- <ObjectFileName>$(Platform)\$(Configuration)\</ObjectFileName></span>
<span style="color: #A00000">- <ProgramDataBaseFileName>$(Platform)\$(Configuration)\</ProgramDataBaseFileName></span>
<WarningLevel>Level3</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<span style="color: #A00000">- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat></span>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
</ResourceCompile>
<span style="color: #A00000">- <Link></span>
<span style="color: #A00000">- <AdditionalDependencies>ksuser.lib;%(AdditionalDependencies)</AdditionalDependencies></span>
<span style="color: #A00000">- <OutputFile>$(Platform)\$(Configuration)\portaudio_x64.dll</OutputFile></span>
<span style="color: #A00000">- <SuppressStartupBanner>true</SuppressStartupBanner></span>
<span style="color: #A00000">- <ModuleDefinitionFile>.\portaudio.def</ModuleDefinitionFile></span>
<span style="color: #A00000">- <GenerateDebugInformation>true</GenerateDebugInformation></span>
<span style="color: #A00000">- <ProgramDatabaseFile>$(Platform)\$(Configuration)/portaudio_x64.pdb</ProgramDatabaseFile></span>
<span style="color: #A00000">- <RandomizedBaseAddress>false</RandomizedBaseAddress></span>
<span style="color: #A00000">- <DataExecutionPrevention></span>
<span style="color: #A00000">- </DataExecutionPrevention></span>
<span style="color: #A00000">- <ImportLibrary>$(Platform)\$(Configuration)\portaudio_x64.lib</ImportLibrary></span>
<span style="color: #A00000">- <TargetMachine>MachineX64</TargetMachine></span>
<span style="color: #A00000">- </Link></span>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
<span style="color: #A00000">- <OutputFile>$(Platform)\$(Configuration)/portaudio_x64.bsc</OutputFile></span>
</Bscmake>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release DirectSound|Win32'">
<span style="color: #800080; font-weight: bold">@@ -325,22 +273,15 @@</span>
<MkTypLibCompatible>true</MkTypLibCompatible>
<SuppressStartupBanner>true</SuppressStartupBanner>
<TargetEnvironment>Win32</TargetEnvironment>
<span style="color: #A00000">- <TypeLibraryName>.\Release_x86/portaudio.tlb</TypeLibraryName></span>
<span style="color: #A00000">- <HeaderFileName></span>
<span style="color: #A00000">- </HeaderFileName></span>
</Midl>
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<span style="color: #A00000">- <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion></span>
<span style="color: #00A000">+ <InlineFunctionExpansion>Default</InlineFunctionExpansion></span>
<AdditionalIncludeDirectories>..\..\src\common;..\..\include;.\;..\..\src\os\win;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<span style="color: #A00000">- <PreprocessorDefinitions>WIN32;NDEBUG;_USRDLL;PA_ENABLE_DEBUG_OUTPUT;_CRT_SECURE_NO_DEPRECATE;PA_NO_ASIO;%(PreprocessorDefinitions)</PreprocessorDefinitions></span>
<span style="color: #00A000">+ <PreprocessorDefinitions>WIN32;NDEBUG;_USRDLL;PA_ENABLE_DEBUG_OUTPUT;_CRT_SECURE_NO_DEPRECATE;PA_NO_ASIO;PA_NO_WMME;%(PreprocessorDefinitions)</PreprocessorDefinitions></span>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<span style="color: #A00000">- <PrecompiledHeaderOutputFile>$(Platform)\$(Configuration)/portaudio.pch</PrecompiledHeaderOutputFile></span>
<span style="color: #A00000">- <AssemblerListingLocation>$(Platform)\$(Configuration)\</AssemblerListingLocation></span>
<span style="color: #A00000">- <ObjectFileName>$(Platform)\$(Configuration)\</ObjectFileName></span>
<span style="color: #A00000">- <ProgramDataBaseFileName>$(Platform)\$(Configuration)\</ProgramDataBaseFileName></span>
<WarningLevel>Level3</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
</ClCompile>
<span style="color: #800080; font-weight: bold">@@ -348,20 +289,8 @@</span>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
</ResourceCompile>
<span style="color: #A00000">- <Link></span>
<span style="color: #A00000">- <OutputFile>$(Platform)\$(Configuration)\portaudio_x86.dll</OutputFile></span>
<span style="color: #A00000">- <SuppressStartupBanner>true</SuppressStartupBanner></span>
<span style="color: #A00000">- <ModuleDefinitionFile>.\portaudio.def</ModuleDefinitionFile></span>
<span style="color: #A00000">- <ProgramDatabaseFile>$(Platform)\$(Configuration)\portaudio_x86.pdb</ProgramDatabaseFile></span>
<span style="color: #A00000">- <RandomizedBaseAddress>false</RandomizedBaseAddress></span>
<span style="color: #A00000">- <DataExecutionPrevention></span>
<span style="color: #A00000">- </DataExecutionPrevention></span>
<span style="color: #A00000">- <ImportLibrary>$(Platform)\$(Configuration)\portaudio_x86.lib</ImportLibrary></span>
<span style="color: #A00000">- <TargetMachine>MachineX86</TargetMachine></span>
<span style="color: #A00000">- </Link></span>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
<span style="color: #A00000">- <OutputFile>$(Platform)\$(Configuration)\portaudio.bsc</OutputFile></span>
</Bscmake>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release DirectSound|x64'">
<span style="color: #800080; font-weight: bold">@@ -370,22 +299,15 @@</span>
<MkTypLibCompatible>true</MkTypLibCompatible>
<SuppressStartupBanner>true</SuppressStartupBanner>
<TargetEnvironment>X64</TargetEnvironment>
<span style="color: #A00000">- <TypeLibraryName>.\Release_x86/portaudio.tlb</TypeLibraryName></span>
<span style="color: #A00000">- <HeaderFileName></span>
<span style="color: #A00000">- </HeaderFileName></span>
</Midl>
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<span style="color: #A00000">- <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion></span>
<span style="color: #A00000">- <AdditionalIncludeDirectories>..\..\src\common;..\..\include;.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories></span>
<span style="color: #A00000">- <PreprocessorDefinitions>WIN32;NDEBUG;_USRDLL;PA_ENABLE_DEBUG_OUTPUT;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions></span>
<span style="color: #00A000">+ <InlineFunctionExpansion>Default</InlineFunctionExpansion></span>
<span style="color: #00A000">+ <AdditionalIncludeDirectories>..\..\src\common;..\..\include;.\;..\..\src\os\win;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories></span>
<span style="color: #00A000">+ <PreprocessorDefinitions>WIN32;NDEBUG;_USRDLL;PA_ENABLE_DEBUG_OUTPUT;_CRT_SECURE_NO_DEPRECATE;PA_NO_ASIO;PA_NO_WMME;%(PreprocessorDefinitions)</PreprocessorDefinitions></span>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<span style="color: #A00000">- <PrecompiledHeaderOutputFile>$(Platform)\$(Configuration)\portaudio.pch</PrecompiledHeaderOutputFile></span>
<span style="color: #A00000">- <AssemblerListingLocation>$(Platform)\$(Configuration)\</AssemblerListingLocation></span>
<span style="color: #A00000">- <ObjectFileName>$(Platform)\$(Configuration)\</ObjectFileName></span>
<span style="color: #A00000">- <ProgramDataBaseFileName>$(Platform)\$(Configuration)\</ProgramDataBaseFileName></span>
<WarningLevel>Level3</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
</ClCompile>
<span style="color: #800080; font-weight: bold">@@ -393,20 +315,8 @@</span>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
</ResourceCompile>
<span style="color: #A00000">- <Link></span>
<span style="color: #A00000">- <OutputFile>$(Platform)\$(Configuration)\portaudio_x64.dll</OutputFile></span>
<span style="color: #A00000">- <SuppressStartupBanner>true</SuppressStartupBanner></span>
<span style="color: #A00000">- <ModuleDefinitionFile>.\portaudio.def</ModuleDefinitionFile></span>
<span style="color: #A00000">- <ProgramDatabaseFile>$(Platform)\$(Configuration)/portaudio_x64.pdb</ProgramDatabaseFile></span>
<span style="color: #A00000">- <RandomizedBaseAddress>false</RandomizedBaseAddress></span>
<span style="color: #A00000">- <DataExecutionPrevention></span>
<span style="color: #A00000">- </DataExecutionPrevention></span>
<span style="color: #A00000">- <ImportLibrary>$(Platform)\$(Configuration)/portaudio_x64.lib</ImportLibrary></span>
<span style="color: #A00000">- <TargetMachine>MachineX64</TargetMachine></span>
<span style="color: #A00000">- </Link></span>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
<span style="color: #A00000">- <OutputFile>$(Platform)\$(Configuration)\portaudio_x64.bsc</OutputFile></span>
</Bscmake>
</ItemDefinitionGroup>
<ItemGroup>
<span style="color: #800080; font-weight: bold">@@ -594,6 +504,7 @@</span>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug DirectSound|Win32'">true</ExcludedFromBuild>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug DirectSound|Win32'">..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug DirectSound|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
<span style="color: #00A000">+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug DirectSound|x64'">true</ExcludedFromBuild></span>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug DirectSound|x64'">..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug DirectSound|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<span style="color: #800080; font-weight: bold">@@ -605,6 +516,7 @@</span>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release DirectSound|Win32'">true</ExcludedFromBuild>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release DirectSound|Win32'">..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release DirectSound|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
<span style="color: #00A000">+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release DirectSound|x64'">true</ExcludedFromBuild></span>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release DirectSound|x64'">..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release DirectSound|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<span style="color: #800080; font-weight: bold">@@ -618,6 +530,7 @@</span>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug DirectSound|Win32'">true</ExcludedFromBuild>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug DirectSound|Win32'">..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug DirectSound|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
<span style="color: #00A000">+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug DirectSound|x64'">true</ExcludedFromBuild></span>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug DirectSound|x64'">..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug DirectSound|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<span style="color: #800080; font-weight: bold">@@ -629,6 +542,7 @@</span>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release DirectSound|Win32'">true</ExcludedFromBuild>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release DirectSound|Win32'">..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release DirectSound|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
<span style="color: #00A000">+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release DirectSound|x64'">true</ExcludedFromBuild></span>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release DirectSound|x64'">..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release DirectSound|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<span style="color: #800080; font-weight: bold">@@ -642,6 +556,7 @@</span>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug DirectSound|Win32'">true</ExcludedFromBuild>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug DirectSound|Win32'">..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug DirectSound|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
<span style="color: #00A000">+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug DirectSound|x64'">true</ExcludedFromBuild></span>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug DirectSound|x64'">..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug DirectSound|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<span style="color: #800080; font-weight: bold">@@ -653,6 +568,7 @@</span>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release DirectSound|Win32'">true</ExcludedFromBuild>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release DirectSound|Win32'">..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release DirectSound|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
<span style="color: #00A000">+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release DirectSound|x64'">true</ExcludedFromBuild></span>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release DirectSound|x64'">..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release DirectSound|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<span style="color: #800080; font-weight: bold">@@ -666,6 +582,7 @@</span>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug DirectSound|Win32'">true</ExcludedFromBuild>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug DirectSound|Win32'">..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug DirectSound|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
<span style="color: #00A000">+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug DirectSound|x64'">true</ExcludedFromBuild></span>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug DirectSound|x64'">..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug DirectSound|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<span style="color: #800080; font-weight: bold">@@ -677,6 +594,7 @@</span>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release DirectSound|Win32'">true</ExcludedFromBuild>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release DirectSound|Win32'">..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release DirectSound|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
<span style="color: #00A000">+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release DirectSound|x64'">true</ExcludedFromBuild></span>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release DirectSound|x64'">..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release DirectSound|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<span style="color: #800080; font-weight: bold">@@ -690,6 +608,7 @@</span>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug DirectSound|Win32'">true</ExcludedFromBuild>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug DirectSound|Win32'">..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug DirectSound|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
<span style="color: #00A000">+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug DirectSound|x64'">true</ExcludedFromBuild></span>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug DirectSound|x64'">..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug DirectSound|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<span style="color: #800080; font-weight: bold">@@ -701,6 +620,7 @@</span>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release DirectSound|Win32'">true</ExcludedFromBuild>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release DirectSound|Win32'">..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release DirectSound|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
<span style="color: #00A000">+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release DirectSound|x64'">true</ExcludedFromBuild></span>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release DirectSound|x64'">..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release DirectSound|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<span style="color: #800080; font-weight: bold">@@ -714,6 +634,7 @@</span>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug DirectSound|Win32'">true</ExcludedFromBuild>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug DirectSound|Win32'">..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug DirectSound|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
<span style="color: #00A000">+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug DirectSound|x64'">true</ExcludedFromBuild></span>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug DirectSound|x64'">..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug DirectSound|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<span style="color: #800080; font-weight: bold">@@ -725,6 +646,7 @@</span>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release DirectSound|Win32'">true</ExcludedFromBuild>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release DirectSound|Win32'">..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release DirectSound|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
<span style="color: #00A000">+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release DirectSound|x64'">true</ExcludedFromBuild></span>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release DirectSound|x64'">..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release DirectSound|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<span style="color: #800080; font-weight: bold">@@ -738,6 +660,7 @@</span>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug DirectSound|Win32'">true</ExcludedFromBuild>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug DirectSound|Win32'">..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug DirectSound|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
<span style="color: #00A000">+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug DirectSound|x64'">true</ExcludedFromBuild></span>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug DirectSound|x64'">..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug DirectSound|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<span style="color: #800080; font-weight: bold">@@ -749,6 +672,7 @@</span>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release DirectSound|Win32'">true</ExcludedFromBuild>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release DirectSound|Win32'">..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release DirectSound|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
<span style="color: #00A000">+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release DirectSound|x64'">true</ExcludedFromBuild></span>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release DirectSound|x64'">..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release DirectSound|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<span style="color: #800080; font-weight: bold">@@ -762,6 +686,7 @@</span>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug DirectSound|Win32'">true</ExcludedFromBuild>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug DirectSound|Win32'">..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug DirectSound|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
<span style="color: #00A000">+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug DirectSound|x64'">true</ExcludedFromBuild></span>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug DirectSound|x64'">..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug DirectSound|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<span style="color: #800080; font-weight: bold">@@ -773,6 +698,7 @@</span>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release DirectSound|Win32'">true</ExcludedFromBuild>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release DirectSound|Win32'">..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release DirectSound|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
<span style="color: #00A000">+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release DirectSound|x64'">true</ExcludedFromBuild></span>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release DirectSound|x64'">..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release DirectSound|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</pre></div>
<div class="highlight"><pre>committer: Anthony Minessale
comments:
add sanity check on jitterbuffer debug
<span style="color: #000080; font-weight: bold">diff --git a/src/switch_rtp.c b/src/switch_rtp.c</span>
<span style="color: #000080; font-weight: bold">index e8d7558..4df867a 100644</span>
<span style="color: #A00000">--- a/src/switch_rtp.c</span>
<span style="color: #00A000">+++ b/src/switch_rtp.c</span>
<span style="color: #800080; font-weight: bold">@@ -1875,6 +1875,10 @@ static void jb_logger(const char *file, const char *func, int line, int level, c</span>
SWITCH_DECLARE(switch_status_t) switch_rtp_debug_jitter_buffer(switch_rtp_t *rtp_session, const char *name)
{
<span style="color: #00A000">+        if (!switch_rtp_ready(rtp_session)) {</span>
<span style="color: #00A000">+                return SWITCH_STATUS_FALSE;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        </span>
        stfu_n_debug(rtp_session->jb, name);
        stfu_global_set_logger(jb_logger);
</pre></div>
<div class="highlight"><pre>committer: Anthony Minessale
comments:
skip blocking writes on fs_cli to avoid backing up event socket
<span style="color: #000080; font-weight: bold">diff --git a/libs/esl/fs_cli.c b/libs/esl/fs_cli.c</span>
<span style="color: #000080; font-weight: bold">index 19e8d7f..a70d63f 100644</span>
<span style="color: #A00000">--- a/libs/esl/fs_cli.c</span>
<span style="color: #00A000">+++ b/libs/esl/fs_cli.c</span>
<span style="color: #800080; font-weight: bold">@@ -589,22 +589,36 @@ static void *msg_thread_run(esl_thread_t *me, void *obj)</span>
        while(thread_running && handle->connected) {
                esl_status_t status = esl_recv_event_timed(handle, 10, 1, NULL);
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                if (WARN_STOP) {</span>
<span style="color: #A00000">-                        printf("Type control-D or /exit or /quit or /bye to exit.\n\n");</span>
<span style="color: #A00000">-                        WARN_STOP = 0;</span>
<span style="color: #A00000">-                }</span>
<span style="color: #00A000">+                int aok = 1;                </span>
                if (status == ESL_FAIL) {
<span style="color: #A00000">-                        esl_log(ESL_LOG_WARNING, "Disconnected.\n");</span>
<span style="color: #00A000">+                        if (aok) esl_log(ESL_LOG_WARNING, "Disconnected.\n");</span>
                        running = -1; thread_running = 0;
                } else if (status == ESL_SUCCESS) {
<span style="color: #00A000">+#ifndef WIN32</span>
<span style="color: #00A000">+                        fd_set can_write;</span>
<span style="color: #00A000">+                        int fd;</span>
<span style="color: #00A000">+                        struct timeval to;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                        fd = fileno(stdout);</span>
<span style="color: #00A000">+                        memset(&to, 0, sizeof(to));</span>
<span style="color: #00A000">+                        FD_ZERO(&can_write);</span>
<span style="color: #00A000">+                        FD_SET(fd, &can_write);</span>
<span style="color: #00A000">+                        to.tv_sec = 0;</span>
<span style="color: #00A000">+                        to.tv_usec = 100000;</span>
<span style="color: #00A000">+                        if (select(fd + 1, NULL, &can_write, NULL, &to) > 0) {</span>
<span style="color: #00A000">+                                aok = FD_ISSET(fd, &can_write);</span>
<span style="color: #00A000">+                        } else {</span>
<span style="color: #00A000">+                                aok = 0;</span>
<span style="color: #00A000">+                        }</span>
<span style="color: #00A000">+#endif</span>
<span style="color: #00A000">+                        </span>
                        if (handle->last_event) {
                                const char *type = esl_event_get_header(handle->last_event, "content-type");
                                int known = 0;
                                if (!esl_strlen_zero(type)) {
<span style="color: #A00000">-                                        if (!strcasecmp(type, "log/data")) {</span>
<span style="color: #00A000">+                                        if (aok && !strcasecmp(type, "log/data")) {</span>
                                                const char *userdata = esl_event_get_header(handle->last_event, "user-data");
                                                
                                                if (esl_strlen_zero(userdata) || esl_strlen_zero(filter_uuid) || !strcasecmp(filter_uuid, userdata)) {
<span style="color: #800080; font-weight: bold">@@ -631,7 +645,7 @@ static void *msg_thread_run(esl_thread_t *me, void *obj)</span>
                                        } else if (!strcasecmp(type, "text/disconnect-notice")) {
                                                running = -1; thread_running = 0;
                                                known++;
<span style="color: #A00000">-                                        } else if (!strcasecmp(type, "text/event-plain")) {</span>
<span style="color: #00A000">+                                        } else if (aok && !strcasecmp(type, "text/event-plain")) {</span>
                                                char *foo;
                                                esl_event_serialize(handle->last_ievent, &foo, ESL_FALSE);
                                                printf("RECV EVENT\n%s\n", foo);
<span style="color: #800080; font-weight: bold">@@ -641,7 +655,7 @@ static void *msg_thread_run(esl_thread_t *me, void *obj)</span>
                                        }
                                }
                                
<span style="color: #A00000">-                                if (!known) {</span>
<span style="color: #00A000">+                                if (aok && !known) {</span>
                                        char *foo;
                                        printf("INCOMING DATA [%s]\n%s\n", type, handle->last_event->body ? handle->last_event->body : "");
                                        esl_event_serialize(handle->last_event, &foo, ESL_FALSE);
<span style="color: #800080; font-weight: bold">@@ -651,6 +665,11 @@ static void *msg_thread_run(esl_thread_t *me, void *obj)</span>
                        }
                }
<span style="color: #00A000">+                if (WARN_STOP) {</span>
<span style="color: #00A000">+                        if (aok) printf("Type control-D or /exit or /quit or /bye to exit.\n\n");</span>
<span style="color: #00A000">+                        WARN_STOP = 0;</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+</span>
                usleep(1000);
        }
</pre></div>
<div class="highlight"><pre>committer: Anthony Minessale
comments:
fix regression from f60fdf653dd2d7f8d3eaa6a9086e1f68bd993c59
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c</span>
<span style="color: #000080; font-weight: bold">index 0b16492..f7bf86b 100755</span>
<span style="color: #A00000">--- a/src/mod/applications/mod_dptools/mod_dptools.c</span>
<span style="color: #00A000">+++ b/src/mod/applications/mod_dptools/mod_dptools.c</span>
<span style="color: #800080; font-weight: bold">@@ -2774,7 +2774,7 @@ static switch_call_cause_t group_outgoing_channel(switch_core_session_t *session</span>
        switch_originate_flag_t myflags = SOF_NONE;
        char *cid_name_override = NULL;
        char *cid_num_override = NULL;
<span style="color: #A00000">-        char *domain = NULL;</span>
<span style="color: #00A000">+        char *domain = NULL, *dup_domain = NULL;</span>
        switch_channel_t *new_channel = NULL;
        unsigned int timelimit = 60;
        const char *skip, *var;
<span style="color: #800080; font-weight: bold">@@ -2788,6 +2788,7 @@ static switch_call_cause_t group_outgoing_channel(switch_core_session_t *session</span>
                *domain++ = '\0';
        } else {
                domain = switch_core_get_variable_pdup("domain", switch_core_session_get_pool(session));
<span style="color: #00A000">+                dup_domain = domain;</span>
        }
        if (!domain) {
<span style="color: #800080; font-weight: bold">@@ -2859,6 +2860,7 @@ static switch_call_cause_t group_outgoing_channel(switch_core_session_t *session</span>
        switch_safe_free(template);
        switch_safe_free(group);
<span style="color: #00A000">+        switch_safe_free(dup_domain);</span>
        if (cause == SWITCH_CAUSE_NONE) {
                cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/dialplans/mod_dialplan_asterisk/mod_dialplan_asterisk.c b/src/mod/dialplans/mod_dialplan_asterisk/mod_dialplan_asterisk.c</span>
<span style="color: #000080; font-weight: bold">index 43534da..3bc5cb4 100644</span>
<span style="color: #A00000">--- a/src/mod/dialplans/mod_dialplan_asterisk/mod_dialplan_asterisk.c</span>
<span style="color: #00A000">+++ b/src/mod/dialplans/mod_dialplan_asterisk/mod_dialplan_asterisk.c</span>
<span style="color: #800080; font-weight: bold">@@ -309,11 +309,13 @@ static switch_call_cause_t sip_outgoing_channel(switch_core_session_t *session,</span>
                                                                                                switch_call_cause_t *cancel_cause)
{
        const char *profile;
<span style="color: #00A000">+        char *dup_profile = NULL;</span>
        if (session) {
                profile = switch_channel_get_variable(switch_core_session_get_channel(session), "sip_profile");
        } else {
<span style="color: #A00000">-                profile = switch_core_get_variable_pdup("sip_profile", switch_core_session_get_pool(session));</span>
<span style="color: #00A000">+                dup_profile = switch_core_get_variable_dup("sip_profile");</span>
<span style="color: #00A000">+                profile = dup_profile;</span>
        }
        if (zstr(profile)) {
                profile = "default";
<span style="color: #800080; font-weight: bold">@@ -323,6 +325,8 @@ static switch_call_cause_t sip_outgoing_channel(switch_core_session_t *session,</span>
        UNPROTECT_INTERFACE(sip_endpoint_interface);
<span style="color: #00A000">+        switch_safe_free(dup_profile);</span>
<span style="color: #00A000">+</span>
        return switch_core_session_outgoing_channel(session, var_event, "sofia", outbound_profile, new_session, pool, SOF_NONE, cancel_cause);
}
</pre></div>
<div class="highlight"><pre>committer: Anthony Minessale
comments:
fix regression from f60fdf653dd2d7f8d3eaa6a9086e1f68bd993c59
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c</span>
<span style="color: #000080; font-weight: bold">index 4be2a64..0b16492 100755</span>
<span style="color: #A00000">--- a/src/mod/applications/mod_dptools/mod_dptools.c</span>
<span style="color: #00A000">+++ b/src/mod/applications/mod_dptools/mod_dptools.c</span>
<span style="color: #800080; font-weight: bold">@@ -2887,7 +2887,7 @@ static switch_call_cause_t user_outgoing_channel(switch_core_session_t *session,</span>
                                                                                                 switch_call_cause_t *cancel_cause)
{
        switch_xml_t x_domain = NULL, xml = NULL, x_user = NULL, x_group = NULL, x_param, x_params;
<span style="color: #A00000">-        char *user = NULL, *domain = NULL;</span>
<span style="color: #00A000">+        char *user = NULL, *domain = NULL, *dup_domain = NULL;</span>
        const char *dest = NULL;
        static switch_call_cause_t cause = SWITCH_CAUSE_NONE;
        unsigned int timelimit = 60;
<span style="color: #800080; font-weight: bold">@@ -2908,7 +2908,8 @@ static switch_call_cause_t user_outgoing_channel(switch_core_session_t *session,</span>
        if ((domain = strchr(user, '@'))) {
                *domain++ = '\0';
        } else {
<span style="color: #A00000">-                domain = switch_core_get_variable_pdup("domain", switch_core_session_get_pool(session));</span>
<span style="color: #00A000">+                domain = switch_core_get_variable_dup("domain");</span>
<span style="color: #00A000">+                dup_domain = domain;</span>
        }
        if (!domain) {
<span style="color: #800080; font-weight: bold">@@ -3115,6 +3116,7 @@ static switch_call_cause_t user_outgoing_channel(switch_core_session_t *session,</span>
        }
        switch_safe_free(user);
<span style="color: #00A000">+        switch_safe_free(dup_domain);</span>
        return cause;
}
</pre></div>
<div class="highlight"><pre>committer: Jeff Lenk
comments:
fix iLBC under windows
<span style="color: #000080; font-weight: bold">diff --git a/libs/ilbc/src/iLBC_decode.c b/libs/ilbc/src/iLBC_decode.c</span>
<span style="color: #000080; font-weight: bold">index fc46fe4..9fc7a24 100644</span>
<span style="color: #A00000">--- a/libs/ilbc/src/iLBC_decode.c</span>
<span style="color: #00A000">+++ b/libs/ilbc/src/iLBC_decode.c</span>
<span style="color: #800080; font-weight: bold">@@ -47,7 +47,9 @@</span>
        {
fld dbl
frndint
<span style="color: #00A000">+ fstp dbl</span>
}
<span style="color: #00A000">+ return (long int) dbl;</span>
}
#elif defined (_WIN64)
#include <intrin.h>
</pre></div>
<div class="highlight"><pre>committer: Anthony Minessale
comments:
block control-z from fs cli and print a warning how to exit properly
<span style="color: #000080; font-weight: bold">diff --git a/libs/esl/fs_cli.c b/libs/esl/fs_cli.c</span>
<span style="color: #000080; font-weight: bold">index 1e3bf04..19e8d7f 100644</span>
<span style="color: #A00000">--- a/libs/esl/fs_cli.c</span>
<span style="color: #00A000">+++ b/libs/esl/fs_cli.c</span>
<span style="color: #800080; font-weight: bold">@@ -8,6 +8,7 @@</span>
#include <signal.h>
#define CMD_BUFLEN 1024
<span style="color: #00A000">+static int WARN_STOP = 0;</span>
#ifdef WIN32
#define strdup(src) _strdup(src)
<span style="color: #800080; font-weight: bold">@@ -535,6 +536,13 @@ static BOOL console_readConsole(HANDLE conIn, char* buf, int len, int* pRed, int</span>
static void handle_SIGINT(int sig)
{
        if (sig);
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        WARN_STOP = 1;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        signal(SIGINT, handle_SIGINT);</span>
<span style="color: #00A000">+#ifdef SIGTSTP</span>
<span style="color: #00A000">+        signal(SIGTSTP, handle_SIGINT);</span>
<span style="color: #00A000">+#endif</span>
        return;
}
<span style="color: #800080; font-weight: bold">@@ -581,6 +589,12 @@ static void *msg_thread_run(esl_thread_t *me, void *obj)</span>
        while(thread_running && handle->connected) {
                esl_status_t status = esl_recv_event_timed(handle, 10, 1, NULL);
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                if (WARN_STOP) {</span>
<span style="color: #00A000">+                        printf("Type control-D or /exit or /quit or /bye to exit.\n\n");</span>
<span style="color: #00A000">+                        WARN_STOP = 0;</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+</span>
                if (status == ESL_FAIL) {
                        esl_log(ESL_LOG_WARNING, "Disconnected.\n");
                        running = -1; thread_running = 0;
<span style="color: #800080; font-weight: bold">@@ -1023,6 +1037,9 @@ int main(int argc, char *argv[])</span>
        }
        
        signal(SIGINT, handle_SIGINT);
<span style="color: #00A000">+#ifdef SIGTSTP</span>
<span style="color: #00A000">+        signal(SIGTSTP, handle_SIGINT);</span>
<span style="color: #00A000">+#endif</span>
#ifdef SIGQUIT
        signal(SIGQUIT, handle_SIGQUIT);
#endif
</pre></div>
<div class="highlight"><pre>committer: Anthony Minessale
comments:
dont run execute_on_fsk when there was no data collected
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/applications/mod_fsk/mod_fsk.c b/src/mod/applications/mod_fsk/mod_fsk.c</span>
<span style="color: #000080; font-weight: bold">index 9802353..0291707 100644</span>
<span style="color: #A00000">--- a/src/mod/applications/mod_fsk/mod_fsk.c</span>
<span style="color: #00A000">+++ b/src/mod/applications/mod_fsk/mod_fsk.c</span>
<span style="color: #800080; font-weight: bold">@@ -220,6 +220,7 @@ static switch_bool_t fsk_detect_callback(switch_media_bug_t *bug, void *user_dat</span>
                                char *sp;
                                switch_event_t *event;
                                const char *app_var;
<span style="color: #00A000">+                                int total = 0;</span>
                                switch_event_create_plain(&event, SWITCH_EVENT_CHANNEL_DATA);
                                
<span style="color: #800080; font-weight: bold">@@ -255,6 +256,7 @@ static switch_bool_t fsk_detect_callback(switch_media_bug_t *bug, void *user_dat</span>
                                        }
                                        if (varname && val) {
<span style="color: #00A000">+                                                total++;</span>
                                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(pvt->session), SWITCH_LOG_DEBUG, "%s setting FSK var [%s][%s]\n",
                                                                                 switch_channel_get_name(channel), varname, val);
                                                switch_channel_set_variable(channel, varname, val);
<span style="color: #800080; font-weight: bold">@@ -270,7 +272,7 @@ static switch_bool_t fsk_detect_callback(switch_media_bug_t *bug, void *user_dat</span>
                                        }
                                }
                                
<span style="color: #A00000">-                                if ((app_var = switch_channel_get_variable(channel, "execute_on_fsk"))) {</span>
<span style="color: #00A000">+                                if (total && (app_var = switch_channel_get_variable(channel, "execute_on_fsk"))) {</span>
                                        char *app_arg;
                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(pvt->session), SWITCH_LOG_DEBUG, "%s processing execute_on_fsk [%s]\n",
</pre></div>
<div class="highlight"><pre>committer: Anthony Minessale
comments:
fix regression from d72cde9b76a856cf002366300bea02c26db44ffb
<span style="color: #000080; font-weight: bold">diff --git a/src/switch_core_session.c b/src/switch_core_session.c</span>
<span style="color: #000080; font-weight: bold">index 4836aae..d2e28de 100644</span>
<span style="color: #A00000">--- a/src/switch_core_session.c</span>
<span style="color: #00A000">+++ b/src/switch_core_session.c</span>
<span style="color: #800080; font-weight: bold">@@ -1865,6 +1865,17 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_get_app_flags(const char *ap</span>
SWITCH_DECLARE(switch_status_t) switch_core_session_execute_application_async(switch_core_session_t *session, const char *app, const char *arg)
{
        switch_event_t *execute_event;
<span style="color: #00A000">+        char *ap, *arp;</span>
<span style="color: #00A000">+        </span>
<span style="color: #00A000">+        if (!arg && strstr(app, "::")) {</span>
<span style="color: #00A000">+                ap = switch_core_session_strdup(session, app);</span>
<span style="color: #00A000">+                app = ap;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                if ((arp = strstr(ap, "::"))) {</span>
<span style="color: #00A000">+                        *arp = '\0';</span>
<span style="color: #00A000">+                        arg = arp + 2;</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+        }</span>
        
        if (switch_event_create(&execute_event, SWITCH_EVENT_COMMAND) == SWITCH_STATUS_SUCCESS) {
                switch_event_add_header_string(execute_event, SWITCH_STACK_BOTTOM, "call-command", "execute");
<span style="color: #800080; font-weight: bold">@@ -1894,6 +1905,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_execute_application_get_flag</span>
        switch_application_interface_t *application_interface;
        switch_status_t status = SWITCH_STATUS_SUCCESS;
<span style="color: #00A000">+        if (!arg && strstr(app, "::")) {</span>
<span style="color: #00A000">+                return switch_core_session_execute_application_async(session, app, arg);</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
        if (switch_channel_down(session->channel)) {
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Channel is hungup, aborting execution of application: %s\n", app);
                return SWITCH_STATUS_FALSE;
</pre></div>
<div class="highlight"><pre>committer: Anthony Minessale
comments:
FS-3006
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/endpoints/mod_portaudio/mod_portaudio.c b/src/mod/endpoints/mod_portaudio/mod_portaudio.c</span>
<span style="color: #000080; font-weight: bold">index 8978b85..baa33d4 100644</span>
<span style="color: #A00000">--- a/src/mod/endpoints/mod_portaudio/mod_portaudio.c</span>
<span style="color: #00A000">+++ b/src/mod/endpoints/mod_portaudio/mod_portaudio.c</span>
<span style="color: #800080; font-weight: bold">@@ -40,6 +40,8 @@</span>
#define MY_EVENT_RINGING "portaudio::ringing"
#define MY_EVENT_MAKE_CALL "portaudio::makecall"
<span style="color: #00A000">+#define MY_EVENT_CALL_HELD "portaudio::callheld"</span>
<span style="color: #00A000">+#define MY_EVENT_CALL_RESUMED "portaudio::callresumed"</span>
#define MY_EVENT_ERROR_AUDIO_DEV "portaudio::audio_dev_error"
#define SWITCH_PA_CALL_ID_VARIABLE "pa_call_id"
<span style="color: #800080; font-weight: bold">@@ -90,12 +92,20 @@ struct private_object {</span>
        switch_file_handle_t *hfh;
        switch_frame_t hold_frame;
        unsigned char holdbuf[SWITCH_RECOMMENDED_BUFFER_SIZE];
<span style="color: #A00000">-        switch_codec_t write_codec;</span>
        struct private_object *next;
};
typedef struct private_object private_t;
<span style="color: #00A000">+struct audio_stream {</span>
<span style="color: #00A000">+        int indev;</span>
<span style="color: #00A000">+        int outdev;</span>
<span style="color: #00A000">+        PABLIO_Stream *stream;</span>
<span style="color: #00A000">+        switch_timer_t write_timer;</span>
<span style="color: #00A000">+        struct audio_stream *next;</span>
<span style="color: #00A000">+};</span>
<span style="color: #00A000">+typedef struct audio_stream audio_stream_t;</span>
<span style="color: #00A000">+</span>
static struct {
        int debug;
        int port;
<span style="color: #800080; font-weight: bold">@@ -113,12 +123,13 @@ static struct {</span>
        switch_hash_t *call_hash;
        switch_mutex_t *device_lock;
        switch_mutex_t *pvt_lock;
<span style="color: #00A000">+        switch_mutex_t *streams_lock;</span>
        switch_mutex_t *flag_mutex;
        switch_mutex_t *pa_mutex;
        int sample_rate;
        int codec_ms;
<span style="color: #A00000">-        PABLIO_Stream *audio_stream;</span>
<span style="color: #A00000">-        PABLIO_Stream *ring_stream;</span>
<span style="color: #00A000">+        audio_stream_t *main_stream;</span>
<span style="color: #00A000">+        audio_stream_t *ring_stream;</span>
        switch_codec_t read_codec;
        switch_codec_t write_codec;
        switch_frame_t read_frame;
<span style="color: #800080; font-weight: bold">@@ -126,13 +137,20 @@ static struct {</span>
        unsigned char databuf[SWITCH_RECOMMENDED_BUFFER_SIZE];
        unsigned char cngbuf[SWITCH_RECOMMENDED_BUFFER_SIZE];
        private_t *call_list;
<span style="color: #00A000">+        audio_stream_t *stream_list;</span>
        int ring_interval;
        GFLAGS flags;
        switch_timer_t read_timer;
<span style="color: #A00000">-        switch_timer_t write_timer;</span>
<span style="color: #00A000">+        switch_timer_t readfile_timer;</span>
        switch_timer_t hold_timer;
        int dual_streams;
        time_t deactivate_timer;
<span style="color: #00A000">+        int live_stream_switch;</span>
<span style="color: #00A000">+        int no_auto_resume_call;</span>
<span style="color: #00A000">+        int no_ring_during_call;</span>
<span style="color: #00A000">+        int codecs_inited;</span>
<span style="color: #00A000">+        int stream_in_use; //only really used by playdev</span>
<span style="color: #00A000">+        int destroying_streams;</span>
} globals;
<span style="color: #800080; font-weight: bold">@@ -164,9 +182,22 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi</span>
static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id);
static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id);
static switch_status_t channel_kill_channel(switch_core_session_t *session, int sig);
<span style="color: #A00000">-static switch_status_t engage_device(int restart);</span>
<span style="color: #A00000">-static switch_status_t engage_ring_device(void);</span>
<span style="color: #A00000">-static void deactivate_ring_device(void);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+static switch_status_t create_codecs(int restart);</span>
<span style="color: #00A000">+static void create_hold_event(private_t *tech_pvt, int unhold);</span>
<span style="color: #00A000">+static audio_stream_t * find_audio_stream(int indev, int outdev, int already_locked);</span>
<span style="color: #00A000">+static audio_stream_t * get_audio_stream(int indev, int outdev);</span>
<span style="color: #00A000">+static audio_stream_t * create_audio_stream(int indev, int outdev);</span>
<span style="color: #00A000">+PaError open_audio_stream(PABLIO_Stream **stream, const PaStreamParameters * inputParameters, const PaStreamParameters * outputParameters);</span>
<span style="color: #00A000">+static switch_status_t switch_audio_stream();</span>
<span style="color: #00A000">+static void add_stream(audio_stream_t *stream, int already_locked);</span>
<span style="color: #00A000">+static void remove_stream(audio_stream_t *stream, int already_locked);</span>
<span style="color: #00A000">+static switch_status_t destroy_audio_stream(int indev, int outdev);</span>
<span style="color: #00A000">+static switch_status_t destroy_actual_stream(audio_stream_t *stream);</span>
<span style="color: #00A000">+static void destroy_audio_streams();</span>
<span style="color: #00A000">+static switch_status_t validate_main_audio_stream();</span>
<span style="color: #00A000">+static switch_status_t validate_ring_audio_stream();</span>
<span style="color: #00A000">+</span>
static int dump_info(int verbose);
static switch_status_t load_config(void);
static int get_dev_by_name(char *name, int in);
<span style="color: #800080; font-weight: bold">@@ -212,9 +243,8 @@ static switch_status_t channel_on_routing(switch_core_session_t *session)</span>
        if (hold_file) {
                tech_pvt->hold_file = switch_core_session_strdup(session, hold_file);
        }
<span style="color: #A00000">-        </span>
<span style="color: #A00000">-        if (switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) {</span>
<span style="color: #A00000">-                if (engage_device(0) != SWITCH_STATUS_SUCCESS) {</span>
<span style="color: #00A000">+                if (switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) {</span>
<span style="color: #00A000">+                if (validate_main_audio_stream() != SWITCH_STATUS_SUCCESS) {</span>
                        switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
                        return SWITCH_STATUS_FALSE;
                }
<span style="color: #800080; font-weight: bold">@@ -238,7 +268,7 @@ static switch_status_t channel_on_routing(switch_core_session_t *session)</span>
                                                                                 globals.read_codec.implementation->actual_samples_per_second,
                                                                                 SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) == SWITCH_STATUS_SUCCESS) {
<span style="color: #A00000">-                                        if (engage_ring_device() != SWITCH_STATUS_SUCCESS) {</span>
<span style="color: #00A000">+                                        if (validate_ring_audio_stream() != SWITCH_STATUS_SUCCESS) {</span>
                                                switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
                                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Ring Error!\n");
                                                switch_core_file_close(&fh);
<span style="color: #800080; font-weight: bold">@@ -263,7 +293,7 @@ static switch_status_t channel_on_routing(switch_core_session_t *session)</span>
                }
                while (switch_channel_get_state(channel) == CS_ROUTING && !switch_test_flag(tech_pvt, TFLAG_ANSWER)) {
<span style="color: #A00000">-                        switch_size_t olen = globals.read_timer.samples;</span>
<span style="color: #00A000">+                        switch_size_t olen = globals.readfile_timer.samples;</span>
                        if (switch_micro_time_now() - last >= waitsec) {
                                char buf[512];
<span style="color: #800080; font-weight: bold">@@ -273,7 +303,8 @@ static switch_status_t channel_on_routing(switch_core_session_t *session)</span>
                                if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, MY_EVENT_RINGING) == SWITCH_STATUS_SUCCESS) {
                                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "event_info", buf);
<span style="color: #A00000">-                                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "call_id", tech_pvt->call_id);</span>
<span style="color: #00A000">+                                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "call_id", tech_pvt->call_id); /* left behind for backwards compatability */</span>
<span style="color: #00A000">+                                        switch_channel_set_variable(channel, SWITCH_PA_CALL_ID_VARIABLE, tech_pvt->call_id);</span>
                                        switch_channel_event_set_data(channel, event);
                                        switch_event_fire(&event);
                                }
<span style="color: #800080; font-weight: bold">@@ -282,7 +313,7 @@ static switch_status_t channel_on_routing(switch_core_session_t *session)</span>
                        }
                        if (ring_file) {
<span style="color: #A00000">-                                if (switch_core_timer_next(&globals.read_timer) != SWITCH_STATUS_SUCCESS) {</span>
<span style="color: #00A000">+                                if (switch_core_timer_next(&globals.readfile_timer) != SWITCH_STATUS_SUCCESS) {</span>
                                        switch_core_file_close(&fh);
                                        break;
                                }
<span style="color: #800080; font-weight: bold">@@ -292,8 +323,9 @@ static switch_status_t channel_on_routing(switch_core_session_t *session)</span>
                                        switch_core_file_seek(&fh, &pos, 0, SEEK_SET);
                                }
<span style="color: #A00000">-                                if (globals.ring_stream) {</span>
<span style="color: #A00000">-                                        WriteAudioStream(globals.ring_stream, abuf, (long) olen, &globals.write_timer);</span>
<span style="color: #00A000">+                                if (globals.ring_stream && (! switch_test_flag(globals.call_list, TFLAG_MASTER) || </span>
<span style="color: #00A000">+                                                        ( !globals.no_ring_during_call && globals.main_stream != globals.ring_stream)) ) { //if there is a ring stream and not an active call or if there is an active call and we are allowed to ring during it AND the ring stream is not the main stream                                                </span>
<span style="color: #00A000">+                                                WriteAudioStream(globals.ring_stream->stream, abuf, (long) olen, &globals.ring_stream->write_timer);</span>
                                }
                        } else {
                                switch_yield(10000);
<span style="color: #800080; font-weight: bold">@@ -303,7 +335,6 @@ static switch_status_t channel_on_routing(switch_core_session_t *session)</span>
        }
        if (ring_file) {
<span style="color: #A00000">-                deactivate_ring_device();</span>
                switch_core_file_close(&fh);
        }
<span style="color: #800080; font-weight: bold">@@ -329,27 +360,130 @@ static switch_status_t channel_on_execute(switch_core_session_t *session)</span>
        return SWITCH_STATUS_SUCCESS;
}
<span style="color: #A00000">-static void deactivate_audio_device(void)</span>
<span style="color: #00A000">+static audio_stream_t* find_audio_stream(int indev, int outdev, int already_locked)</span>
{
<span style="color: #A00000">-        if (!globals.audio_stream) {</span>
<span style="color: #A00000">-                return;</span>
<span style="color: #00A000">+        audio_stream_t *cur_stream;</span>
<span style="color: #00A000">+        </span>
<span style="color: #00A000">+        if (! globals.stream_list) {</span>
<span style="color: #00A000">+                return NULL;</span>
        }
<span style="color: #A00000">-        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Stop audio device.\n");</span>
<span style="color: #00A000">+        if (! already_locked) {</span>
<span style="color: #00A000">+                switch_mutex_lock(globals.streams_lock);</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        cur_stream = globals.stream_list;</span>
<span style="color: #A00000">-        switch_mutex_lock(globals.device_lock);</span>
<span style="color: #A00000">-        /* LOCKED ************************************************************************************************** */</span>
<span style="color: #00A000">+        while (cur_stream != NULL) {</span>
<span style="color: #00A000">+                if (cur_stream->outdev == outdev) {</span>
<span style="color: #00A000">+                        if (indev == -1 || cur_stream->indev == indev) {</span>
<span style="color: #00A000">+                                if (! already_locked) {</span>
<span style="color: #00A000">+                                        switch_mutex_unlock(globals.streams_lock);</span>
<span style="color: #00A000">+                                }</span>
<span style="color: #00A000">+                                return cur_stream;</span>
<span style="color: #00A000">+                        }</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+                cur_stream = cur_stream->next;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        if (! already_locked) {</span>
<span style="color: #00A000">+                switch_mutex_unlock(globals.streams_lock);</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        return NULL;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+static void destroy_audio_streams()</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        int close_wait = 4;</span>
<span style="color: #00A000">+        globals.destroying_streams = 1;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        while (globals.stream_in_use && close_wait--) {</span>
<span style="color: #00A000">+                switch_yield(250000);</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        while (globals.stream_list != NULL) {</span>
<span style="color: #00A000">+                destroy_audio_stream(globals.stream_list->indev, globals.stream_list->outdev);</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        globals.destroying_streams = 0;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+static switch_status_t validate_main_audio_stream()</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        if (globals.read_timer.timer_interface) {</span>
<span style="color: #00A000">+                switch_core_timer_sync(&globals.read_timer);</span>
<span style="color: #00A000">+        }</span>
<span style="color: #A00000">-        if (globals.audio_stream) {</span>
<span style="color: #A00000">-                if (globals.ring_stream == globals.audio_stream) {</span>
<span style="color: #A00000">-                        globals.ring_stream = NULL;</span>
<span style="color: #00A000">+        if (globals.main_stream) {</span>
<span style="color: #00A000">+                if (globals.main_stream->write_timer.timer_interface) {</span>
<span style="color: #00A000">+                        switch_core_timer_sync(&(globals.main_stream->write_timer));</span>
                }
<span style="color: #A00000">-                CloseAudioStream(globals.audio_stream);</span>
<span style="color: #A00000">-                globals.audio_stream = NULL;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                return SWITCH_STATUS_SUCCESS;</span>
        }
<span style="color: #A00000">-        /* UNLOCKED ************************************************************************************************* */</span>
<span style="color: #A00000">-        switch_mutex_unlock(globals.device_lock);</span>
<span style="color: #00A000">+        globals.main_stream = get_audio_stream(globals.indev, globals.outdev);</span>
<span style="color: #00A000">+        </span>
<span style="color: #00A000">+        if (globals.main_stream) {</span>
<span style="color: #00A000">+                return SWITCH_STATUS_SUCCESS;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return SWITCH_STATUS_FALSE;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+static switch_status_t validate_ring_audio_stream()</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        if (globals.ringdev == -1) {</span>
<span style="color: #00A000">+                return SWITCH_STATUS_SUCCESS;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        if (globals.ring_stream) {</span>
<span style="color: #00A000">+                if (globals.ring_stream->write_timer.timer_interface) {</span>
<span style="color: #00A000">+                        switch_core_timer_sync(&(globals.ring_stream->write_timer));</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+                return SWITCH_STATUS_SUCCESS;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        globals.ring_stream = get_audio_stream(-1, globals.ringdev);</span>
<span style="color: #00A000">+        if (globals.ring_stream) {</span>
<span style="color: #00A000">+                return SWITCH_STATUS_SUCCESS;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return SWITCH_STATUS_FALSE;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+static switch_status_t destroy_actual_stream(audio_stream_t *stream)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        if (stream == NULL) {</span>
<span style="color: #00A000">+                return SWITCH_STATUS_FALSE;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if (globals.main_stream == stream) {</span>
<span style="color: #00A000">+                globals.main_stream = NULL;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if (globals.ring_stream == stream) {</span>
<span style="color: #00A000">+                globals.ring_stream = NULL;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        CloseAudioStream(stream->stream);</span>
<span style="color: #00A000">+        stream->stream = NULL;</span>
<span style="color: #00A000">+        </span>
<span style="color: #00A000">+        if (stream->write_timer.timer_interface) {</span>
<span style="color: #00A000">+                switch_core_timer_destroy(&stream->write_timer);</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        switch_safe_free(stream);</span>
<span style="color: #00A000">+        return SWITCH_STATUS_SUCCESS;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+static switch_status_t destroy_audio_stream(int indev, int outdev)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        audio_stream_t *stream;</span>
<span style="color: #00A000">+        </span>
<span style="color: #00A000">+        switch_mutex_lock(globals.streams_lock);</span>
<span style="color: #00A000">+        stream = find_audio_stream(indev, outdev,1);</span>
<span style="color: #00A000">+        if (stream == NULL) {</span>
<span style="color: #00A000">+                switch_mutex_unlock(globals.streams_lock);</span>
<span style="color: #00A000">+                return SWITCH_STATUS_FALSE;                </span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        remove_stream(stream, 1);</span>
<span style="color: #00A000">+        switch_mutex_unlock(globals.streams_lock);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        destroy_actual_stream(stream);</span>
<span style="color: #00A000">+        return SWITCH_STATUS_SUCCESS;</span>
}
<span style="color: #800080; font-weight: bold">@@ -368,34 +502,69 @@ static void destroy_codecs(void)</span>
                switch_core_timer_destroy(&globals.read_timer);
        }
<span style="color: #A00000">-        if (globals.write_timer.timer_interface) {</span>
<span style="color: #A00000">-                switch_core_timer_destroy(&globals.write_timer);</span>
<span style="color: #00A000">+        if (globals.readfile_timer.timer_interface) {</span>
<span style="color: #00A000">+                switch_core_timer_destroy(&globals.readfile_timer);</span>
        }
        if (globals.hold_timer.timer_interface) {
                switch_core_timer_destroy(&globals.hold_timer);
        }
<span style="color: #A00000">-</span>
<span style="color: #A00000">-</span>
<span style="color: #00A000">+        globals.codecs_inited = 0;</span>
}
<span style="color: #A00000">-static void deactivate_ring_device(void)</span>
<span style="color: #00A000">+static void create_hold_event(private_t *tech_pvt, int unhold)</span>
{
<span style="color: #A00000">-        if (!globals.ring_stream) {</span>
<span style="color: #A00000">-                return;</span>
<span style="color: #00A000">+        switch_event_t *event;</span>
<span style="color: #00A000">+        char * event_id;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if (unhold) {</span>
<span style="color: #00A000">+                event_id = MY_EVENT_CALL_RESUMED;</span>
<span style="color: #00A000">+        } else {</span>
<span style="color: #00A000">+                event_id = MY_EVENT_CALL_HELD;</span>
        }
<span style="color: #A00000">-        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Stop ring device.\n");</span>
<span style="color: #A00000">-        switch_mutex_lock(globals.device_lock);</span>
<span style="color: #A00000">-        if (globals.ring_stream && globals.ring_stream != globals.audio_stream) {</span>
<span style="color: #A00000">-                CloseAudioStream(globals.ring_stream);</span>
<span style="color: #00A000">+        if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, event_id) == SWITCH_STATUS_SUCCESS) {</span>
<span style="color: #00A000">+                switch_channel_event_set_data(switch_core_session_get_channel(tech_pvt->session), event);</span>
<span style="color: #00A000">+                switch_event_fire(&event);</span>
        }
<span style="color: #A00000">-        globals.ring_stream = NULL;</span>
<span style="color: #A00000">-        switch_mutex_unlock(globals.device_lock);</span>
}
<span style="color: #00A000">+static void add_stream(audio_stream_t * stream, int already_locked)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        audio_stream_t *last;</span>
<span style="color: #00A000">+        if (! already_locked) {</span>
<span style="color: #00A000">+                switch_mutex_lock(globals.streams_lock);</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        for (last = globals.stream_list; last && last->next; last = last->next);</span>
<span style="color: #00A000">+        if (last == NULL) {</span>
<span style="color: #00A000">+                globals.stream_list = stream;</span>
<span style="color: #00A000">+        } else {</span>
<span style="color: #00A000">+                last->next = stream;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        if (! already_locked) {</span>
<span style="color: #00A000">+                switch_mutex_unlock(globals.streams_lock);</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+static void remove_stream(audio_stream_t * stream, int already_locked)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        audio_stream_t *previous;</span>
<span style="color: #00A000">+        if (! already_locked) {</span>
<span style="color: #00A000">+                switch_mutex_lock(globals.streams_lock);</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        if (globals.stream_list == stream) {</span>
<span style="color: #00A000">+                globals.stream_list = stream->next;</span>
<span style="color: #00A000">+        } else {</span>
<span style="color: #00A000">+                for (previous = globals.stream_list; previous && previous->next && previous->next != stream; previous = previous->next) {</span>
<span style="color: #00A000">+                        </span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+                previous->next = stream->next;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        if (! already_locked) {</span>
<span style="color: #00A000">+                switch_mutex_unlock(globals.streams_lock);</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+}</span>
static void add_pvt(private_t *tech_pvt, int master)
{
<span style="color: #800080; font-weight: bold">@@ -418,8 +587,9 @@ static void add_pvt(private_t *tech_pvt, int master)</span>
                if (tp == tech_pvt) {
                        in_list = 1;
                }
<span style="color: #A00000">-                if (master) {</span>
<span style="color: #00A000">+                if (master && switch_test_flag(tp, TFLAG_MASTER) ) {</span>
                        switch_clear_flag_locked(tp, TFLAG_MASTER);
<span style="color: #00A000">+                        create_hold_event(tp,0);</span>
                }
        }
<span style="color: #800080; font-weight: bold">@@ -446,11 +616,16 @@ static void add_pvt(private_t *tech_pvt, int master)</span>
static void remove_pvt(private_t *tech_pvt)
{
        private_t *tp, *last = NULL;
<span style="color: #00A000">+        int was_master = 0;</span>
        switch_mutex_lock(globals.pvt_lock);
        for (tp = globals.call_list; tp; tp = tp->next) {
<span style="color: #A00000">-                switch_clear_flag_locked(tp, TFLAG_MASTER);</span>
<span style="color: #00A000">+                </span>
                if (tp == tech_pvt) {
<span style="color: #00A000">+                        if (switch_test_flag(tp, TFLAG_MASTER)) {</span>
<span style="color: #00A000">+                                switch_clear_flag_locked(tp, TFLAG_MASTER);</span>
<span style="color: #00A000">+                                was_master = 1;</span>
<span style="color: #00A000">+                        }</span>
                        if (last) {
                                last->next = tp->next;
                        } else {
<span style="color: #800080; font-weight: bold">@@ -461,10 +636,13 @@ static void remove_pvt(private_t *tech_pvt)</span>
        }
        if (globals.call_list) {
<span style="color: #A00000">-                switch_set_flag_locked(globals.call_list, TFLAG_MASTER);</span>
<span style="color: #00A000">+                if (was_master && ! globals.no_auto_resume_call) {</span>
<span style="color: #00A000">+                        switch_set_flag_locked(globals.call_list, TFLAG_MASTER);</span>
<span style="color: #00A000">+                        create_hold_event(globals.call_list, 1);</span>
<span style="color: #00A000">+                }</span>
        } else {
                globals.deactivate_timer = switch_epoch_time_now(NULL) + 2;
<span style="color: #A00000">-                deactivate_audio_device();</span>
<span style="color: #00A000">+                destroy_audio_streams();</span>
        }
        switch_mutex_unlock(globals.pvt_lock);
<span style="color: #800080; font-weight: bold">@@ -555,8 +733,8 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch</span>
        int samples = 0;
        switch_status_t status = SWITCH_STATUS_FALSE;
        switch_assert(tech_pvt != NULL);
<span style="color: #A00000">-</span>
<span style="color: #A00000">-        if (!globals.audio_stream) {</span>
<span style="color: #00A000">+        </span>
<span style="color: #00A000">+        if (!globals.main_stream) {</span>
                goto normal_return;
        }
<span style="color: #800080; font-weight: bold">@@ -618,7 +796,7 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch</span>
        }
        switch_mutex_lock(globals.device_lock);
<span style="color: #A00000">-        samples = ReadAudioStream(globals.audio_stream, globals.read_frame.data, globals.read_codec.implementation->samples_per_packet, &globals.read_timer);</span>
<span style="color: #00A000">+        samples = ReadAudioStream(globals.main_stream->stream, globals.read_frame.data, globals.read_codec.implementation->samples_per_packet, &globals.read_timer);</span>
        switch_mutex_unlock(globals.device_lock);
        if (samples) {
<span style="color: #800080; font-weight: bold">@@ -635,7 +813,7 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch</span>
                goto cng_nowait;
        }
<span style="color: #A00000">- normal_return:</span>
<span style="color: #00A000">+normal_return:</span>
        return status;
cng_nowait:
<span style="color: #800080; font-weight: bold">@@ -655,7 +833,7 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc</span>
        private_t *tech_pvt = switch_core_session_get_private(session);
        switch_assert(tech_pvt != NULL);
<span style="color: #A00000">-        if (!globals.audio_stream) {</span>
<span style="color: #00A000">+        if (!globals.main_stream) {</span>
                return SWITCH_STATUS_FALSE;
        }
<span style="color: #800080; font-weight: bold">@@ -667,9 +845,9 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc</span>
                return SWITCH_STATUS_SUCCESS;
        }
<span style="color: #A00000">-        if (globals.audio_stream) {</span>
<span style="color: #00A000">+        if (globals.main_stream) {</span>
                if (switch_test_flag((&globals), GFLAG_EAR)) {
<span style="color: #A00000">-                        WriteAudioStream(globals.audio_stream, (short *) frame->data, (int) (frame->datalen / sizeof(SAMPLE)), &globals.write_timer);</span>
<span style="color: #00A000">+                        WriteAudioStream(globals.main_stream->stream, (short *) frame->data, (int) (frame->datalen / sizeof(SAMPLE)), &(globals.main_stream->write_timer));</span>
                }
                status = SWITCH_STATUS_SUCCESS;
        }
<span style="color: #800080; font-weight: bold">@@ -747,7 +925,6 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi</span>
                        channel = switch_core_session_get_channel(*new_session);
                        switch_core_session_set_private(*new_session, tech_pvt);
                        tech_pvt->session = *new_session;
<span style="color: #A00000">-                        globals.flags = GFLAG_EAR | GFLAG_MOUTH;</span>
                } else {
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(*new_session), SWITCH_LOG_CRIT, "Hey where is my memory pool?\n");
                        switch_core_session_destroy(new_session);
<span style="color: #800080; font-weight: bold">@@ -796,16 +973,17 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_portaudio_load)</span>
        switch_core_hash_init(&globals.call_hash, module_pool);
        switch_mutex_init(&globals.device_lock, SWITCH_MUTEX_NESTED, module_pool);
        switch_mutex_init(&globals.pvt_lock, SWITCH_MUTEX_NESTED, module_pool);
<span style="color: #00A000">+        switch_mutex_init(&globals.streams_lock, SWITCH_MUTEX_NESTED, module_pool);</span>
        switch_mutex_init(&globals.flag_mutex, SWITCH_MUTEX_NESTED, module_pool);
        switch_mutex_init(&globals.pa_mutex, SWITCH_MUTEX_NESTED, module_pool);
<span style="color: #A00000">-</span>
<span style="color: #00A000">+        globals.codecs_inited=0;</span>
        globals.read_frame.data = globals.databuf;
        globals.read_frame.buflen = sizeof(globals.databuf);
        globals.cng_frame.data = globals.cngbuf;
        globals.cng_frame.buflen = sizeof(globals.cngbuf);
        globals.cng_frame.datalen = switch_samples_per_packet(globals.sample_rate, globals.codec_ms) * 2;
        switch_set_flag((&globals.cng_frame), SFF_CNG);
<span style="color: #A00000">-</span>
<span style="color: #00A000">+        globals.flags = GFLAG_EAR | GFLAG_MOUTH;</span>
        /* dual streams makes portaudio on solaris choke */
#if defined(sun) || defined(__sun)
        globals.dual_streams = 0;
<span style="color: #800080; font-weight: bold">@@ -834,6 +1012,14 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_portaudio_load)</span>
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass!\n");
                return SWITCH_STATUS_GENERR;
        }
<span style="color: #00A000">+        if (switch_event_reserve_subclass(MY_EVENT_CALL_HELD) != SWITCH_STATUS_SUCCESS) {</span>
<span style="color: #00A000">+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass!\n");</span>
<span style="color: #00A000">+                return SWITCH_STATUS_GENERR;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        if (switch_event_reserve_subclass(MY_EVENT_CALL_RESUMED) != SWITCH_STATUS_SUCCESS) {</span>
<span style="color: #00A000">+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass!\n");</span>
<span style="color: #00A000">+                return SWITCH_STATUS_GENERR;</span>
<span style="color: #00A000">+        }</span>
        if (switch_event_reserve_subclass(MY_EVENT_ERROR_AUDIO_DEV) != SWITCH_STATUS_SUCCESS) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass!\n");
<span style="color: #800080; font-weight: bold">@@ -861,9 +1047,13 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_portaudio_load)</span>
        switch_console_set_complete("add pa devlist");
        switch_console_set_complete("add pa indev");
        switch_console_set_complete("add pa outdev");
<span style="color: #00A000">+        switch_console_set_complete("add pa preparestream");</span>
<span style="color: #00A000">+        switch_console_set_complete("add pa switchstream");</span>
<span style="color: #00A000">+        switch_console_set_complete("add pa closestreams");</span>
        switch_console_set_complete("add pa ringdev");
        switch_console_set_complete("add pa ringfile");
        switch_console_set_complete("add pa play");
<span style="color: #00A000">+        switch_console_set_complete("add pa playdev");</span>
        switch_console_set_complete("add pa looptest");
        /* indicate that the module should continue to be loaded */
<span style="color: #800080; font-weight: bold">@@ -881,9 +1071,12 @@ static switch_status_t load_config(void)</span>
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Open of %s failed\n", cf);
                return SWITCH_STATUS_TERM;
        }
<span style="color: #A00000">-</span>
<span style="color: #00A000">+        destroy_audio_streams();</span>
<span style="color: #00A000">+        destroy_codecs();</span>
        globals.dual_streams = 0;
<span style="color: #A00000">-</span>
<span style="color: #00A000">+        globals.live_stream_switch = 0;</span>
<span style="color: #00A000">+        globals.no_auto_resume_call = 0;</span>
<span style="color: #00A000">+        globals.no_ring_during_call = 0;</span>
        globals.indev = globals.outdev = globals.ringdev = -1;
        globals.sample_rate = 8000;
<span style="color: #800080; font-weight: bold">@@ -896,6 +1089,24 @@ static switch_status_t load_config(void)</span>
                                globals.debug = atoi(val);
                        } else if (!strcmp(var, "ring-interval")) {
                                globals.ring_interval = atoi(val);
<span style="color: #00A000">+                        } else if (!strcmp(var, "no-auto-resume-call")) {</span>
<span style="color: #00A000">+                                if (switch_true(val)) {</span>
<span style="color: #00A000">+                                        globals.no_auto_resume_call = 1;</span>
<span style="color: #00A000">+                                } else {</span>
<span style="color: #00A000">+                                        globals.no_auto_resume_call = 0;</span>
<span style="color: #00A000">+                                }</span>
<span style="color: #00A000">+                        } else if (!strcmp(var, "no-ring-during-call")) {</span>
<span style="color: #00A000">+                                if (switch_true(val)) {</span>
<span style="color: #00A000">+                                        globals.no_ring_during_call = 1;</span>
<span style="color: #00A000">+                                } else {</span>
<span style="color: #00A000">+                                        globals.no_ring_during_call = 0;</span>
<span style="color: #00A000">+                                }</span>
<span style="color: #00A000">+                        } else if (!strcmp(var, "live-stream-switch")) {</span>
<span style="color: #00A000">+                                if (switch_true(val)) {</span>
<span style="color: #00A000">+                                        globals.live_stream_switch = 1;</span>
<span style="color: #00A000">+                                } else {</span>
<span style="color: #00A000">+                                        globals.live_stream_switch = 0;</span>
<span style="color: #00A000">+                                }</span>
                        } else if (!strcmp(var, "ring-file")) {
                                set_global_ring_file(val);
                        } else if (!strcmp(var, "hold-file")) {
<span style="color: #800080; font-weight: bold">@@ -1007,8 +1218,7 @@ static switch_status_t load_config(void)</span>
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_portaudio_shutdown)
{
<span style="color: #A00000">-        deactivate_audio_device();</span>
<span style="color: #A00000">-        deactivate_ring_device();</span>
<span style="color: #00A000">+        destroy_audio_streams();</span>
        destroy_codecs();
        Pa_Terminate();
<span style="color: #800080; font-weight: bold">@@ -1017,6 +1227,9 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_portaudio_shutdown)</span>
        switch_event_free_subclass(MY_EVENT_RINGING);
        switch_event_free_subclass(MY_EVENT_MAKE_CALL);
        switch_event_free_subclass(MY_EVENT_ERROR_AUDIO_DEV);
<span style="color: #00A000">+        switch_event_free_subclass(MY_EVENT_CALL_HELD);</span>
<span style="color: #00A000">+        switch_event_free_subclass(MY_EVENT_CALL_RESUMED);</span>
<span style="color: #00A000">+        </span>
        switch_safe_free(globals.dialplan);
        switch_safe_free(globals.context);
<span style="color: #800080; font-weight: bold">@@ -1118,7 +1331,99 @@ static void PrintSupportedStandardSampleRates(const PaStreamParameters * inputPa</span>
}
/*******************************************************************/
<span style="color: #00A000">+static switch_status_t play_dev(switch_stream_handle_t *stream, int outdev, char * file, const char * max_seconds, const char * no_close)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        switch_file_handle_t fh = { 0 };</span>
<span style="color: #00A000">+        int samples = 0;</span>
<span style="color: #00A000">+        int seconds = 5;</span>
<span style="color: #00A000">+        audio_stream_t * audio_stream;</span>
<span style="color: #00A000">+        int created_stream = 0;</span>
<span style="color: #00A000">+        int wrote = 0;</span>
<span style="color: #00A000">+        switch_size_t olen;</span>
<span style="color: #00A000">+        int16_t abuf[2048];</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if (!strcasecmp(file, "ringtest")) {</span>
<span style="color: #00A000">+                file = globals.ring_file;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        if (outdev == -1) {</span>
<span style="color: #00A000">+                stream->write_function(stream, "Invalid output audio device\n");</span>
<span style="color: #00A000">+                return SWITCH_STATUS_FALSE;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        audio_stream = get_audio_stream(-1, outdev);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        fh.pre_buffer_datalen = SWITCH_DEFAULT_FILE_BUFFER_LEN;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if (switch_core_file_open(&fh,        file,</span>
<span style="color: #00A000">+                globals.read_codec.implementation->number_of_channels,</span>
<span style="color: #00A000">+                globals.read_codec.implementation->actual_samples_per_second,</span>
<span style="color: #00A000">+                SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {</span>
<span style="color: #00A000">+                        stream->write_function(stream, "Cannot play requested file %s\n", file);</span>
<span style="color: #00A000">+                        return SWITCH_STATUS_FALSE;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        olen = globals.read_codec.implementation->samples_per_packet;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if (max_seconds) {</span>
<span style="color: #00A000">+                int i = atoi(max_seconds);</span>
<span style="color: #00A000">+                if (i >= 0) {</span>
<span style="color: #00A000">+                        seconds = i;</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if (globals.call_list) {</span>
<span style="color: #00A000">+                switch_mutex_lock(globals.pvt_lock);</span>
<span style="color: #00A000">+                if (!globals.main_stream) {</span>
<span style="color: #00A000">+                        switch_mutex_unlock(globals.pvt_lock);</span>
<span style="color: #00A000">+                        return SWITCH_STATUS_FALSE;</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                if ( switch_test_flag(globals.call_list, TFLAG_MASTER) && globals.main_stream->outdev == outdev) { /*so we are the active stream so we need to dupe it basically */</span>
<span style="color: #00A000">+                        audio_stream = create_audio_stream(-1,outdev);</span>
<span style="color: #00A000">+                        created_stream=1;</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+                switch_mutex_unlock(globals.pvt_lock);</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if (! audio_stream) {</span>
<span style="color: #00A000">+                stream->write_function(stream, "Failed to engage audio device\n");</span>
<span style="color: #00A000">+                return SWITCH_STATUS_FALSE;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        samples = globals.read_codec.implementation->actual_samples_per_second * seconds;</span>
<span style="color: #00A000">+        globals.stream_in_use=1;</span>
<span style="color: #00A000">+        while (switch_core_file_read(&fh, abuf, &olen) == SWITCH_STATUS_SUCCESS) {</span>
<span style="color: #00A000">+                if (globals.destroying_streams || ! audio_stream->stream) {</span>
<span style="color: #00A000">+                        break;</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+                </span>
<span style="color: #00A000">+                WriteAudioStream(audio_stream->stream, abuf, (long) olen, &(audio_stream->write_timer));</span>
<span style="color: #00A000">+                wrote += (int) olen;</span>
<span style="color: #00A000">+                if (samples) {</span>
<span style="color: #00A000">+                        samples -= (int) olen;</span>
<span style="color: #00A000">+                        if (samples <= 0) {</span>
<span style="color: #00A000">+                                break;</span>
<span style="color: #00A000">+                        }</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+                olen = globals.read_codec.implementation->samples_per_packet;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        globals.stream_in_use = 0;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        switch_core_file_close(&fh);</span>
<span style="color: #00A000">+        if (! globals.call_list && ( ! no_close || strcasecmp(no_close, "no_close"))) {</span>
<span style="color: #00A000">+                destroy_audio_streams();</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        seconds = wrote / globals.read_codec.implementation->actual_samples_per_second;</span>
<span style="color: #00A000">+        stream->write_function(stream, "playback test [%s] %d second(s) %d samples @%dkhz",</span>
<span style="color: #00A000">+                file, seconds, wrote, globals.read_codec.implementation->actual_samples_per_second);</span>
<span style="color: #00A000">+        if (created_stream) { /*still need this as not added to the global pool */</span>
<span style="color: #00A000">+                destroy_actual_stream(audio_stream);</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        return SWITCH_STATUS_SUCCESS;</span>
<span style="color: #00A000">+}</span>
static switch_status_t devlist(char **argv, int argc, switch_stream_handle_t *stream)
{
        int i, numDevices, prev;
<span style="color: #800080; font-weight: bold">@@ -1200,8 +1505,7 @@ static int dump_info(int verbose)</span>
        }
        if (verbose < 0) {
<span style="color: #A00000">-                deactivate_audio_device();</span>
<span style="color: #A00000">-                deactivate_ring_device();</span>
<span style="color: #00A000">+                destroy_audio_streams();</span>
                destroy_codecs();
                Pa_Terminate();
                Pa_Initialize();
<span style="color: #800080; font-weight: bold">@@ -1309,36 +1613,15 @@ static int dump_info(int verbose)</span>
        return err;
}
<span style="color: #A00000">-static switch_status_t engage_device(int restart)</span>
<span style="color: #00A000">+static switch_status_t create_codecs(int restart)</span>
{
<span style="color: #A00000">-        PaStreamParameters inputParameters, outputParameters;</span>
<span style="color: #A00000">-        PaError err;</span>
        int sample_rate = globals.sample_rate;
        int codec_ms = globals.codec_ms;
<span style="color: #A00000">-        switch_event_t *event;</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-        switch_mutex_lock(globals.device_lock);</span>
<span style="color: #A00000">-        while (globals.deactivate_timer > switch_epoch_time_now(NULL)) {</span>
<span style="color: #A00000">-                switch_yield(1000000);</span>
<span style="color: #A00000">-        }</span>
<span style="color: #A00000">-        switch_mutex_unlock(globals.device_lock);</span>
<span style="color: #A00000">-</span>
        if (restart) {
<span style="color: #A00000">-                deactivate_audio_device();</span>
<span style="color: #A00000">-                deactivate_ring_device();</span>
                destroy_codecs();
        }
<span style="color: #A00000">-</span>
<span style="color: #A00000">-        if (globals.read_timer.timer_interface) {</span>
<span style="color: #A00000">-                switch_core_timer_sync(&globals.read_timer);</span>
<span style="color: #A00000">-        }</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-        if (globals.write_timer.timer_interface) {</span>
<span style="color: #A00000">-                switch_core_timer_sync(&globals.write_timer);</span>
<span style="color: #A00000">-        }</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-        if (globals.audio_stream) {</span>
<span style="color: #00A000">+        if (globals.codecs_inited) {</span>
                return SWITCH_STATUS_SUCCESS;
        }
<span style="color: #800080; font-weight: bold">@@ -1375,20 +1658,18 @@ static switch_status_t engage_device(int restart)</span>
                        return SWITCH_STATUS_FALSE;
                }
        }
<span style="color: #A00000">-</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-        if (!globals.write_timer.timer_interface) {</span>
<span style="color: #A00000">-                if (switch_core_timer_init(&globals.write_timer,</span>
<span style="color: #00A000">+        if (!globals.readfile_timer.timer_interface) {</span>
<span style="color: #00A000">+                if (switch_core_timer_init(&globals.readfile_timer,</span>
                                                                 globals.timer_name, codec_ms, globals.read_codec.implementation->samples_per_packet,
                                                                 module_pool) != SWITCH_STATUS_SUCCESS) {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "setup timer failed!\n");
                        switch_core_codec_destroy(&globals.read_codec);
                        switch_core_codec_destroy(&globals.write_codec);
<span style="color: #A00000">-                        switch_core_timer_destroy(&globals.read_timer);</span>
                        return SWITCH_STATUS_FALSE;
                }
        }
<span style="color: #00A000">+</span>
        if (!globals.hold_timer.timer_interface) {
                if (switch_core_timer_init(&globals.hold_timer,
                                                                 globals.timer_name, codec_ms, globals.read_codec.implementation->samples_per_packet,
<span style="color: #800080; font-weight: bold">@@ -1397,106 +1678,119 @@ static switch_status_t engage_device(int restart)</span>
                        switch_core_codec_destroy(&globals.read_codec);
                        switch_core_codec_destroy(&globals.write_codec);
                        switch_core_timer_destroy(&globals.read_timer);
<span style="color: #A00000">-                        switch_core_timer_destroy(&globals.write_timer);</span>
<span style="color: #00A000">+                        switch_core_timer_destroy(&globals.readfile_timer);</span>
<span style="color: #00A000">+                        </span>
                        return SWITCH_STATUS_FALSE;
                }
        }
<span style="color: #A00000">-        globals.read_frame.rate = sample_rate;</span>
<span style="color: #A00000">-        globals.read_frame.codec = &globals.read_codec;</span>
<span style="color: #00A000">+        globals.cng_frame.rate = globals.read_frame.rate = sample_rate;</span>
<span style="color: #00A000">+        globals.cng_frame.codec = globals.read_frame.codec = &globals.read_codec;</span>
<span style="color: #A00000">-        switch_mutex_lock(globals.device_lock);</span>
<span style="color: #A00000">-        /* LOCKED ************************************************************************************************** */</span>
<span style="color: #A00000">-        inputParameters.device = globals.indev;</span>
<span style="color: #A00000">-        inputParameters.channelCount = 1;</span>
<span style="color: #A00000">-        inputParameters.sampleFormat = SAMPLE_TYPE;</span>
<span style="color: #A00000">-        inputParameters.suggestedLatency = Pa_GetDeviceInfo(inputParameters.device)->defaultLowInputLatency;</span>
<span style="color: #A00000">-        inputParameters.hostApiSpecificStreamInfo = NULL;</span>
<span style="color: #A00000">-        outputParameters.device = globals.outdev;</span>
<span style="color: #00A000">+        globals.codecs_inited=1;</span>
<span style="color: #00A000">+        return SWITCH_STATUS_SUCCESS;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+static switch_status_t switch_audio_stream()</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        audio_stream_t *stream;</span>
<span style="color: #00A000">+        if (! globals.call_list) { /* If no active calls then it will automatically switch over on next call */</span>
<span style="color: #00A000">+                return SWITCH_STATUS_SUCCESS;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        stream = get_audio_stream(globals.indev, globals.outdev);</span>
<span style="color: #00A000">+        if (stream == NULL) {</span>
<span style="color: #00A000">+                return SWITCH_STATUS_FALSE;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        globals.main_stream = stream;//TODO: need locks around here??</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return SWITCH_STATUS_SUCCESS;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+PaError open_audio_stream(PABLIO_Stream **stream, const PaStreamParameters * inputParameters, const PaStreamParameters * outputParameters)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        if (inputParameters->device != -1) {</span>
<span style="color: #00A000">+                return OpenAudioStream(stream, inputParameters, outputParameters, globals.sample_rate, paClipOff, globals.read_codec.implementation->samples_per_packet, globals.dual_streams);</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        return OpenAudioStream(stream, NULL, outputParameters, globals.sample_rate, paClipOff, globals.read_codec.implementation->samples_per_packet, 0);</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+static audio_stream_t *create_audio_stream(int indev, int outdev)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        PaStreamParameters inputParameters, outputParameters;</span>
<span style="color: #00A000">+        PaError err;</span>
<span style="color: #00A000">+        switch_event_t *event;</span>
<span style="color: #00A000">+        audio_stream_t *stream;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        stream = malloc(sizeof(audio_stream_t));</span>
<span style="color: #00A000">+        if (stream == NULL) {</span>
<span style="color: #00A000">+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Unable to alloc memory\n");</span>
<span style="color: #00A000">+                return NULL;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        memset(stream, 0, sizeof(audio_stream_t));</span>
<span style="color: #00A000">+        stream->next = NULL;</span>
<span style="color: #00A000">+        stream->stream = NULL;</span>
<span style="color: #00A000">+        stream->indev = indev;</span>
<span style="color: #00A000">+        stream->outdev = outdev;</span>
<span style="color: #00A000">+        if (!stream->write_timer.timer_interface) {</span>
<span style="color: #00A000">+                if (switch_core_timer_init(&(stream->write_timer),</span>
<span style="color: #00A000">+                                                                 globals.timer_name, globals.codec_ms, globals.read_codec.implementation->samples_per_packet,</span>
<span style="color: #00A000">+                                                                 module_pool) != SWITCH_STATUS_SUCCESS) {</span>
<span style="color: #00A000">+                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "setup timer failed!\n");</span>
<span style="color: #00A000">+                        switch_safe_free(stream);</span>
<span style="color: #00A000">+                        return NULL;</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        inputParameters.device = indev;</span>
<span style="color: #00A000">+        if (indev != -1) {</span>
<span style="color: #00A000">+                inputParameters.channelCount = 1;</span>
<span style="color: #00A000">+                inputParameters.sampleFormat = SAMPLE_TYPE;</span>
<span style="color: #00A000">+                inputParameters.suggestedLatency = Pa_GetDeviceInfo(inputParameters.device)->defaultLowInputLatency;</span>
<span style="color: #00A000">+                inputParameters.hostApiSpecificStreamInfo = NULL;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        outputParameters.device = outdev;</span>
        outputParameters.channelCount = 1;
        outputParameters.sampleFormat = SAMPLE_TYPE;
        outputParameters.suggestedLatency = Pa_GetDeviceInfo(outputParameters.device)->defaultLowOutputLatency;
        outputParameters.hostApiSpecificStreamInfo = NULL;
<span style="color: #A00000">-        //err = OpenAudioStream(&globals.audio_stream, NULL/*&inputParameters*/, &outputParameters, sample_rate, paClipOff,</span>
<span style="color: #A00000">-        //globals.read_codec.implementation->samples_per_packet);</span>
<span style="color: #A00000">-        err = OpenAudioStream(&globals.audio_stream, &inputParameters, &outputParameters, sample_rate, paClipOff,</span>
<span style="color: #A00000">-                                                 globals.read_codec.implementation->samples_per_packet, globals.dual_streams);</span>
<span style="color: #A00000">-        /* UNLOCKED ************************************************************************************************* */</span>
<span style="color: #00A000">+        </span>
<span style="color: #00A000">+        err = open_audio_stream(&(stream->stream), &inputParameters, &outputParameters);</span>
        if (err != paNoError) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error opening audio device retrying\n");
                switch_yield(1000000);
<span style="color: #A00000">-                err = OpenAudioStream(&globals.audio_stream, &inputParameters, &outputParameters, sample_rate, paClipOff,</span>
<span style="color: #A00000">-                                                         globals.read_codec.implementation->samples_per_packet, globals.dual_streams);</span>
<span style="color: #00A000">+                err = open_audio_stream(&(stream->stream), &inputParameters, &outputParameters);</span>
        }
<span style="color: #A00000">-        switch_mutex_unlock(globals.device_lock);</span>
<span style="color: #A00000">-</span>
        if (err != paNoError) {
<span style="color: #00A000">+                switch_safe_free(stream);</span>
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open audio device\n");
<span style="color: #A00000">-                switch_core_codec_destroy(&globals.read_codec);</span>
<span style="color: #A00000">-                switch_core_codec_destroy(&globals.write_codec);</span>
<span style="color: #A00000">-                switch_core_timer_destroy(&globals.read_timer);</span>
<span style="color: #A00000">-                switch_core_timer_destroy(&globals.write_timer);</span>
<span style="color: #A00000">-                switch_core_timer_destroy(&globals.hold_timer);</span>
                if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, MY_EVENT_ERROR_AUDIO_DEV) == SWITCH_STATUS_SUCCESS) {
                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Reason", Pa_GetErrorText(err));
                        switch_event_fire(&event);
                }
<span style="color: #A00000">-                return SWITCH_STATUS_FALSE;</span>
<span style="color: #00A000">+                return NULL;</span>
        }
<span style="color: #A00000">-</span>
<span style="color: #A00000">-        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Engage audio device rate: %d channels %d\n", sample_rate, outputParameters.channelCount);</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-        engage_ring_device();</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-        return SWITCH_STATUS_SUCCESS;</span>
<span style="color: #00A000">+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Created audio stream: %d channels %d\n", globals.sample_rate, outputParameters.channelCount);</span>
<span style="color: #00A000">+        return stream;</span>
}
<span style="color: #A00000">-static switch_status_t engage_ring_device(void)</span>
<span style="color: #00A000">+audio_stream_t *get_audio_stream(int indev, int outdev)</span>
{
<span style="color: #A00000">-        PaStreamParameters outputParameters = { 0 };</span>
<span style="color: #A00000">-        PaError err;</span>
<span style="color: #A00000">-        int sample_rate = globals.sample_rate;</span>
<span style="color: #A00000">-        int channels = 1;</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-        if (globals.ring_stream) {</span>
<span style="color: #A00000">-                return SWITCH_STATUS_SUCCESS;</span>
<span style="color: #00A000">+        audio_stream_t *stream;</span>
<span style="color: #00A000">+        if (outdev == -1) {</span>
<span style="color: #00A000">+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error invalid output audio device\n");</span>
        }
<span style="color: #A00000">-</span>
<span style="color: #A00000">-        if (globals.ringdev == globals.outdev) {</span>
<span style="color: #A00000">-                if (engage_device(0) == SWITCH_STATUS_SUCCESS) {</span>
<span style="color: #A00000">-                        globals.ring_stream = globals.audio_stream;</span>
<span style="color: #A00000">-                } else {</span>
<span style="color: #A00000">-                        goto error;</span>
<span style="color: #A00000">-                }</span>
<span style="color: #A00000">-        } else {</span>
<span style="color: #A00000">-                switch_mutex_lock(globals.device_lock);</span>
<span style="color: #A00000">-                /* LOCKED ************************************************************************************************** */</span>
<span style="color: #A00000">-                outputParameters.device = globals.ringdev;</span>
<span style="color: #A00000">-                outputParameters.channelCount = channels;</span>
<span style="color: #A00000">-                outputParameters.sampleFormat = SAMPLE_TYPE;</span>
<span style="color: #A00000">-                outputParameters.suggestedLatency = Pa_GetDeviceInfo(outputParameters.device)->defaultLowOutputLatency;</span>
<span style="color: #A00000">-                outputParameters.hostApiSpecificStreamInfo = NULL;</span>
<span style="color: #A00000">-                err = OpenAudioStream(&globals.ring_stream, NULL,</span>
<span style="color: #A00000">-                                                         &outputParameters, sample_rate, paClipOff, globals.read_codec.implementation->samples_per_packet, globals.dual_streams);</span>
<span style="color: #A00000">-                /* UNLOCKED ************************************************************************************************* */</span>
<span style="color: #A00000">-                switch_mutex_unlock(globals.device_lock);</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                if (err != paNoError) {</span>
<span style="color: #A00000">-                        goto error;</span>
<span style="color: #A00000">-                }</span>
<span style="color: #00A000">+        if (create_codecs(0) != SWITCH_STATUS_SUCCESS) {</span>
<span style="color: #00A000">+                return NULL;</span>
        }
<span style="color: #A00000">-</span>
<span style="color: #A00000">-        switch_yield(10000);</span>
<span style="color: #A00000">-        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Engage ring device rate: %d channels %d\n", sample_rate, channels);</span>
<span style="color: #A00000">-        return SWITCH_STATUS_SUCCESS;</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">- error:</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open ring device\n");</span>
<span style="color: #A00000">-        return SWITCH_STATUS_FALSE;</span>
<span style="color: #A00000">-</span>
<span style="color: #00A000">+        stream = find_audio_stream(indev, outdev, 0);</span>
<span style="color: #00A000">+        if (stream != NULL) {</span>
<span style="color: #00A000">+                return stream;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        stream = create_audio_stream(indev, outdev);</span>
<span style="color: #00A000">+        if (stream) {</span>
<span style="color: #00A000">+                add_stream(stream, 0);</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        return stream;</span>
}
static switch_status_t dtmf_call(char **argv, int argc, switch_stream_handle_t *stream)
<span style="color: #800080; font-weight: bold">@@ -1523,6 +1817,211 @@ static switch_status_t dtmf_call(char **argv, int argc, switch_stream_handle_t *</span>
        return SWITCH_STATUS_SUCCESS;
}
<span style="color: #00A000">+static switch_status_t close_streams(char **argv, int argc, switch_stream_handle_t *stream)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        if (globals.call_list) {</span>
<span style="color: #00A000">+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "ERROR: Cannot use this command this while a call is in progress\n");</span>
<span style="color: #00A000">+                return SWITCH_STATUS_FALSE;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        destroy_audio_streams();</span>
<span style="color: #00A000">+        stream->write_function(stream, "closestreams all open streams closed\n");</span>
<span style="color: #00A000">+        return SWITCH_STATUS_SUCCESS;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+static switch_status_t set_indev(char **argv, int argc, switch_stream_handle_t *stream)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        int devval;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if (globals.call_list && ! globals.live_stream_switch) {</span>
<span style="color: #00A000">+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "ERROR: Cannot use this command this while a call is in progress\n");</span>
<span style="color: #00A000">+                return SWITCH_STATUS_FALSE;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        if (*argv[0] == '#') {</span>
<span style="color: #00A000">+                devval = get_dev_by_number(argv[0] + 1, 1);</span>
<span style="color: #00A000">+        } else {</span>
<span style="color: #00A000">+                devval = get_dev_by_name(argv[0], 1);</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        if (devval < 0) {</span>
<span style="color: #00A000">+                stream->write_function(stream, "indev not set (invalid value)\n");</span>
<span style="color: #00A000">+                return SWITCH_STATUS_FALSE;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        globals.indev = devval;</span>
<span style="color: #00A000">+        switch_audio_stream();</span>
<span style="color: #00A000">+        stream->write_function(stream, "indev set to %d\n", devval);</span>
<span style="color: #00A000">+        return SWITCH_STATUS_SUCCESS;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+static switch_status_t set_outdev(char **argv, int argc, switch_stream_handle_t *stream)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        int devval;</span>
<span style="color: #00A000">+        if (globals.call_list && ! globals.live_stream_switch) {</span>
<span style="color: #00A000">+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "ERROR: Cannot use this command this while a call is in progress\n");</span>
<span style="color: #00A000">+                return SWITCH_STATUS_FALSE;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        if (*argv[0] == '#') {</span>
<span style="color: #00A000">+                devval = get_dev_by_number(argv[0] + 1, 0);</span>
<span style="color: #00A000">+        } else {</span>
<span style="color: #00A000">+                devval = get_dev_by_name(argv[0], 0);</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        if (devval < 0) {</span>
<span style="color: #00A000">+                stream->write_function(stream, "outdev not set (invalid value)\n");</span>
<span style="color: #00A000">+                return SWITCH_STATUS_FALSE;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        globals.outdev = devval;</span>
<span style="color: #00A000">+        switch_audio_stream();</span>
<span style="color: #00A000">+        stream->write_function(stream, "outdev set to %d\n", devval);</span>
<span style="color: #00A000">+        return SWITCH_STATUS_SUCCESS;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+static switch_status_t prepare_stream(char **argv, int argc, switch_stream_handle_t *stream)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        int devval=-2,devval2=-1;</span>
<span style="color: #00A000">+        if (! strcmp(argv[0], "#-1")) {</span>
<span style="color: #00A000">+                devval = -1;</span>
<span style="color: #00A000">+        } else if (*argv[0] == '#') {</span>
<span style="color: #00A000">+                devval = get_dev_by_number(argv[0]+1, 1);</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        if (devval == -2) {</span>
<span style="color: #00A000">+                stream->write_function(stream, "preparestream not prepared as indev has (invalid value)\n");</span>
<span style="color: #00A000">+                return SWITCH_STATUS_FALSE;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        if (*argv[1] == '#') {</span>
<span style="color: #00A000">+                devval2 = get_dev_by_number(argv[1]+1, 0);</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        if (devval2 == -1) {</span>
<span style="color: #00A000">+                stream->write_function(stream, "preparestream not prepared as outdev has (invalid value)\n");</span>
<span style="color: #00A000">+                return SWITCH_STATUS_FALSE;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if (! get_audio_stream(devval,devval2)) {</span>
<span style="color: #00A000">+                stream->write_function(stream, "preparestream not prepared received an invalid stream back\n");</span>
<span style="color: #00A000">+                return SWITCH_STATUS_FALSE;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        stream->write_function(stream, "preparestream prepared indev: %d outdev: %d\n", devval, devval2);</span>
<span style="color: #00A000">+        return SWITCH_STATUS_SUCCESS;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+static switch_status_t switch_stream(char **argv, int argc, switch_stream_handle_t *stream)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        int devval =-1, devval2 = -1;</span>
<span style="color: #00A000">+        if (globals.call_list && ! globals.live_stream_switch) {</span>
<span style="color: #00A000">+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "ERROR: Cannot use this command this while a call is in progress\n");</span>
<span style="color: #00A000">+                return SWITCH_STATUS_FALSE;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        if (*argv[0] == '#') {</span>
<span style="color: #00A000">+                devval = get_dev_by_number(argv[0]+1, 1);</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        if (devval == -1) {</span>
<span style="color: #00A000">+                stream->write_function(stream, "switchstream not prepared as indev has (invalid value)\n");</span>
<span style="color: #00A000">+                return SWITCH_STATUS_FALSE;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        if (*argv[1] == '#') {</span>
<span style="color: #00A000">+                devval2 = get_dev_by_number(argv[1]+1, 0);</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        if (devval2 == -1) {</span>
<span style="color: #00A000">+                stream->write_function(stream, "switchstream not prepared as outdev has (invalid value)\n");</span>
<span style="color: #00A000">+                return SWITCH_STATUS_FALSE;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        globals.indev = devval;</span>
<span style="color: #00A000">+        globals.outdev = devval2;</span>
<span style="color: #00A000">+        if (switch_audio_stream() != SWITCH_STATUS_SUCCESS) {</span>
<span style="color: #00A000">+                stream->write_function(stream, "switchstream was unable to switch\n");</span>
<span style="color: #00A000">+                return SWITCH_STATUS_FALSE;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        stream->write_function(stream, "switchstream switched to indev: %d outdev: %d\n", devval, devval2);</span>
<span style="color: #00A000">+        return SWITCH_STATUS_SUCCESS;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+static switch_status_t set_ringdev(char **argv, int argc, switch_stream_handle_t *stream)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        int devval;</span>
<span style="color: #00A000">+        if (globals.call_list && ! globals.live_stream_switch) {</span>
<span style="color: #00A000">+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "ERROR: Cannot use this command this while a call is in progress\n");</span>
<span style="color: #00A000">+                return SWITCH_STATUS_FALSE;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        if (! strcmp(argv[0], "#-1")) {</span>
<span style="color: #00A000">+                globals.ring_stream = NULL;</span>
<span style="color: #00A000">+                globals.ringdev = -1;</span>
<span style="color: #00A000">+                stream->write_function(stream, "ringdev set to %d\n", globals.ringdev);</span>
<span style="color: #00A000">+                return SWITCH_STATUS_SUCCESS;</span>
<span style="color: #00A000">+        } else if (*argv[0] == '#') {</span>
<span style="color: #00A000">+                devval = get_dev_by_number(argv[0] + 1, 0);</span>
<span style="color: #00A000">+        } else {</span>
<span style="color: #00A000">+                devval = get_dev_by_name(argv[0], 0);</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        if (devval == -1) {</span>
<span style="color: #00A000">+                stream->write_function(stream, "ringdev not set as dev has (invalid value)\n");</span>
<span style="color: #00A000">+                return SWITCH_STATUS_FALSE;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        globals.ringdev = devval;</span>
<span style="color: #00A000">+        stream->write_function(stream, "ringdev set to %d\n", globals.ringdev);</span>
<span style="color: #00A000">+        return SWITCH_STATUS_SUCCESS;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+static switch_status_t looptest(char **argv, int argc, switch_stream_handle_t *stream)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        int samples = 0;</span>
<span style="color: #00A000">+        int success = 0;</span>
<span style="color: #00A000">+        int i;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if (globals.call_list) {</span>
<span style="color: #00A000">+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "ERROR: Cannot use this command this while a call is in progress\n");</span>
<span style="color: #00A000">+                return SWITCH_STATUS_FALSE;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        if (validate_main_audio_stream() != SWITCH_STATUS_SUCCESS) {</span>
<span style="color: #00A000">+                stream->write_function(stream, "looptest Failed to engage audio device\n");</span>
<span style="color: #00A000">+                return SWITCH_STATUS_FALSE;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        globals.stream_in_use = 1;</span>
<span style="color: #00A000">+        for (i = 0; i < 400; i++) {</span>
<span style="color: #00A000">+                if (globals.destroying_streams || ! globals.main_stream->stream) {</span>
<span style="color: #00A000">+                        break;</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+                if ((samples = ReadAudioStream(globals.main_stream->stream, globals.read_frame.data, globals.read_codec.implementation->samples_per_packet, &globals.read_timer))) {</span>
<span style="color: #00A000">+                        WriteAudioStream(globals.main_stream->stream, globals.read_frame.data, (long) samples, &(globals.main_stream->write_timer));</span>
<span style="color: #00A000">+                        success = 1;</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+                switch_yield(10000);</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        globals.stream_in_use = 0;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if (!success) {</span>
<span style="color: #00A000">+                stream->write_function(stream, "Failed to read any bytes from indev\n");</span>
<span style="color: #00A000">+                return SWITCH_STATUS_FALSE;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        destroy_audio_streams();</span>
<span style="color: #00A000">+        stream->write_function(stream, "looptest complete\n");</span>
<span style="color: #00A000">+        return SWITCH_STATUS_SUCCESS;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+static switch_status_t set_ringfile(char **argv, int argc, switch_stream_handle_t *stream)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        if (! argv[0]) {</span>
<span style="color: #00A000">+                stream->write_function(stream, "%s", globals.ring_file);</span>
<span style="color: #00A000">+                return SWITCH_STATUS_SUCCESS;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        if (create_codecs(0) == SWITCH_STATUS_SUCCESS) {</span>
<span style="color: #00A000">+                switch_file_handle_t fh = { 0 };</span>
<span style="color: #00A000">+                if (switch_core_file_open(&fh,</span>
<span style="color: #00A000">+                                                                 argv[0],</span>
<span style="color: #00A000">+                                                                 globals.read_codec.implementation->number_of_channels,</span>
<span style="color: #00A000">+                                                                 globals.read_codec.implementation->actual_samples_per_second,</span>
<span style="color: #00A000">+                                                                 SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) == SWITCH_STATUS_SUCCESS) {</span>
<span style="color: #00A000">+                        switch_core_file_close(&fh);</span>
<span style="color: #00A000">+                        set_global_ring_file(argv[0]);</span>
<span style="color: #00A000">+                } else {</span>
<span style="color: #00A000">+                        stream->write_function(stream, "ringfile Unable to open ring file %s\n", argv[0]);</span>
<span style="color: #00A000">+                        return SWITCH_STATUS_FALSE;</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+        } else {</span>
<span style="color: #00A000">+                stream->write_function(stream, "ringfile Failed to init codecs device\n");</span>
<span style="color: #00A000">+                return SWITCH_STATUS_FALSE;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        stream->write_function(stream, "ringfile set to %s", globals.ring_file);</span>
<span style="color: #00A000">+        return SWITCH_STATUS_SUCCESS;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
static switch_status_t switch_call(char **argv, int argc, switch_stream_handle_t *stream)
{
        private_t *tp, *tech_pvt = NULL;
<span style="color: #800080; font-weight: bold">@@ -1542,7 +2041,10 @@ static switch_status_t switch_call(char **argv, int argc, switch_stream_handle_t</span>
                }
        } else if (!strcasecmp(callid, "none")) {
                for (tp = globals.call_list; tp; tp = tp->next) {
<span style="color: #00A000">+                        if (switch_test_flag(tp, TFLAG_MASTER))        {</span>
                        switch_clear_flag_locked(tp, TFLAG_MASTER);
<span style="color: #00A000">+                                create_hold_event(tp,0);</span>
<span style="color: #00A000">+                        }</span>
                }
                stream->write_function(stream, "OK\n");
                goto done;
<span style="color: #800080; font-weight: bold">@@ -1559,6 +2061,7 @@ static switch_status_t switch_call(char **argv, int argc, switch_stream_handle_t</span>
                        remove_pvt(tech_pvt);
                }
                add_pvt(tech_pvt, PA_MASTER);
<span style="color: #00A000">+                create_hold_event(tech_pvt, 1);</span>
                stream->write_function(stream, "OK\n");
        } else {
                stream->write_function(stream, "NO SUCH CALL\n");
<span style="color: #800080; font-weight: bold">@@ -1609,7 +2112,6 @@ static switch_status_t answer_call(char **argv, int argc, switch_stream_handle_t</span>
                                switch_channel_t *channel = switch_core_session_get_channel(tp->session);
                                switch_set_flag_locked(tp, TFLAG_ANSWER);
                                add_pvt(tp, PA_MASTER);
<span style="color: #A00000">-                                deactivate_ring_device();</span>
                                switch_channel_mark_answered(channel);
                        }
                } else {
<span style="color: #800080; font-weight: bold">@@ -1624,7 +2126,6 @@ static switch_status_t answer_call(char **argv, int argc, switch_stream_handle_t</span>
                        switch_channel_t *channel = switch_core_session_get_channel(tp->session);
                        switch_set_flag_locked(tp, TFLAG_ANSWER);
                        add_pvt(tp, PA_MASTER);
<span style="color: #A00000">-                        deactivate_ring_device();</span>
                        switch_channel_mark_answered(channel);
                        x++;
                        break;
<span style="color: #800080; font-weight: bold">@@ -1766,7 +2267,6 @@ static switch_status_t place_call(char **argv, int argc, switch_stream_handle_t</span>
                        channel = switch_core_session_get_channel(session);
                        switch_core_session_set_private(session, tech_pvt);
                        tech_pvt->session = session;
<span style="color: #A00000">-                        globals.flags = GFLAG_EAR | GFLAG_MOUTH;</span>
                } else {
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "Hey where is my memory pool?\n");
                        switch_core_session_destroy(&session);
<span style="color: #800080; font-weight: bold">@@ -1805,9 +2305,8 @@ static switch_status_t place_call(char **argv, int argc, switch_stream_handle_t</span>
                        switch_channel_set_caller_profile(channel, tech_pvt->caller_profile);
                }
                tech_pvt->session = session;
<span style="color: #A00000">-                if ((status = engage_device(0)) == SWITCH_STATUS_SUCCESS) {</span>
<span style="color: #00A000">+                if ((status = validate_main_audio_stream()) == SWITCH_STATUS_SUCCESS) {</span>
                        switch_set_flag_locked(tech_pvt, TFLAG_ANSWER);
<span style="color: #A00000">-                        deactivate_ring_device();</span>
                        switch_channel_mark_answered(channel);
                        switch_channel_set_state(channel, CS_INIT);
                        if (switch_core_session_thread_launch(tech_pvt->session) != SWITCH_STATUS_SUCCESS) {
<span style="color: #800080; font-weight: bold">@@ -1855,10 +2354,11 @@ SWITCH_STANDARD_API(pa_cmd)</span>
{
        char *argv[1024] = { 0 };
        int argc = 0;
<span style="color: #A00000">-        char *mycmd = NULL, *devname = NULL;</span>
<span style="color: #00A000">+        char *mycmd = NULL;</span>
        switch_status_t status = SWITCH_STATUS_SUCCESS;
        pa_command_t func = NULL;
<span style="color: #A00000">-        int lead = 1, devval = 0;</span>
<span style="color: #00A000">+        int devval;</span>
<span style="color: #00A000">+        int lead = 1;</span>
        char *wcmd = NULL, *action = NULL;
        char cmd_buf[1024] = "";
        char *http = NULL;
<span style="color: #800080; font-weight: bold">@@ -1878,9 +2378,15 @@ SWITCH_STANDARD_API(pa_cmd)</span>
                "pa devlist [xml]\n"
                "pa indev #<num>|<partial name>\n"
                "pa outdev #<num>|<partial name>\n"
<span style="color: #00A000">+                "pa preparestream #<indev_num> #<outdev_num>\n"</span>
<span style="color: #00A000">+                "pa switchstream #<indev_num> #<outdev_num>\n"</span>
<span style="color: #00A000">+                "pa closestreams\n"</span>
                "pa ringdev #<num>|<partial name>\n"
<span style="color: #A00000">-                "pa play [ringtest|<filename>]\n"</span>
<span style="color: #A00000">-                "pa ringfile [filename]\n" "pa looptest\n" "--------------------------------------------------------------------------------\n";</span>
<span style="color: #00A000">+                "pa play [ringtest|<filename>] [seconds] [no_close]\n"</span>
<span style="color: #00A000">+                "pa playdev #<num> [ringtest|<filename>] [seconds] [no_close]\n"</span>
<span style="color: #00A000">+                "pa ringfile [filename]\n"</span>
<span style="color: #00A000">+                "pa looptest\n"</span>
<span style="color: #00A000">+                "--------------------------------------------------------------------------------\n";</span>
        if (stream->param_event) {
<span style="color: #800080; font-weight: bold">@@ -1973,169 +2479,42 @@ SWITCH_STANDARD_API(pa_cmd)</span>
                func = switch_call;
        } else if (!strcasecmp(argv[0], "dtmf")) {
                func = dtmf_call;
<span style="color: #00A000">+        } else if (!strcasecmp(argv[0], "closestreams")) {</span>
<span style="color: #00A000">+                func = close_streams;</span>
        } else if (argv[1] && !strcmp(argv[0], "indev")) {
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                if (globals.call_list) {</span>
<span style="color: #A00000">-                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "ERROR: Cannot use this command this while a call is in progress\n");</span>
<span style="color: #A00000">-                        goto done;</span>
<span style="color: #A00000">-                }</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                if (*argv[1] == '#') {</span>
<span style="color: #A00000">-                        devval = get_dev_by_number(argv[1] + 1, 1);</span>
<span style="color: #A00000">-                } else {</span>
<span style="color: #A00000">-                        devval = get_dev_by_name(argv[1], 1);</span>
<span style="color: #A00000">-                }</span>
<span style="color: #A00000">-                devname = "indev";</span>
<span style="color: #A00000">-                if (devval > -1) {</span>
<span style="color: #A00000">-                        globals.indev = devval;</span>
<span style="color: #A00000">-                        //engage_device(1);</span>
<span style="color: #A00000">-                }</span>
<span style="color: #00A000">+                func = set_indev;</span>
        } else if (argv[1] && !strcmp(argv[0], "outdev")) {
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                if (globals.call_list) {</span>
<span style="color: #A00000">-                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "ERROR: Cannot use this command this while a call is in progress\n");</span>
<span style="color: #A00000">-                        goto done;</span>
<span style="color: #A00000">-                }</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                if (*argv[1] == '#') {</span>
<span style="color: #A00000">-                        devval = get_dev_by_number(argv[1] + 1, 0);</span>
<span style="color: #A00000">-                } else {</span>
<span style="color: #A00000">-                        devval = get_dev_by_name(argv[1], 0);</span>
<span style="color: #A00000">-                }</span>
<span style="color: #A00000">-                devname = "outdev";</span>
<span style="color: #A00000">-                if (devval > -1) {</span>
<span style="color: #A00000">-                        globals.outdev = devval;</span>
<span style="color: #A00000">-                        //engage_device(1);</span>
<span style="color: #A00000">-                }</span>
<span style="color: #00A000">+                func = set_outdev;</span>
<span style="color: #00A000">+        } else if (argv[1] && argv[2] && !strcmp(argv[0], "preparestream")) {</span>
<span style="color: #00A000">+                func = prepare_stream;        </span>
<span style="color: #00A000">+        } else if (argv[1] && argv[2] && !strcmp(argv[0], "switchstream")) {</span>
<span style="color: #00A000">+                func = switch_stream;        </span>
        } else if (argv[1] && !strcmp(argv[0], "ringdev")) {
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                if (globals.call_list) {</span>
<span style="color: #A00000">-                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "ERROR: Cannot use this command this while a call is in progress\n");</span>
<span style="color: #A00000">-                        goto done;</span>
<span style="color: #00A000">+                func = set_ringdev;</span>
<span style="color: #00A000">+        } else if ((argv[1] && !strcmp(argv[0], "play"))) {</span>
<span style="color: #00A000">+                if (validate_main_audio_stream() == SWITCH_STATUS_SUCCESS) {</span>
<span style="color: #00A000">+                        play_dev(stream, globals.main_stream ? globals.main_stream->outdev : -1,argv[1],argv[2], argv[3]);</span>
<span style="color: #00A000">+                }else{</span>
<span style="color: #00A000">+                        stream->write_function(stream, "Failed to engage audio device\n");</span>
                }
<span style="color: #A00000">-</span>
<span style="color: #00A000">+                goto done;</span>
<span style="color: #00A000">+        } else if ((argv[1] && argv[2] && !strcmp(argv[0], "playdev"))) {</span>
                if (*argv[1] == '#') {
                        devval = get_dev_by_number(argv[1] + 1, 0);
                } else {
<span style="color: #A00000">-                        devval = get_dev_by_name(argv[1], 0);</span>
<span style="color: #A00000">-                }</span>
<span style="color: #A00000">-                devname = "ringdev";</span>
<span style="color: #A00000">-                if (devval > -1) {</span>
<span style="color: #A00000">-                        globals.ringdev = devval;</span>
<span style="color: #A00000">-                        //engage_device(1);</span>
<span style="color: #A00000">-                }</span>
<span style="color: #A00000">-        } else if ((argv[1] && !strcasecmp(argv[0], "play"))) {</span>
<span style="color: #A00000">-                switch_file_handle_t fh = { 0 };</span>
<span style="color: #A00000">-                char *playfile = NULL;</span>
<span style="color: #A00000">-                int samples = 0;</span>
<span style="color: #A00000">-                int seconds = 5;</span>
<span style="color: #A00000">-                int wrote = 0;</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                if (globals.call_list) {</span>
<span style="color: #A00000">-                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "ERROR: Cannot use this command this while a call is in progress\n");</span>
<span style="color: #A00000">-                        goto done;</span>
<span style="color: #A00000">-                }</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                if (!strcasecmp(argv[1], "ringtest")) {</span>
<span style="color: #A00000">-                        playfile = globals.ring_file;</span>
<span style="color: #A00000">-                } else {</span>
<span style="color: #A00000">-                        playfile = argv[1];</span>
<span style="color: #A00000">-                }</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                fh.pre_buffer_datalen = SWITCH_DEFAULT_FILE_BUFFER_LEN;</span>
<span style="color: #A00000">-                if (engage_device(0) == SWITCH_STATUS_SUCCESS) {</span>
<span style="color: #A00000">-                        if (switch_core_file_open(&fh,</span>
<span style="color: #A00000">-                                                                         playfile,</span>
<span style="color: #A00000">-                                                                         globals.read_codec.implementation->number_of_channels,</span>
<span style="color: #A00000">-                                                                         globals.read_codec.implementation->actual_samples_per_second,</span>
<span style="color: #A00000">-                                                                         SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) == SWITCH_STATUS_SUCCESS) {</span>
<span style="color: #A00000">-                                switch_size_t olen = globals.read_codec.implementation->samples_per_packet;</span>
<span style="color: #A00000">-                                int16_t abuf[2048];</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                                if (argv[2]) {</span>
<span style="color: #A00000">-                                        int i = atoi(argv[2]);</span>
<span style="color: #A00000">-                                        if (i >= 0) {</span>
<span style="color: #A00000">-                                                seconds = i;</span>
<span style="color: #A00000">-                                        }</span>
<span style="color: #A00000">-                                }</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                                samples = globals.read_codec.implementation->actual_samples_per_second * seconds;</span>
<span style="color: #A00000">-                                while (switch_core_file_read(&fh, abuf, &olen) == SWITCH_STATUS_SUCCESS) {</span>
<span style="color: #A00000">-                                        WriteAudioStream(globals.audio_stream, abuf, (long) olen, &globals.read_timer);</span>
<span style="color: #A00000">-                                        wrote += (int) olen;</span>
<span style="color: #A00000">-                                        if (samples) {</span>
<span style="color: #A00000">-                                                samples -= (int) olen;</span>
<span style="color: #A00000">-                                                if (samples <= 0) {</span>
<span style="color: #A00000">-                                                        break;</span>
<span style="color: #A00000">-                                                }</span>
<span style="color: #A00000">-                                        }</span>
<span style="color: #A00000">-                                        olen = globals.read_codec.implementation->samples_per_packet;</span>
<span style="color: #A00000">-                                }</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                                switch_core_file_close(&fh);</span>
<span style="color: #A00000">-                                deactivate_audio_device();</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                                seconds = wrote / globals.read_codec.implementation->actual_samples_per_second;</span>
<span style="color: #A00000">-                                stream->write_function(stream, "playback test [%s] %d second(s) %d samples @%dkhz",</span>
<span style="color: #A00000">-                                                                         playfile, seconds, wrote, globals.read_codec.implementation->actual_samples_per_second);</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                        } else {</span>
<span style="color: #A00000">-                                stream->write_function(stream, "Cannot play requested file %s\n", argv[1]);</span>
<span style="color: #A00000">-                        }</span>
<span style="color: #A00000">-                } else {</span>
<span style="color: #A00000">-                        stream->write_function(stream, "Failed to engage audio device\n");</span>
<span style="color: #00A000">+                        devval = -1;</span>
                }
<span style="color: #00A000">+                play_dev(stream, devval,argv[2],argv[3],argv[4]);</span>
                goto done;
        } else if (!strcasecmp(argv[0], "looptest")) {
<span style="color: #A00000">-                if (globals.call_list) {</span>
<span style="color: #A00000">-                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "ERROR: Cannot use this command this while a call is in progress\n");</span>
<span style="color: #A00000">-                        goto done;</span>
<span style="color: #A00000">-                }</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                if (engage_device(0) == SWITCH_STATUS_SUCCESS) {</span>
<span style="color: #A00000">-                        int samples = 0;</span>
<span style="color: #A00000">-                        int success = 0;</span>
<span style="color: #A00000">-                        int i;</span>
<span style="color: #A00000">-                        for (i = 0; i < 400; i++) {</span>
<span style="color: #A00000">-                                if ((samples = ReadAudioStream(globals.audio_stream, globals.read_frame.data,</span>
<span style="color: #A00000">-                                                                                         globals.read_codec.implementation->samples_per_packet, &globals.read_timer))) {</span>
<span style="color: #A00000">-                                        WriteAudioStream(globals.audio_stream, globals.read_frame.data, (long) samples, &globals.write_timer);</span>
<span style="color: #A00000">-                                        success = 1;</span>
<span style="color: #A00000">-                                }</span>
<span style="color: #A00000">-                                switch_yield(10000);</span>
<span style="color: #A00000">-                        }</span>
<span style="color: #A00000">-                        if (!success) {</span>
<span style="color: #A00000">-                                stream->write_function(stream, "Failed to read any bytes from indev\n");</span>
<span style="color: #A00000">-                        }</span>
<span style="color: #A00000">-                        deactivate_audio_device();</span>
<span style="color: #A00000">-                } else {</span>
<span style="color: #A00000">-                        stream->write_function(stream, "Failed to engage audio device\n");</span>
<span style="color: #A00000">-                }</span>
<span style="color: #A00000">-                goto done;</span>
<span style="color: #00A000">+                func = looptest;</span>
        } else if (!strcasecmp(argv[0], "ringfile")) {
<span style="color: #A00000">-                if (argv[1]) {</span>
<span style="color: #A00000">-                        if (engage_device(0) == SWITCH_STATUS_SUCCESS) {</span>
<span style="color: #A00000">-                                switch_file_handle_t fh = { 0 };</span>
<span style="color: #A00000">-                                if (switch_core_file_open(&fh,</span>
<span style="color: #A00000">-                                                                                 argv[1],</span>
<span style="color: #A00000">-                                                                                 globals.read_codec.implementation->number_of_channels,</span>
<span style="color: #A00000">-                                                                                 globals.read_codec.implementation->actual_samples_per_second,</span>
<span style="color: #A00000">-                                                                                 SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) == SWITCH_STATUS_SUCCESS) {</span>
<span style="color: #A00000">-                                        switch_core_file_close(&fh);</span>
<span style="color: #A00000">-                                        set_global_ring_file(argv[1]);</span>
<span style="color: #A00000">-                                } else {</span>
<span style="color: #A00000">-                                        stream->write_function(stream, "Unable to open ring file %s\n", argv[1]);</span>
<span style="color: #A00000">-                                }</span>
<span style="color: #A00000">-                        } else {</span>
<span style="color: #A00000">-                                stream->write_function(stream, "Failed to engage audio device\n");</span>
<span style="color: #A00000">-                        }</span>
<span style="color: #A00000">-                } else {</span>
<span style="color: #A00000">-                        stream->write_function(stream, "%s", globals.ring_file);</span>
<span style="color: #A00000">-                }</span>
<span style="color: #A00000">-                goto done;</span>
<span style="color: #00A000">+                func = set_ringfile;</span>
<span style="color: #00A000">+        } else {</span>
<span style="color: #00A000">+                stream->write_function(stream, "Unknown Command or not enough args [%s]\n", argv[0]);</span>
        }
<span style="color: #00A000">+</span>
        if (func) {
                if (http) {
                        stream->write_function(stream, "<pre>");
<span style="color: #800080; font-weight: bold">@@ -2143,21 +2522,12 @@ SWITCH_STANDARD_API(pa_cmd)</span>
                switch_mutex_lock(globals.pa_mutex);
                status = func(&argv[lead], argc - lead, stream);
<span style="color: #00A000">+                status = SWITCH_STATUS_SUCCESS; /*if func was defined we want to always return success as the command was found */</span>
                switch_mutex_unlock(globals.pa_mutex);
                if (http) {
                        stream->write_function(stream, "\n\n</pre>");
                }
<span style="color: #A00000">-        } else {</span>
<span style="color: #A00000">-                if (devname) {</span>
<span style="color: #A00000">-                        if (devval > -1) {</span>
<span style="color: #A00000">-                                stream->write_function(stream, "%s set to %d\n", devname, devval);</span>
<span style="color: #A00000">-                        } else {</span>
<span style="color: #A00000">-                                stream->write_function(stream, "%s not set (invalid value)\n", devname);</span>
<span style="color: #A00000">-                        }</span>
<span style="color: #A00000">-                } else {</span>
<span style="color: #A00000">-                        stream->write_function(stream, "Unknown Command [%s]\n", argv[0]);</span>
<span style="color: #A00000">-                }</span>
        }
done:
<span style="color: #800080; font-weight: bold">@@ -2171,6 +2541,14 @@ SWITCH_STANDARD_API(pa_cmd)</span>
                                                         "<input name=action type=submit value=\"switch\"> "
                                                         "<input name=action type=submit value=\"mute\"> "
                                                         "<input name=action type=submit value=\"unmute\"> "
<span style="color: #00A000">+                                                         "<input name=action type=submit value=\"indev\"> "</span>
<span style="color: #00A000">+                                                         "<input name=action type=submit value=\"outdev\"> "</span>
<span style="color: #00A000">+                                                         "<input name=action type=submit value=\"preparestream\"> "</span>
<span style="color: #00A000">+                                                         "<input name=action type=submit value=\"switchstream\"> "</span>
<span style="color: #00A000">+                                                         "<input name=action type=submit value=\"closestreams\"> "</span>
<span style="color: #00A000">+                                                         "<input name=action type=submit value=\"ringdev\"> "</span>
<span style="color: #00A000">+                                                         "<input name=action type=submit value=\"play\"> "</span>
<span style="color: #00A000">+                                                         "<input name=action type=submit value=\"playdev\"> "</span>
                                                         "<input name=action type=submit value=\"answer\"> <br><br>"
                                                         "<table border=1>\n"
                                                         "<tr><td><input name=action type=submit value=\"1\"></td>"
</pre></div>
<div class="highlight"><pre>committer: Anthony Minessale
comments:
try to improve iLBC compat
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c</span>
<span style="color: #000080; font-weight: bold">index 8b2f470..a0b7fca 100644</span>
<span style="color: #A00000">--- a/src/mod/endpoints/mod_sofia/sofia_glue.c</span>
<span style="color: #00A000">+++ b/src/mod/endpoints/mod_sofia/sofia_glue.c</span>
<span style="color: #800080; font-weight: bold">@@ -4480,7 +4480,7 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s</span>
                                                match = strcasecmp(rm_encoding, imp->iananame) ? 0 : 1;
                                        }
<span style="color: #A00000">-                                        if (match && bit_rate && map_bit_rate && map_bit_rate != bit_rate) {</span>
<span style="color: #00A000">+                                        if (match && bit_rate && map_bit_rate && map_bit_rate != bit_rate && strcasecmp(map->rm_encoding, "ilbc")) {</span>
                                                /* nevermind */
                                                match = 0;
                                        }
<span style="color: #000080; font-weight: bold">diff --git a/src/switch_core.c b/src/switch_core.c</span>
<span style="color: #000080; font-weight: bold">index 8754305..0eb51cc 100644</span>
<span style="color: #A00000">--- a/src/switch_core.c</span>
<span style="color: #00A000">+++ b/src/switch_core.c</span>
<span style="color: #800080; font-weight: bold">@@ -1486,7 +1486,7 @@ static void switch_load_core_config(const char *file)</span>
{
        switch_xml_t xml = NULL, cfg = NULL;
<span style="color: #A00000">-        //switch_core_hash_insert(runtime.ptimes, "ilbc", &d_30);</span>
<span style="color: #00A000">+        switch_core_hash_insert(runtime.ptimes, "ilbc", &d_30);</span>
        switch_core_hash_insert(runtime.ptimes, "G723", &d_30);
        if ((xml = switch_xml_open_cfg(file, &cfg, NULL))) {
</pre></div>
<div class="highlight"><pre>committer: Arnaldo Pereira
comments:
Merge branch 'master' of git://git.freeswitch.org/freeswitch
</pre></div>
<div class="highlight"><pre>committer: Anthony Minessale
comments:
doh regression
<span style="color: #000080; font-weight: bold">diff --git a/src/switch_event.c b/src/switch_event.c</span>
<span style="color: #000080; font-weight: bold">index 3e12ea1..b626d5b 100644</span>
<span style="color: #A00000">--- a/src/switch_event.c</span>
<span style="color: #00A000">+++ b/src/switch_event.c</span>
<span style="color: #800080; font-weight: bold">@@ -1561,6 +1561,7 @@ SWITCH_DECLARE(char *) switch_event_expand_headers(switch_event_t *event, const</span>
        char *cloned_sub_val = NULL;
        char *func_val = NULL;
        int nv = 0;
<span style="color: #00A000">+        char *gvar = NULL;</span>
        nv = switch_string_var_check_const(in) || switch_string_has_escaped_data(in);
<span style="color: #800080; font-weight: bold">@@ -1673,7 +1674,6 @@ SWITCH_DECLARE(char *) switch_event_expand_headers(switch_event_t *event, const</span>
                                        int offset = 0;
                                        int ooffset = 0;
                                        char *ptr;
<span style="color: #A00000">-                                        char *gvar = NULL;</span>
                                        if ((expanded = switch_event_expand_headers(event, (char *) vname)) == vname) {
                                                expanded = NULL;
<span style="color: #800080; font-weight: bold">@@ -1690,6 +1690,7 @@ SWITCH_DECLARE(char *) switch_event_expand_headers(switch_event_t *event, const</span>
                                        }
                                        if (!(sub_val = switch_event_get_header(event, vname))) {
<span style="color: #00A000">+                                                switch_safe_free(gvar);</span>
                                                if ((gvar = switch_core_get_variable_dup(vname))) {
                                                        sub_val = gvar;
                                                }
<span style="color: #800080; font-weight: bold">@@ -1713,7 +1714,6 @@ SWITCH_DECLARE(char *) switch_event_expand_headers(switch_event_t *event, const</span>
                                                }
                                        }
<span style="color: #A00000">-                                        switch_safe_free(gvar);</span>
                                        switch_safe_free(expanded);
                                } else {
                                        switch_stream_handle_t stream = { 0 };
<span style="color: #800080; font-weight: bold">@@ -1789,6 +1789,7 @@ SWITCH_DECLARE(char *) switch_event_expand_headers(switch_event_t *event, const</span>
                }
        }
        free(indup);
<span style="color: #00A000">+        switch_safe_free(gvar);</span>
        return data;
}
</pre></div>
<div class="highlight"><pre>committer: Anthony Minessale
comments:
FS-3027
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c</span>
<span style="color: #000080; font-weight: bold">index dfd6a76..8b2f470 100644</span>
<span style="color: #A00000">--- a/src/mod/endpoints/mod_sofia/sofia_glue.c</span>
<span style="color: #00A000">+++ b/src/mod/endpoints/mod_sofia/sofia_glue.c</span>
<span style="color: #800080; font-weight: bold">@@ -4071,15 +4071,22 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s</span>
        greedy = !!sofia_test_pflag(tech_pvt->profile, PFLAG_GREEDY);
        scrooge = !!sofia_test_pflag(tech_pvt->profile, PFLAG_SCROOGE);
<span style="color: #A00000">-        if (!greedy || !scrooge) {</span>
<span style="color: #A00000">-                if ((val = switch_channel_get_variable(channel, "sip_codec_negotiation"))) {</span>
<span style="color: #A00000">-                        if (!strcasecmp(val, "greedy")) {</span>
<span style="color: #A00000">-                                greedy = 1;</span>
<span style="color: #A00000">-                        } else if (!strcasecmp(val, "scrooge")) {</span>
<span style="color: #A00000">-                                scrooge = 1;</span>
<span style="color: #A00000">-                                greedy = 1;</span>
<span style="color: #A00000">-                        }</span>
<span style="color: #A00000">-                }</span>
<span style="color: #00A000">+        if ((val = switch_channel_get_variable(channel, "sip_codec_negotiation"))) {</span>
<span style="color: #00A000">+                if (!strcasecmp(val, "generous")) {</span>
<span style="color: #00A000">+                        greedy = 0;</span>
<span style="color: #00A000">+                        scrooge = 0;</span>
<span style="color: #00A000">+                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "sip_codec_negotiation overriding sofia inbound-codec-negotiation : generous\n" );</span>
<span style="color: #00A000">+                } else if (!strcasecmp(val, "greedy")) {</span>
<span style="color: #00A000">+                        greedy = 1;</span>
<span style="color: #00A000">+                        scrooge = 0;</span>
<span style="color: #00A000">+                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "sip_codec_negotiation overriding sofia inbound-codec-negotiation : greedy\n" );</span>
<span style="color: #00A000">+                } else if (!strcasecmp(val, "scrooge")) {</span>
<span style="color: #00A000">+                        scrooge = 1;</span>
<span style="color: #00A000">+                        greedy = 1;</span>
<span style="color: #00A000">+                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "sip_codec_negotiation overriding sofia inbound-codec-negotiation : scrooge\n" );</span>
<span style="color: #00A000">+                } else {</span>
<span style="color: #00A000">+                 switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "sip_codec_negotiation ignored invalid value : '%s' \n", val );        </span>
<span style="color: #00A000">+                }                </span>
        }
        if ((tech_pvt->origin = switch_core_session_strdup(session, (char *) sdp->sdp_origin->o_username))) {
</pre></div>
<div class="highlight"><pre>committer: Jeff Lenk
comments:
VS2010 fix minor build order problem
<span style="color: #000080; font-weight: bold">diff --git a/libs/win32/sofia/libsofia_sip_ua_static.2010.vcxproj b/libs/win32/sofia/libsofia_sip_ua_static.2010.vcxproj</span>
<span style="color: #000080; font-weight: bold">index d841b89..be91504 100644</span>
<span style="color: #A00000">--- a/libs/win32/sofia/libsofia_sip_ua_static.2010.vcxproj</span>
<span style="color: #00A000">+++ b/libs/win32/sofia/libsofia_sip_ua_static.2010.vcxproj</span>
<span style="color: #800080; font-weight: bold">@@ -508,6 +508,12 @@ if not exist "$(ProjectDir)$(IntDir)\auth_client.obj" "autogen.cmd"</span>
<Project>{8b3b4c4c-13c2-446c-beb0-f412cc2cfb9a}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
<span style="color: #00A000">+ <ProjectReference Include="..\openssl\libeay32.2010.vcxproj"></span>
<span style="color: #00A000">+ <Project>{d331904d-a00a-4694-a5a3-fcff64ab5dbe}</Project></span>
<span style="color: #00A000">+ </ProjectReference></span>
<span style="color: #00A000">+ <ProjectReference Include="..\openssl\ssleay32.2010.vcxproj"></span>
<span style="color: #00A000">+ <Project>{b4b62169-5ad4-4559-8707-3d933ac5db39}</Project></span>
<span style="color: #00A000">+ </ProjectReference></span>
<ProjectReference Include="..\pthread\pthread.2010.vcxproj">
<Project>{df018947-0fff-4eb3-bdee-441dc81da7a4}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</pre></div>
<div class="highlight"><pre>committer: Anthony Minessale
comments:
fix possible bad pointer in global vars (please test)
<span style="color: #000080; font-weight: bold">diff --git a/fscomm/widgets/codecwidget.cpp b/fscomm/widgets/codecwidget.cpp</span>
<span style="color: #000080; font-weight: bold">index 42b10fe..2f82e1a 100644</span>
<span style="color: #A00000">--- a/fscomm/widgets/codecwidget.cpp</span>
<span style="color: #00A000">+++ b/fscomm/widgets/codecwidget.cpp</span>
<span style="color: #800080; font-weight: bold">@@ -131,6 +131,8 @@ void CodecWidget::setCodecString(QString codecList)</span>
QStringList parsed = codecList.split("{");
QString var = parsed.at(1);
var = var.split("}").at(0);
<span style="color: #00A000">+                // warning switch_core_get_Variable may return an unsafe pointer in some cases.</span>
<span style="color: #00A000">+                // revise to use switch_core_get_variable_dup, and then free it after you are done.</span>
var = switch_core_get_variable(var.toAscii().data());
if ( ! var.isEmpty() ) {
codecList = var;
</pre></div>
<div class="highlight"><pre>committer: Anthony Minessale
comments:
only pass publish on when you have a subscription
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c</span>
<span style="color: #000080; font-weight: bold">index 19125c6..a38a61e 100644</span>
<span style="color: #A00000">--- a/src/mod/endpoints/mod_sofia/sofia_presence.c</span>
<span style="color: #00A000">+++ b/src/mod/endpoints/mod_sofia/sofia_presence.c</span>
<span style="color: #800080; font-weight: bold">@@ -2570,6 +2570,19 @@ static int sofia_counterpath_crutch(void *pArg, int argc, char **argv, char **co</span>
        return 0;
}
<span style="color: #00A000">+</span>
<span style="color: #00A000">+uint32_t sofia_presence_contact_count(sofia_profile_t *profile, const char *contact_str)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        char buf[32] = "";</span>
<span style="color: #00A000">+        char *sql;</span>
<span style="color: #00A000">+        </span>
<span style="color: #00A000">+        sql = switch_mprintf("select count(*) from sip_subscriptions where profile_name='%q' and contact_str='%q'", profile->name, contact_str);</span>
<span style="color: #00A000">+        </span>
<span style="color: #00A000">+        sofia_glue_execute_sql2str(profile, profile->ireg_mutex, sql, buf, sizeof(buf));</span>
<span style="color: #00A000">+        switch_safe_free(sql);</span>
<span style="color: #00A000">+        return atoi(buf);                                </span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
void sofia_presence_handle_sip_i_publish(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip,
                                                                                 tagi_t tags[])
{
<span style="color: #800080; font-weight: bold">@@ -2584,7 +2597,7 @@ void sofia_presence_handle_sip_i_publish(nua_t *nua, sofia_profile_t *profile, n</span>
        char expstr[30] = "";
        long exp = 0, exp_delta = 3600;
        char *pd_dup = NULL;
<span style="color: #A00000">-        int count = 1;</span>
<span style="color: #00A000">+        int count = 1, sub_count = 0;</span>
        char *contact_str;
        int open = 1;
<span style="color: #800080; font-weight: bold">@@ -2667,24 +2680,25 @@ void sofia_presence_handle_sip_i_publish(nua_t *nua, sofia_profile_t *profile, n</span>
                                count = sofia_reg_reg_count(profile, from_user, from_host);
                        }
                                
<span style="color: #00A000">+                        sub_count = sofia_presence_contact_count(profile, contact_str);</span>
                        /* if (count > 1) let's not and say we did or all the clients who subscribe to their own presence will think they selves is offline */
                        event_type = sip_header_as_string(profile->home, (void *) sip->sip_event);
                        if (count < 2) {
<span style="color: #A00000">-                                if ((sql =</span>
<span style="color: #A00000">-                                         switch_mprintf("delete from sip_presence where sip_user='%q' and sip_host='%q' "</span>
<span style="color: #A00000">-                                                                        " and profile_name='%q' and hostname='%q'", from_user, from_host, profile->name, mod_sofia_globals.hostname))) {</span>
<span style="color: #00A000">+                                if ((sql = switch_mprintf("delete from sip_presence where sip_user='%q' and sip_host='%q' "</span>
<span style="color: #00A000">+                                                                                 " and profile_name='%q' and hostname='%q'", </span>
<span style="color: #00A000">+                                                                                 from_user, from_host, profile->name, mod_sofia_globals.hostname))) {</span>
                                        sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
                                }
                                        
<span style="color: #A00000">-                                if ((sql =</span>
<span style="color: #A00000">-                                         switch_mprintf("insert into sip_presence (sip_user, sip_host, status, rpid, expires, user_agent,"</span>
<span style="color: #A00000">-                                                                        " profile_name, hostname, open_closed) "</span>
<span style="color: #A00000">-                                                                        "values ('%q','%q','%q','%q',%ld,'%q','%q','%q','%q')",</span>
<span style="color: #A00000">-                                                                        from_user, from_host, note_txt, rpid, exp, full_agent, profile->name, mod_sofia_globals.hostname, open_closed))) {</span>
<span style="color: #A00000">-                                                </span>
<span style="color: #00A000">+                                if (sub_count > 0 && (sql = switch_mprintf("insert into sip_presence (sip_user, sip_host, status, rpid, expires, user_agent,"</span>
<span style="color: #00A000">+                                                                                                                 " profile_name, hostname, open_closed) "</span>
<span style="color: #00A000">+                                                                                                                 "values ('%q','%q','%q','%q',%ld,'%q','%q','%q','%q')",</span>
<span style="color: #00A000">+                                                                                                                 from_user, from_host, note_txt, rpid, exp, full_agent, profile->name, </span>
<span style="color: #00A000">+                                                                                                                 mod_sofia_globals.hostname, open_closed))) {</span>
<span style="color: #00A000">+                                        </span>
                                        sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
                                }
                                
<span style="color: #800080; font-weight: bold">@@ -2696,16 +2710,17 @@ void sofia_presence_handle_sip_i_publish(nua_t *nua, sofia_profile_t *profile, n</span>
                                switch_safe_free(sql);
                        }
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                        if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {</span>
<span style="color: #A00000">-                                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", SOFIA_CHAT_PROTO);</span>
<span style="color: #A00000">-                                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "rpid", rpid);</span>
<span style="color: #A00000">-                                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", profile->url);</span>
<span style="color: #A00000">-                                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "user-agent", full_agent);</span>
<span style="color: #A00000">-                                switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", from_user, from_host);</span>
<span style="color: #A00000">-                                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "status", note_txt);</span>
<span style="color: #A00000">-                                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "event_type", event_type);</span>
<span style="color: #A00000">-                                switch_event_fire(&event);</span>
<span style="color: #00A000">+                        if (sub_count > 0) {</span>
<span style="color: #00A000">+                                if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {</span>
<span style="color: #00A000">+                                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", SOFIA_CHAT_PROTO);</span>
<span style="color: #00A000">+                                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "rpid", rpid);</span>
<span style="color: #00A000">+                                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", profile->url);</span>
<span style="color: #00A000">+                                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "user-agent", full_agent);</span>
<span style="color: #00A000">+                                        switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", from_user, from_host);</span>
<span style="color: #00A000">+                                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "status", note_txt);</span>
<span style="color: #00A000">+                                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "event_type", event_type);</span>
<span style="color: #00A000">+                                        switch_event_fire(&event);</span>
<span style="color: #00A000">+                                }</span>
                        }
                        if (event_type) {
<span style="color: #800080; font-weight: bold">@@ -2728,7 +2743,12 @@ void sofia_presence_handle_sip_i_publish(nua_t *nua, sofia_profile_t *profile, n</span>
        switch_snprintf(expstr, sizeof(expstr), "%d", exp_delta);
        switch_stun_random_string(etag, 8, NULL);
<span style="color: #A00000">-        nua_respond(nh, SIP_200_OK, NUTAG_WITH_THIS(nua), SIPTAG_ETAG_STR(etag), SIPTAG_EXPIRES_STR(expstr), TAG_END());</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if (sub_count > 0) {</span>
<span style="color: #00A000">+                nua_respond(nh, SIP_200_OK, NUTAG_WITH_THIS(nua), SIPTAG_ETAG_STR(etag), SIPTAG_EXPIRES_STR(expstr), TAG_END());</span>
<span style="color: #00A000">+        } else {</span>
<span style="color: #00A000">+                nua_respond(nh, SIP_404_NOT_FOUND, NUTAG_WITH_THIS(nua), TAG_END());</span>
<span style="color: #00A000">+        }</span>
        switch_safe_free(contact_str);
}
</pre></div>
<div class="highlight"><pre>committer: Anthony Minessale
comments:
fix possible bad pointer in global vars (please test)
<span style="color: #000080; font-weight: bold">diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c</span>
<span style="color: #000080; font-weight: bold">index 970cb5b..2ef21cc 100755</span>
<span style="color: #A00000">--- a/libs/freetdm/mod_freetdm/mod_freetdm.c</span>
<span style="color: #00A000">+++ b/libs/freetdm/mod_freetdm/mod_freetdm.c</span>
<span style="color: #800080; font-weight: bold">@@ -1067,9 +1067,16 @@ static const char* channel_get_variable(switch_core_session_t *session, switch_e</span>
return variable;
}
}
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+         // This is unsafe, I don't see anywhere in the whole code where this is called with NULL session anyway.</span>
<span style="color: #00A000">+         // There is a new switch_core_get_variable_dup that will strdup it for you and then you must free it.</span>
<span style="color: #00A000">+         // That messes up the abstraction completely so I am just commenting it out for you.....</span>
<span style="color: #00A000">+         /*</span>
if ((variable = switch_core_get_variable(variable_name))) {
return variable;
}
<span style="color: #00A000">+         */</span>
return NULL;
}
<span style="color: #000080; font-weight: bold">diff --git a/libs/openzap/mod_openzap/mod_openzap.c b/libs/openzap/mod_openzap/mod_openzap.c</span>
<span style="color: #000080; font-weight: bold">index d52149c..ef346b8 100644</span>
<span style="color: #A00000">--- a/libs/openzap/mod_openzap/mod_openzap.c</span>
<span style="color: #00A000">+++ b/libs/openzap/mod_openzap/mod_openzap.c</span>
<span style="color: #800080; font-weight: bold">@@ -1234,19 +1234,19 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi</span>
                zap_set_string(caller_data.ani.digits, dest);
        }
        
<span style="color: #A00000">-        if ((var = switch_event_get_header(var_event, "openzap_outbound_ton")) || (var = switch_core_get_variable("openzap_outbound_ton"))) {</span>
<span style="color: #00A000">+        if ((var = switch_event_get_header(var_event, "openzap_outbound_ton"))) {</span>
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Setting TON to: %s\n", var);
                zap_set_ton(var, &caller_data.ani.type);
        } else {
                caller_data.ani.type = outbound_profile->destination_number_ton;
        }
<span style="color: #A00000">-        if ((var = switch_event_get_header(var_event, "openzap_custom_call_data")) || (var = switch_core_get_variable("openzap_custom_call_data"))) {</span>
<span style="color: #00A000">+        if ((var = switch_event_get_header(var_event, "openzap_custom_call_data"))) {</span>
                zap_set_string((char *)caller_data.raw_data, var);
                caller_data.raw_data_len = strlen(var);
        }
        
<span style="color: #A00000">-        if ((var = switch_event_get_header(var_event, "openzap_outbound_npi")) || (var = switch_core_get_variable("openzap_outbound_npi"))) {</span>
<span style="color: #00A000">+        if ((var = switch_event_get_header(var_event, "openzap_outbound_npi"))) {</span>
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Setting NPI to: %s\n", var);
                zap_set_npi(var, &caller_data.ani.plan);
        } else {
</pre></div>
<div class="highlight"><pre>committer: Anthony Minessale
comments:
fix possible bad pointer in global vars (please test)
<span style="color: #000080; font-weight: bold">diff --git a/src/include/private/switch_core_pvt.h b/src/include/private/switch_core_pvt.h</span>
<span style="color: #000080; font-weight: bold">index 30690b1..05cd24d 100644</span>
<span style="color: #A00000">--- a/src/include/private/switch_core_pvt.h</span>
<span style="color: #00A000">+++ b/src/include/private/switch_core_pvt.h</span>
<span style="color: #800080; font-weight: bold">@@ -246,6 +246,7 @@ struct switch_runtime {</span>
        int sql_buffer_len;
        int max_sql_buffer_len;
        switch_dbtype_t odbc_dbtype;
<span style="color: #00A000">+        char hostname[256];</span>
};
extern struct switch_runtime runtime;
<span style="color: #000080; font-weight: bold">diff --git a/src/include/switch_core.h b/src/include/switch_core.h</span>
<span style="color: #000080; font-weight: bold">index 109a169..69b0642 100644</span>
<span style="color: #A00000">--- a/src/include/switch_core.h</span>
<span style="color: #00A000">+++ b/src/include/switch_core.h</span>
<span style="color: #800080; font-weight: bold">@@ -759,6 +759,9 @@ SWITCH_DECLARE(switch_core_session_t *) switch_core_session_force_locate(_In_z_</span>
\return the value of the desired variable
*/
SWITCH_DECLARE(char *) switch_core_get_variable(_In_z_ const char *varname);
<span style="color: #00A000">+SWITCH_DECLARE(char *) switch_core_get_variable_dup(_In_z_ const char *varname);</span>
<span style="color: #00A000">+SWITCH_DECLARE(char *) switch_core_get_variable_pdup(_In_z_ const char *varname, switch_memory_pool_t *pool);</span>
<span style="color: #00A000">+SWITCH_DECLARE(const char *) switch_core_get_hostname(void);</span>
/*!
\brief Add a global variable to the core
<span style="color: #000080; font-weight: bold">diff --git a/src/include/switch_nat.h b/src/include/switch_nat.h</span>
<span style="color: #000080; font-weight: bold">index bdbd51b..9e40546 100644</span>
<span style="color: #A00000">--- a/src/include/switch_nat.h</span>
<span style="color: #00A000">+++ b/src/include/switch_nat.h</span>
<span style="color: #800080; font-weight: bold">@@ -49,7 +49,7 @@ typedef enum {</span>
        SWITCH_NAT_TCP
} switch_nat_ip_proto_t;
<span style="color: #A00000">-</span>
<span style="color: #00A000">+SWITCH_DECLARE(const char *) switch_nat_get_type(void);</span>
/*!
\brief Initilize the NAT Traversal System
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c</span>
<span style="color: #000080; font-weight: bold">index 7771b09..807770a 100644</span>
<span style="color: #A00000">--- a/src/mod/applications/mod_commands/mod_commands.c</span>
<span style="color: #00A000">+++ b/src/mod/applications/mod_commands/mod_commands.c</span>
<span style="color: #800080; font-weight: bold">@@ -349,7 +349,7 @@ SWITCH_STANDARD_API(timer_test_function)</span>
SWITCH_STANDARD_API(group_call_function)
{
<span style="color: #A00000">-        char *domain;</span>
<span style="color: #00A000">+        char *domain, *dup_domain = NULL;</span>
        char *group_name = NULL;
        char *flags;
        int ok = 0;
<span style="color: #800080; font-weight: bold">@@ -392,7 +392,9 @@ SWITCH_STANDARD_API(group_call_function)</span>
        if (domain) {
                *domain++ = '\0';
        } else {
<span style="color: #A00000">-                domain = switch_core_get_variable("domain");</span>
<span style="color: #00A000">+                if ((dup_domain = switch_core_get_variable_dup("domain"))) {</span>
<span style="color: #00A000">+                        domain = dup_domain;</span>
<span style="color: #00A000">+                }</span>
        }
        if (!zstr(domain)) {
<span style="color: #800080; font-weight: bold">@@ -544,13 +546,14 @@ SWITCH_STANDARD_API(group_call_function)</span>
        }
end:
<span style="color: #A00000">-</span>
<span style="color: #00A000">+        </span>
        switch_safe_free(group_name);
<span style="color: #00A000">+        switch_safe_free(dup_domain);</span>
        if (!ok) {
                stream->write_function(stream, "error/NO_ROUTE_DESTINATION");
        }
<span style="color: #A00000">-</span>
<span style="color: #00A000">+        </span>
        return SWITCH_STATUS_SUCCESS;
}
<span style="color: #800080; font-weight: bold">@@ -559,7 +562,7 @@ SWITCH_STANDARD_API(in_group_function)</span>
{
        switch_xml_t x_domain, xml = NULL, x_user = NULL, x_group;
        int argc;
<span style="color: #A00000">-        char *mydata = NULL, *argv[2], *user, *domain;</span>
<span style="color: #00A000">+        char *mydata = NULL, *argv[2], *user, *domain, *dup_domain = NULL;</span>
        char delim = ',';
        switch_event_t *params = NULL;
        const char *rval = "false";
<span style="color: #800080; font-weight: bold">@@ -579,7 +582,9 @@ SWITCH_STANDARD_API(in_group_function)</span>
        if ((domain = strchr(user, '@'))) {
                *domain++ = '\0';
        } else {
<span style="color: #A00000">-                domain = switch_core_get_variable("domain");</span>
<span style="color: #00A000">+                if ((dup_domain = switch_core_get_variable_dup("domain"))) {</span>
<span style="color: #00A000">+                        domain = dup_domain;</span>
<span style="color: #00A000">+                }</span>
        }
        switch_event_create(&params, SWITCH_EVENT_REQUEST_PARAMS);
<span style="color: #800080; font-weight: bold">@@ -601,6 +606,7 @@ SWITCH_STANDARD_API(in_group_function)</span>
        switch_xml_free(xml);
        switch_safe_free(mydata);
<span style="color: #00A000">+        switch_safe_free(dup_domain);</span>
        switch_event_destroy(&params);
        return SWITCH_STATUS_SUCCESS;
<span style="color: #800080; font-weight: bold">@@ -610,7 +616,7 @@ SWITCH_STANDARD_API(user_data_function)</span>
{
        switch_xml_t x_domain, xml = NULL, x_user = NULL, x_group = NULL, x_param, x_params;
        int argc;
<span style="color: #A00000">-        char *mydata = NULL, *argv[3], *key = NULL, *type = NULL, *user, *domain;</span>
<span style="color: #00A000">+        char *mydata = NULL, *argv[3], *key = NULL, *type = NULL, *user, *domain, *dup_domain = NULL;</span>
        char delim = ' ';
        const char *container = "params", *elem = "param";
        const char *result = NULL;
<span style="color: #800080; font-weight: bold">@@ -631,7 +637,9 @@ SWITCH_STANDARD_API(user_data_function)</span>
        if ((domain = strchr(user, '@'))) {
                *domain++ = '\0';
        } else {
<span style="color: #A00000">-                if (!(domain = switch_core_get_variable("domain"))) {</span>
<span style="color: #00A000">+                if ((dup_domain = switch_core_get_variable("domain"))) {</span>
<span style="color: #00A000">+                        domain = dup_domain;</span>
<span style="color: #00A000">+                } else {</span>
                        domain = "cluecon.com";
                }
        }
<span style="color: #800080; font-weight: bold">@@ -694,6 +702,7 @@ SWITCH_STANDARD_API(user_data_function)</span>
        }
        switch_xml_free(xml);
        switch_safe_free(mydata);
<span style="color: #00A000">+        switch_safe_free(dup_domain);</span>
        switch_event_destroy(&params);
        return SWITCH_STATUS_SUCCESS;
<span style="color: #800080; font-weight: bold">@@ -4375,7 +4384,9 @@ SWITCH_STANDARD_API(global_getvar_function)</span>
        if (zstr(cmd)) {
                switch_core_dump_variables(stream);
        } else {
<span style="color: #A00000">-                stream->write_function(stream, "%s", switch_str_nil(switch_core_get_variable(cmd)));</span>
<span style="color: #00A000">+                char *var = switch_core_get_variable_dup(cmd);</span>
<span style="color: #00A000">+                stream->write_function(stream, "%s", switch_str_nil(var));</span>
<span style="color: #00A000">+                switch_safe_free(var);</span>
        }
        return SWITCH_STATUS_SUCCESS;
}
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c</span>
<span style="color: #000080; font-weight: bold">index 928a9b8..4be2a64 100755</span>
<span style="color: #A00000">--- a/src/mod/applications/mod_dptools/mod_dptools.c</span>
<span style="color: #00A000">+++ b/src/mod/applications/mod_dptools/mod_dptools.c</span>
<span style="color: #800080; font-weight: bold">@@ -2787,7 +2787,7 @@ static switch_call_cause_t group_outgoing_channel(switch_core_session_t *session</span>
        if ((domain = strchr(group, '@'))) {
                *domain++ = '\0';
        } else {
<span style="color: #A00000">-                domain = switch_core_get_variable("domain");</span>
<span style="color: #00A000">+                domain = switch_core_get_variable_pdup("domain", switch_core_session_get_pool(session));</span>
        }
        if (!domain) {
<span style="color: #800080; font-weight: bold">@@ -2908,7 +2908,7 @@ static switch_call_cause_t user_outgoing_channel(switch_core_session_t *session,</span>
        if ((domain = strchr(user, '@'))) {
                *domain++ = '\0';
        } else {
<span style="color: #A00000">-                domain = switch_core_get_variable("domain");</span>
<span style="color: #00A000">+                domain = switch_core_get_variable_pdup("domain", switch_core_session_get_pool(session));</span>
        }
        if (!domain) {
<span style="color: #800080; font-weight: bold">@@ -3193,10 +3193,11 @@ static switch_status_t event_chat_send(const char *proto, const char *from, cons</span>
                if (body)
                        switch_event_add_body(event, "%s", body);
                if (to) {
<span style="color: #A00000">-                        const char *v;</span>
<span style="color: #00A000">+                        char *v;</span>
                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "To", to);
<span style="color: #A00000">-                        if ((v = switch_core_get_variable(to))) {</span>
<span style="color: #00A000">+                        if ((v = switch_core_get_variable_dup(to))) {</span>
                                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Command", v);
<span style="color: #00A000">+                                free(v);</span>
                        }
                }
<span style="color: #800080; font-weight: bold">@@ -3214,15 +3215,15 @@ static switch_status_t api_chat_send(const char *proto, const char *from, const</span>
                                                                         const char *body, const char *type, const char *hint)
{
        if (to) {
<span style="color: #A00000">-                const char *v;</span>
<span style="color: #00A000">+                char *v = NULL;</span>
                switch_stream_handle_t stream = { 0 };
                char *cmd = NULL, *arg;
<span style="color: #A00000">-                if (!(v = switch_core_get_variable(to))) {</span>
<span style="color: #A00000">-                        v = to;</span>
<span style="color: #00A000">+                if (!(v = switch_core_get_variable_dup(to))) {</span>
<span style="color: #00A000">+                        v = strdup(to);</span>
                }
<span style="color: #A00000">-                cmd = strdup(v);</span>
<span style="color: #00A000">+                cmd = v;</span>
                switch_assert(cmd);
                switch_url_decode(cmd);
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/applications/mod_redis/mod_redis.c b/src/mod/applications/mod_redis/mod_redis.c</span>
<span style="color: #000080; font-weight: bold">index 1e99967..ebf2a9e 100755</span>
<span style="color: #A00000">--- a/src/mod/applications/mod_redis/mod_redis.c</span>
<span style="color: #00A000">+++ b/src/mod/applications/mod_redis/mod_redis.c</span>
<span style="color: #800080; font-weight: bold">@@ -89,7 +89,7 @@ SWITCH_LIMIT_INCR(limit_incr_redis)</span>
        }
        
        /* Get the keys for redis server */
<span style="color: #A00000">-        uuid_rediskey = switch_core_session_sprintf(session,"%s_%s_%s", switch_core_get_variable("hostname"), realm, resource);</span>
<span style="color: #00A000">+        uuid_rediskey = switch_core_session_sprintf(session,"%s_%s_%s", switch_core_get_hostname(), realm, resource);</span>
        rediskey = switch_core_session_sprintf(session, "%s_%s", realm, resource);
        if ((pvt = switch_channel_get_private(channel, "limit_redis"))) {
<span style="color: #800080; font-weight: bold">@@ -179,7 +179,7 @@ SWITCH_LIMIT_RELEASE(limit_release_redis)</span>
                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Couldn't decrement value corresponding to %s\n", (char *)p_key);
                                switch_goto_status(SWITCH_STATUS_FALSE, end);
                        }
<span style="color: #A00000">-                         p_uuid_key = switch_core_session_sprintf(session, "%s_%s", switch_core_get_variable("hostname"), (char *)p_key);</span>
<span style="color: #00A000">+                         p_uuid_key = switch_core_session_sprintf(session, "%s_%s", switch_core_get_hostname(), (char *)p_key);</span>
                        if (credis_decr(redis,p_uuid_key,&uuid_val) != 0) {
                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Couldn't decrement value corresponding to %s\n", p_uuid_key);
                                switch_goto_status(SWITCH_STATUS_FALSE, end);
<span style="color: #800080; font-weight: bold">@@ -193,7 +193,7 @@ SWITCH_LIMIT_RELEASE(limit_release_redis)</span>
        
        } else {        
                 rediskey = switch_core_session_sprintf(session, "%s_%s", realm, resource);
<span style="color: #A00000">-                uuid_rediskey = switch_core_session_sprintf(session, "%s_%s_%s", switch_core_get_variable("hostname"), realm, resource);</span>
<span style="color: #00A000">+                uuid_rediskey = switch_core_session_sprintf(session, "%s_%s_%s", switch_core_get_hostname(), realm, resource);</span>
                switch_core_hash_delete(pvt->hash, (const char *) rediskey);
                if (credis_decr(redis, rediskey, &val) != 0) {
<span style="color: #800080; font-weight: bold">@@ -249,13 +249,13 @@ SWITCH_LIMIT_RESET(limit_reset_redis)</span>
{
        REDIS redis;
        if (redis_factory(&redis) == SWITCH_STATUS_SUCCESS) {
<span style="color: #A00000">-                char *rediskey = switch_mprintf("%s_*", switch_core_get_variable("hostname"));</span>
<span style="color: #00A000">+                char *rediskey = switch_mprintf("%s_*", switch_core_get_hostname());</span>
                int dec = 0, val = 0, keyc;
                char *uuids[2000];
        
                if ((keyc = credis_keys(redis, rediskey, uuids, switch_arraylen(uuids))) > 0) {
                        int i = 0;
<span style="color: #A00000">-                        int hostnamelen = strlen(switch_core_get_variable("hostname"))+1;</span>
<span style="color: #00A000">+                        int hostnamelen = strlen(switch_core_get_hostname())+1;</span>
                        
                        for (i = 0; i < keyc && uuids[i]; i++){
                                const char *key = uuids[i] + hostnamelen;
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c</span>
<span style="color: #000080; font-weight: bold">index 76870f7..80b011e 100644</span>
<span style="color: #A00000">--- a/src/mod/applications/mod_voicemail/mod_voicemail.c</span>
<span style="color: #00A000">+++ b/src/mod/applications/mod_voicemail/mod_voicemail.c</span>
<span style="color: #800080; font-weight: bold">@@ -2734,6 +2734,7 @@ static switch_status_t voicemail_inject(const char *data, switch_core_session_t</span>
        switch_memory_pool_t *pool = NULL;
        char *forwarded_by = NULL;
        char *read_flags = NORMAL_FLAG_STRING;
<span style="color: #00A000">+        char *dup_domain = NULL;</span>
        
        if (zstr(data)) {
                status = SWITCH_STATUS_FALSE;
<span style="color: #800080; font-weight: bold">@@ -2781,7 +2782,9 @@ static switch_status_t voicemail_inject(const char *data, switch_core_session_t</span>
        }
        if (zstr(domain)) {
<span style="color: #A00000">-                domain = switch_core_get_variable("domain");</span>
<span style="color: #00A000">+                if ((dup_domain = switch_core_get_variable_dup("domain"))) {</span>
<span style="color: #00A000">+                        domain = dup_domain;</span>
<span style="color: #00A000">+                }</span>
                profile_name = domain;
        }
<span style="color: #800080; font-weight: bold">@@ -2915,6 +2918,7 @@ static switch_status_t voicemail_inject(const char *data, switch_core_session_t</span>
end:
        switch_safe_free(dup);
<span style="color: #00A000">+        switch_safe_free(dup_domain);</span>
        return status;
}
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/dialplans/mod_dialplan_asterisk/mod_dialplan_asterisk.c b/src/mod/dialplans/mod_dialplan_asterisk/mod_dialplan_asterisk.c</span>
<span style="color: #000080; font-weight: bold">index 5869d14..43534da 100644</span>
<span style="color: #A00000">--- a/src/mod/dialplans/mod_dialplan_asterisk/mod_dialplan_asterisk.c</span>
<span style="color: #00A000">+++ b/src/mod/dialplans/mod_dialplan_asterisk/mod_dialplan_asterisk.c</span>
<span style="color: #800080; font-weight: bold">@@ -313,7 +313,7 @@ static switch_call_cause_t sip_outgoing_channel(switch_core_session_t *session,</span>
        if (session) {
                profile = switch_channel_get_variable(switch_core_session_get_channel(session), "sip_profile");
        } else {
<span style="color: #A00000">-                profile = switch_core_get_variable("sip_profile");</span>
<span style="color: #00A000">+                profile = switch_core_get_variable_pdup("sip_profile", switch_core_session_get_pool(session));</span>
        }
        if (zstr(profile)) {
                profile = "default";
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/endpoints/mod_dingaling/mod_dingaling.c b/src/mod/endpoints/mod_dingaling/mod_dingaling.c</span>
<span style="color: #000080; font-weight: bold">index 66f62b2..9fb1f39 100644</span>
<span style="color: #A00000">--- a/src/mod/endpoints/mod_dingaling/mod_dingaling.c</span>
<span style="color: #00A000">+++ b/src/mod/endpoints/mod_dingaling/mod_dingaling.c</span>
<span style="color: #800080; font-weight: bold">@@ -2049,7 +2049,7 @@ static void set_profile_val(mdl_profile_t *profile, char *var, char *val)</span>
        } else if (!strcasecmp(var, "ext-rtp-ip")) {
                char *ip = globals.guess_ip;
                if (val && !strcasecmp(val, "auto-nat")) {
<span style="color: #A00000">-                        ip = globals.auto_nat ? switch_core_get_variable("nat_public_addr") : globals.guess_ip;</span>
<span style="color: #00A000">+                        ip = globals.auto_nat ? switch_core_get_variable_pdup("nat_public_addr", module_pool) : globals.guess_ip;</span>
                } else if (val && !strcasecmp(val, "auto")) {
                        globals.auto_nat = 0;
                        ip = globals.guess_ip;
<span style="color: #800080; font-weight: bold">@@ -2523,7 +2523,7 @@ static switch_status_t load_config(void)</span>
        memset(&globals, 0, sizeof(globals));
        globals.running = 1;
<span style="color: #A00000">-        globals.auto_nat = (switch_core_get_variable("nat_type") ? 1 : 0);</span>
<span style="color: #00A000">+        globals.auto_nat = (switch_nat_get_type() ? 1 : 0);</span>
        switch_find_local_ip(globals.guess_ip, sizeof(globals.guess_ip), NULL, AF_INET);
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/endpoints/mod_khomp/src/khomp_pvt.cpp b/src/mod/endpoints/mod_khomp/src/khomp_pvt.cpp</span>
<span style="color: #000080; font-weight: bold">index 1b126eb..15009f2 100644</span>
<span style="color: #A00000">--- a/src/mod/endpoints/mod_khomp/src/khomp_pvt.cpp</span>
<span style="color: #00A000">+++ b/src/mod/endpoints/mod_khomp/src/khomp_pvt.cpp</span>
<span style="color: #800080; font-weight: bold">@@ -1625,9 +1625,10 @@ bool Board::KhompPvt::setCollectCall()</span>
DBG(FUNC, PVT_FMT(_target, "option drop collect call is '%s'") % (Opt::_options._drop_collect_call() ? "yes" : "no"));
// get global filter configuration value
<span style="color: #A00000">- tmp_var = switch_core_get_variable("KDropCollectCall");</span>
<span style="color: #00A000">+ tmp_var = switch_core_get_variable_dup("KDropCollectCall");</span>
confvalues.push_back(getTriStateValue(tmp_var));
DBG(FUNC, PVT_FMT(_target, "global KDropCollectCall was '%s'") % (tmp_var ? tmp_var : "(empty)"));
<span style="color: #00A000">+        switch_safe_free(tmp_var);</span>
try
{
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c</span>
<span style="color: #000080; font-weight: bold">index 8bceb3b..c78aac7 100644</span>
<span style="color: #A00000">--- a/src/mod/endpoints/mod_sofia/mod_sofia.c</span>
<span style="color: #00A000">+++ b/src/mod/endpoints/mod_sofia/mod_sofia.c</span>
<span style="color: #800080; font-weight: bold">@@ -3501,7 +3501,7 @@ SWITCH_STANDARD_API(sofia_contact_function)</span>
        }
        if (zstr(domain)) {
<span style="color: #A00000">-                domain = switch_core_get_variable("domain");</span>
<span style="color: #00A000">+                domain = switch_core_get_variable_pdup("domain", switch_core_session_get_pool(session));</span>
        }
        if (!user) goto end;
<span style="color: #800080; font-weight: bold">@@ -4776,7 +4776,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load)</span>
        mod_sofia_globals.running = 1;
        switch_mutex_unlock(mod_sofia_globals.mutex);
<span style="color: #A00000">-        mod_sofia_globals.auto_nat = (switch_core_get_variable("nat_type") ? 1 : 0);</span>
<span style="color: #00A000">+        mod_sofia_globals.auto_nat = (switch_nat_get_type() ? 1 : 0);</span>
        switch_queue_create(&mod_sofia_globals.presence_queue, SOFIA_QUEUE_SIZE, mod_sofia_globals.pool);
        switch_queue_create(&mod_sofia_globals.mwi_queue, SOFIA_QUEUE_SIZE, mod_sofia_globals.pool);
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c</span>
<span style="color: #000080; font-weight: bold">index 47f94b1..825d1bf 100644</span>
<span style="color: #A00000">--- a/src/mod/endpoints/mod_sofia/sofia.c</span>
<span style="color: #00A000">+++ b/src/mod/endpoints/mod_sofia/sofia.c</span>
<span style="color: #800080; font-weight: bold">@@ -1459,7 +1459,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void</span>
        supported = switch_core_sprintf(profile->pool, "%s%sprecondition, path, replaces", use_100rel ? "100rel, " : "", use_timer ? "timer, " : "");
<span style="color: #A00000">-        if (sofia_test_pflag(profile, PFLAG_AUTO_NAT) && switch_core_get_variable("nat_type")) {</span>
<span style="color: #00A000">+        if (sofia_test_pflag(profile, PFLAG_AUTO_NAT) && switch_nat_get_type()) {</span>
                if (switch_nat_add_mapping(profile->sip_port, SWITCH_NAT_UDP, NULL, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Created UDP nat mapping for %s port %d\n", profile->name, profile->sip_port);
                }
<span style="color: #800080; font-weight: bold">@@ -1676,7 +1676,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void</span>
                switch_event_fire(&s_event);
        }
<span style="color: #A00000">-        if (sofia_test_pflag(profile, PFLAG_AUTO_NAT) && switch_core_get_variable("nat_type")) {</span>
<span style="color: #00A000">+        if (sofia_test_pflag(profile, PFLAG_AUTO_NAT) && switch_nat_get_type()) {</span>
                if (switch_nat_del_mapping(profile->sip_port, SWITCH_NAT_UDP) == SWITCH_STATUS_SUCCESS) {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Deleted UDP nat mapping for %s port %d\n", profile->name, profile->sip_port);
                }
<span style="color: #800080; font-weight: bold">@@ -3741,9 +3741,9 @@ switch_status_t config_sofia(int reload, char *profile_name)</span>
                                if (!profile->rtpip[0]) {
                                        profile->rtpip[profile->rtpip_index++] = switch_core_strdup(profile->pool, mod_sofia_globals.guess_ip);
                                }
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                                if (switch_core_get_variable("nat_type")) {</span>
<span style="color: #A00000">-                                        const char *ip = switch_core_get_variable("nat_public_addr");</span>
<span style="color: #00A000">+                                </span>
<span style="color: #00A000">+                                if (switch_nat_get_type()) {</span>
<span style="color: #00A000">+                                        char *ip = switch_core_get_variable_dup("nat_public_addr");</span>
                                        if (ip && !strchr(profile->sipip, ':')) {
                                                if (!profile->extrtpip) {
                                                        profile->extrtpip = switch_core_strdup(profile->pool, ip);
<span style="color: #800080; font-weight: bold">@@ -3754,6 +3754,7 @@ switch_status_t config_sofia(int reload, char *profile_name)</span>
                                                sofia_set_pflag(profile, PFLAG_AUTO_NAT);
                                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "NAT detected setting external ip to %s\n", ip);
                                        }
<span style="color: #00A000">+                                        switch_safe_free(ip);</span>
                                }
                                if (profile->nonce_ttl < 60) {
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c</span>
<span style="color: #000080; font-weight: bold">index f3a2c92..1462e4e 100644</span>
<span style="color: #A00000">--- a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c</span>
<span style="color: #00A000">+++ b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c</span>
<span style="color: #800080; font-weight: bold">@@ -2642,7 +2642,7 @@ static int config(void)</span>
                                } else if (!strcmp(var, "debug")) {
                                        globals.debug = atoi(val);
                                } else if (!strcmp(var, "nat-map")) {
<span style="color: #A00000">-                                        if (switch_true(val) && switch_core_get_variable("nat_type")) {</span>
<span style="color: #00A000">+                                        if (switch_true(val) && switch_nat_get_type()) {</span>
                                                prefs.nat_map = 1;
                                        }
                                } else if (!strcmp(var, "listen-port")) {
<span style="color: #800080; font-weight: bold">@@ -2795,7 +2795,7 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_event_socket_runtime)</span>
        close_socket(&listen_list.sock);
<span style="color: #A00000">-        if (prefs.nat_map && switch_core_get_variable("nat_type")) {</span>
<span style="color: #00A000">+        if (prefs.nat_map && switch_nat_get_type()) {</span>
                switch_nat_del_mapping(prefs.port, SWITCH_NAT_TCP);
        }
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/formats/mod_file_string/mod_file_string.c b/src/mod/formats/mod_file_string/mod_file_string.c</span>
<span style="color: #000080; font-weight: bold">index ca86cbd..7e36c72 100644</span>
<span style="color: #A00000">--- a/src/mod/formats/mod_file_string/mod_file_string.c</span>
<span style="color: #00A000">+++ b/src/mod/formats/mod_file_string/mod_file_string.c</span>
<span style="color: #800080; font-weight: bold">@@ -77,7 +77,7 @@ static int next_file(switch_file_handle_t *handle)</span>
        if (!prefix) {
<span style="color: #A00000">-                if (!(prefix = switch_core_get_variable("sound_prefix"))) {</span>
<span style="color: #00A000">+                if (!(prefix = switch_core_get_variable_pdup("sound_prefix", handle->memory_pool))) {</span>
                        prefix = SWITCH_GLOBAL_dirs.sounds_dir;
                }
        }
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c b/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c</span>
<span style="color: #000080; font-weight: bold">index 9eb2636..1d6ee8d 100644</span>
<span style="color: #A00000">--- a/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c</span>
<span style="color: #00A000">+++ b/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c</span>
<span style="color: #800080; font-weight: bold">@@ -3378,8 +3378,9 @@ static JSBool js_global_get(JSContext * cx, JSObject * obj, uintN argc, jsval *</span>
        if (argc > 0) {
                var_name = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
<span style="color: #A00000">-                val = switch_core_get_variable(var_name);</span>
<span style="color: #00A000">+                val = switch_core_get_variable_dup(var_name);</span>
                *rval = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, val));
<span style="color: #00A000">+                free(val);</span>
                return JS_TRUE;
        }
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c b/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c</span>
<span style="color: #000080; font-weight: bold">index 468190d..9e61312 100644</span>
<span style="color: #A00000">--- a/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c</span>
<span style="color: #00A000">+++ b/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c</span>
<span style="color: #800080; font-weight: bold">@@ -322,6 +322,7 @@ static abyss_bool http_directory_auth(TSession * r, char *domain_name)</span>
        int at = 0;
        char *dp;
        abyss_bool rval = FALSE;
<span style="color: #00A000">+        char *dup_domain = NULL;</span>
        p = RequestHeaderValue(r, "authorization");
<span style="color: #800080; font-weight: bold">@@ -354,7 +355,9 @@ static abyss_bool http_directory_auth(TSession * r, char *domain_name)</span>
                                                if (globals.default_domain) {
                                                        domain_name = globals.default_domain;
                                                } else {
<span style="color: #A00000">-                                                        domain_name = switch_core_get_variable("domain");</span>
<span style="color: #00A000">+                                                        if ((dup_domain = switch_core_get_variable_dup("domain"))) {</span>
<span style="color: #00A000">+                                                                domain_name = dup_domain;</span>
<span style="color: #00A000">+                                                        }</span>
                                                }
                                        }
                                }
<span style="color: #800080; font-weight: bold">@@ -465,6 +468,7 @@ static abyss_bool http_directory_auth(TSession * r, char *domain_name)</span>
        switch_safe_free(mypass1);
        switch_safe_free(mypass2);
        switch_safe_free(box);
<span style="color: #00A000">+        switch_safe_free(dup_domain);</span>
        return rval;
}
<span style="color: #000080; font-weight: bold">diff --git a/src/switch_channel.c b/src/switch_channel.c</span>
<span style="color: #000080; font-weight: bold">index 70b1879..f750496 100644</span>
<span style="color: #A00000">--- a/src/switch_channel.c</span>
<span style="color: #00A000">+++ b/src/switch_channel.c</span>
<span style="color: #800080; font-weight: bold">@@ -672,7 +672,7 @@ SWITCH_DECLARE(const char *) switch_channel_get_hold_music_partner(switch_channe</span>
SWITCH_DECLARE(const char *) switch_channel_get_variable_dup(switch_channel_t *channel, const char *varname, switch_bool_t dup)
{
<span style="color: #A00000">-        const char *v = NULL, *r = NULL;</span>
<span style="color: #00A000">+        const char *v = NULL, *r = NULL, *vdup = NULL;</span>
        switch_assert(channel != NULL);
        switch_mutex_lock(channel->profile_mutex);
<span style="color: #800080; font-weight: bold">@@ -690,13 +690,16 @@ SWITCH_DECLARE(const char *) switch_channel_get_variable_dup(switch_channel_t *c</span>
                }
                if (!cp || !(v = switch_caller_get_field_by_name(cp, varname))) {
<span style="color: #A00000">-                        v = switch_core_get_variable(varname);</span>
<span style="color: #00A000">+                        if ((vdup = switch_core_get_variable_pdup(varname, switch_core_session_get_pool(channel->session)))) {</span>
<span style="color: #00A000">+                                v = vdup;</span>
<span style="color: #00A000">+                        }</span>
                }
        }
<span style="color: #A00000">-        if (dup) {</span>
<span style="color: #A00000">-                if (v)</span>
<span style="color: #00A000">+        if (dup && v != vdup) {</span>
<span style="color: #00A000">+                if (v) {</span>
                        r = switch_core_session_strdup(channel->session, v);
<span style="color: #00A000">+                }</span>
        } else {
                r = v;
        }
<span style="color: #000080; font-weight: bold">diff --git a/src/switch_console.c b/src/switch_console.c</span>
<span style="color: #000080; font-weight: bold">index 41bbb91..c5d601b 100644</span>
<span style="color: #A00000">--- a/src/switch_console.c</span>
<span style="color: #00A000">+++ b/src/switch_console.c</span>
<span style="color: #800080; font-weight: bold">@@ -643,9 +643,9 @@ SWITCH_DECLARE_NONSTD(switch_status_t) switch_console_list_uuid(const char *line</span>
        if (!zstr(cursor)) {
                sql = switch_mprintf("select distinct uuid from channels where uuid like '%q%%' and hostname='%q' order by uuid",
<span style="color: #A00000">-                                                         cursor, switch_core_get_variable("hostname"));</span>
<span style="color: #00A000">+                                                         cursor, switch_core_get_hostname());</span>
        } else {
<span style="color: #A00000">-                sql = switch_mprintf("select distinct uuid from channels where hostname='%q' order by uuid", switch_core_get_variable("hostname"));</span>
<span style="color: #00A000">+                sql = switch_mprintf("select distinct uuid from channels where hostname='%q' order by uuid", switch_core_get_hostname());</span>
        }
        switch_cache_db_execute_sql_callback(db, sql, uuid_callback, &h, &errmsg);
<span style="color: #800080; font-weight: bold">@@ -764,7 +764,7 @@ SWITCH_DECLARE(unsigned char) switch_console_complete(const char *line, const ch</span>
        if (h.words == 0) {
                sql = switch_mprintf("select distinct name from interfaces where type='api' and name like '%q%%' and hostname='%q' order by name",
<span style="color: #A00000">-                                                         buf, switch_core_get_variable("hostname"));</span>
<span style="color: #00A000">+                                                         buf, switch_core_get_hostname());</span>
        }
        if (sql) {
<span style="color: #800080; font-weight: bold">@@ -792,7 +792,7 @@ SWITCH_DECLARE(unsigned char) switch_console_complete(const char *line, const ch</span>
                if (h.words == 0) {
                        stream.write_function(&stream, "select distinct a1 from complete where " "a1 not in (select name from interfaces where hostname='%s') %s ",
<span style="color: #A00000">-                                                                 switch_core_get_variable("hostname"), argc ? "and" : "");</span>
<span style="color: #00A000">+                                                                 switch_core_get_hostname(), argc ? "and" : "");</span>
                } else {
                        if (db->type == SCDB_TYPE_CORE_DB) {
                                stream.write_function(&stream, "select distinct a%d,'%q','%q' from complete where ", h.words + 1, switch_str_nil(dup), switch_str_nil(lp));
<span style="color: #800080; font-weight: bold">@@ -821,7 +821,7 @@ SWITCH_DECLARE(unsigned char) switch_console_complete(const char *line, const ch</span>
                        }
                }
<span style="color: #A00000">-                stream.write_function(&stream, " and hostname='%s' order by a%d", switch_core_get_variable("hostname"), h.words + 1);</span>
<span style="color: #00A000">+                stream.write_function(&stream, " and hostname='%s' order by a%d", switch_core_get_hostname(), h.words + 1);</span>
                
                switch_cache_db_execute_sql_callback(db, stream.data, comp_callback, &h, &errmsg);
<span style="color: #800080; font-weight: bold">@@ -1794,7 +1794,7 @@ SWITCH_DECLARE(switch_status_t) switch_console_set_complete(const char *string)</span>
                                                }
                                        }
                                }
<span style="color: #A00000">-                                mystream.write_function(&mystream, " '%s')", switch_core_get_variable("hostname"));</span>
<span style="color: #00A000">+                                mystream.write_function(&mystream, " '%s')", switch_core_get_hostname());</span>
                                switch_cache_db_persistant_execute(db, mystream.data, 5);
                                status = SWITCH_STATUS_SUCCESS;
                        } else if (!strcasecmp(argv[0], "add")) {
<span style="color: #800080; font-weight: bold">@@ -1810,7 +1810,7 @@ SWITCH_DECLARE(switch_status_t) switch_console_set_complete(const char *string)</span>
                                                }
                                        }
                                }
<span style="color: #A00000">-                                mystream.write_function(&mystream, " '%s')", switch_core_get_variable("hostname"));</span>
<span style="color: #00A000">+                                mystream.write_function(&mystream, " '%s')", switch_core_get_hostname());</span>
                                switch_cache_db_persistant_execute(db, mystream.data, 5);
                                status = SWITCH_STATUS_SUCCESS;
<span style="color: #800080; font-weight: bold">@@ -1827,7 +1827,7 @@ SWITCH_DECLARE(switch_status_t) switch_console_set_complete(const char *string)</span>
                                                        mystream.write_function(&mystream, "a%d = '%w'%w", x + 1, switch_str_nil(argv[x + 1]), x == argc - 2 ? "" : " and ");
                                                }
                                        }
<span style="color: #A00000">-                                        mystream.write_function(&mystream, " and hostname='%s'", switch_core_get_variable("hostname"));</span>
<span style="color: #00A000">+                                        mystream.write_function(&mystream, " and hostname='%s'", switch_core_get_hostname());</span>
                                        switch_cache_db_persistant_execute(db, mystream.data, 1);
                                }
                                status = SWITCH_STATUS_SUCCESS;
<span style="color: #800080; font-weight: bold">@@ -1863,38 +1863,38 @@ SWITCH_DECLARE(switch_status_t) switch_console_set_alias(const char *string)</span>
                        }
                        
                        if (!strcasecmp(argv[0], "stickyadd") && argc == 3) {
<span style="color: #A00000">-                                sql = switch_mprintf("delete from aliases where alias='%q' and hostname='%q'", argv[1], switch_core_get_variable("hostname"));</span>
<span style="color: #00A000">+                                sql = switch_mprintf("delete from aliases where alias='%q' and hostname='%q'", argv[1], switch_core_get_hostname());</span>
                                switch_cache_db_persistant_execute(db, sql, 5);
                                switch_safe_free(sql);
                                if (db->type == SCDB_TYPE_CORE_DB) {
                                        sql = switch_mprintf("insert into aliases (sticky, alias, command, hostname) values (1, '%q','%q','%q')",
<span style="color: #A00000">-                                                                                 argv[1], argv[2], switch_core_get_variable("hostname"));</span>
<span style="color: #00A000">+                                                                                 argv[1], argv[2], switch_core_get_hostname());</span>
                                } else {
                                        sql = switch_mprintf("insert into aliases (sticky, alias, command, hostname) values (1, '%w','%w','%w')",
<span style="color: #A00000">-                                                                                 argv[1], argv[2], switch_core_get_variable("hostname"));</span>
<span style="color: #00A000">+                                                                                 argv[1], argv[2], switch_core_get_hostname());</span>
                                }
                                switch_cache_db_persistant_execute(db, sql, 5);
                                status = SWITCH_STATUS_SUCCESS;
                        } else if (!strcasecmp(argv[0], "add") && argc == 3) {
<span style="color: #A00000">-                                sql = switch_mprintf("delete from aliases where alias='%q' and hostname='%q'", argv[1], switch_core_get_variable("hostname"));</span>
<span style="color: #00A000">+                                sql = switch_mprintf("delete from aliases where alias='%q' and hostname='%q'", argv[1], switch_core_get_hostname());</span>
                                switch_cache_db_persistant_execute(db, sql, 5);
                                switch_safe_free(sql);
                                if (db->type == SCDB_TYPE_CORE_DB) {
                                        sql = switch_mprintf("insert into aliases (sticky, alias, command, hostname) values (0, '%q','%q','%q')",
<span style="color: #A00000">-                                                                                 argv[1], argv[2], switch_core_get_variable("hostname"));</span>
<span style="color: #00A000">+                                                                                 argv[1], argv[2], switch_core_get_hostname());</span>
                                } else {
                                        sql = switch_mprintf("insert into aliases (sticky, alias, command, hostname) values (0, '%w','%w','%w')",
<span style="color: #A00000">-                                                                                 argv[1], argv[2], switch_core_get_variable("hostname"));</span>
<span style="color: #00A000">+                                                                                 argv[1], argv[2], switch_core_get_hostname());</span>
                                }
                                switch_cache_db_persistant_execute(db, sql, 5);
                                status = SWITCH_STATUS_SUCCESS;
                        } else if (!strcasecmp(argv[0], "del") && argc == 2) {
                                char *what = argv[1];
                                if (!strcasecmp(what, "*")) {
<span style="color: #A00000">-                                        sql = switch_mprintf("delete from aliases where hostname='%q'", switch_core_get_variable("hostname"));</span>
<span style="color: #00A000">+                                        sql = switch_mprintf("delete from aliases where hostname='%q'", switch_core_get_hostname());</span>
                                        switch_cache_db_persistant_execute(db, sql, 1);
                                } else {
<span style="color: #A00000">-                                        sql = switch_mprintf("delete from aliases where alias='%q' and hostname='%q'", argv[1], switch_core_get_variable("hostname"));</span>
<span style="color: #00A000">+                                        sql = switch_mprintf("delete from aliases where alias='%q' and hostname='%q'", argv[1], switch_core_get_hostname());</span>
                                        switch_cache_db_persistant_execute(db, sql, 5);
                                }
                                status = SWITCH_STATUS_SUCCESS;
<span style="color: #000080; font-weight: bold">diff --git a/src/switch_core.c b/src/switch_core.c</span>
<span style="color: #000080; font-weight: bold">index 43fb36d..8754305 100644</span>
<span style="color: #A00000">--- a/src/switch_core.c</span>
<span style="color: #00A000">+++ b/src/switch_core.c</span>
<span style="color: #800080; font-weight: bold">@@ -261,6 +261,11 @@ SWITCH_DECLARE(void) switch_core_dump_variables(switch_stream_handle_t *stream)</span>
        switch_mutex_unlock(runtime.global_mutex);
}
<span style="color: #00A000">+SWITCH_DECLARE(const char *) switch_core_get_hostname(void)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        return runtime.hostname;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
SWITCH_DECLARE(char *) switch_core_get_variable(const char *varname)
{
        char *val;
<span style="color: #800080; font-weight: bold">@@ -270,6 +275,32 @@ SWITCH_DECLARE(char *) switch_core_get_variable(const char *varname)</span>
        return val;
}
<span style="color: #00A000">+SWITCH_DECLARE(char *) switch_core_get_variable_dup(const char *varname)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        char *val = NULL, *v;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        switch_mutex_lock(runtime.global_var_mutex);</span>
<span style="color: #00A000">+        if ((v = (char *) switch_event_get_header(runtime.global_vars, varname))) {</span>
<span style="color: #00A000">+                val = strdup(v);</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        switch_mutex_unlock(runtime.global_var_mutex);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return val;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+SWITCH_DECLARE(char *) switch_core_get_variable_pdup(const char *varname, switch_memory_pool_t *pool)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        char *val = NULL, *v;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        switch_mutex_lock(runtime.global_var_mutex);</span>
<span style="color: #00A000">+        if ((v = (char *) switch_event_get_header(runtime.global_vars, varname))) {</span>
<span style="color: #00A000">+                val = switch_core_strdup(pool, v);</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        switch_mutex_unlock(runtime.global_var_mutex);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return val;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
static void switch_core_unset_variables(void)
{
        switch_mutex_lock(runtime.global_var_mutex);
<span style="color: #800080; font-weight: bold">@@ -1202,12 +1233,18 @@ static void switch_core_set_serial(void)</span>
        if ((fd = open(path, O_RDONLY, 0)) < 0) {
<span style="color: #A00000">-                char *ip = switch_core_get_variable("local_ip_v4");</span>
<span style="color: #00A000">+                char *ip = switch_core_get_variable_dup("local_ip_v4");</span>
                uint32_t ipi = 0;
                switch_byte_t *byte;
                int i = 0;
<span style="color: #A00000">-                switch_inet_pton(AF_INET, ip, &ipi);</span>
<span style="color: #00A000">+                if (ip) {</span>
<span style="color: #00A000">+                        switch_inet_pton(AF_INET, ip, &ipi);</span>
<span style="color: #00A000">+                        free(ip);</span>
<span style="color: #00A000">+                        ip = NULL;</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
                byte = (switch_byte_t *) & ipi;
                for (i = 0; i < 8; i += 2) {
<span style="color: #800080; font-weight: bold">@@ -1237,7 +1274,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc</span>
        char guess_ip[256];
        int mask = 0;
        struct in_addr in;
<span style="color: #A00000">-        char hostname[256] = "";</span>
<span style="color: #00A000">+</span>
        if (runtime.runlevel > 0) {
                /* one per customer */
<span style="color: #800080; font-weight: bold">@@ -1310,8 +1347,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc</span>
                runtime.console = stdout;
        }
<span style="color: #A00000">-        gethostname(hostname, sizeof(hostname));</span>
<span style="color: #A00000">-        switch_core_set_variable("hostname", hostname);</span>
<span style="color: #00A000">+        gethostname(runtime.hostname, sizeof(runtime.hostname));</span>
<span style="color: #00A000">+        switch_core_set_variable("hostname", runtime.hostname);</span>
        switch_find_local_ip(guess_ip, sizeof(guess_ip), &mask, AF_INET);
        switch_core_set_variable("local_ip_v4", guess_ip);
<span style="color: #000080; font-weight: bold">diff --git a/src/switch_core_file.c b/src/switch_core_file.c</span>
<span style="color: #000080; font-weight: bold">index 19f2354..fc7d223 100644</span>
<span style="color: #A00000">--- a/src/switch_core_file.c</span>
<span style="color: #00A000">+++ b/src/switch_core_file.c</span>
<span style="color: #800080; font-weight: bold">@@ -102,7 +102,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_file_open(const char *file,</span>
                        }
                        if (!spool_path) {
<span style="color: #A00000">-                                spool_path = switch_core_get_variable(SWITCH_AUDIO_SPOOL_PATH_VARIABLE);</span>
<span style="color: #00A000">+                                spool_path = switch_core_get_variable_pdup(SWITCH_AUDIO_SPOOL_PATH_VARIABLE, fh->memory_pool);</span>
                        }
                        file_path = fh->file_path;
<span style="color: #000080; font-weight: bold">diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c</span>
<span style="color: #000080; font-weight: bold">index 2db2a0d..73890a1 100644</span>
<span style="color: #A00000">--- a/src/switch_core_sqldb.c</span>
<span style="color: #00A000">+++ b/src/switch_core_sqldb.c</span>
<span style="color: #800080; font-weight: bold">@@ -1134,7 +1134,7 @@ static void core_event_handler(switch_event_t *event)</span>
                                new_sql() = switch_mprintf("insert into tasks values(%q,'%q','%q',%q, '%q')",
                                                                                 id,
                                                                                 switch_event_get_header_nil(event, "task-desc"),
<span style="color: #A00000">-                                                                                 switch_event_get_header_nil(event, "task-group"), manager ? manager : "0", switch_core_get_variable("hostname")</span>
<span style="color: #00A000">+                                                                                 switch_event_get_header_nil(event, "task-group"), manager ? manager : "0", switch_core_get_hostname()</span>
                                                                                 );
                        }
                }
<span style="color: #800080; font-weight: bold">@@ -1142,7 +1142,7 @@ static void core_event_handler(switch_event_t *event)</span>
        case SWITCH_EVENT_DEL_SCHEDULE:
        case SWITCH_EVENT_EXE_SCHEDULE:
                new_sql() = switch_mprintf("delete from tasks where task_id=%q and hostname='%q'",
<span style="color: #A00000">-                                                                 switch_event_get_header_nil(event, "task-id"), switch_core_get_variable("hostname"));</span>
<span style="color: #00A000">+                                                                 switch_event_get_header_nil(event, "task-id"), switch_core_get_hostname());</span>
                break;
        case SWITCH_EVENT_RE_SCHEDULE:
                {
<span style="color: #800080; font-weight: bold">@@ -1153,7 +1153,7 @@ static void core_event_handler(switch_event_t *event)</span>
                                new_sql() = switch_mprintf("update tasks set task_desc='%q',task_group='%q', task_sql_manager=%q where task_id=%q and hostname='%q'",
                                                                                 switch_event_get_header_nil(event, "task-desc"),
                                                                                 switch_event_get_header_nil(event, "task-group"), manager ? manager : "0", id,
<span style="color: #A00000">-                                                                                 switch_core_get_variable("hostname"));</span>
<span style="color: #00A000">+                                                                                 switch_core_get_hostname());</span>
                        }
                }
                break;
<span style="color: #800080; font-weight: bold">@@ -1163,10 +1163,10 @@ static void core_event_handler(switch_event_t *event)</span>
                        
                        if (uuid) {
                                new_sql() = switch_mprintf("delete from channels where uuid='%q' and hostname='%q'",
<span style="color: #A00000">-                                                                                 uuid, switch_core_get_variable("hostname"));</span>
<span style="color: #00A000">+                                                                                 uuid, switch_core_get_hostname());</span>
                                new_sql() = switch_mprintf("delete from calls where (caller_uuid='%q' or callee_uuid='%q') and hostname='%q'",
<span style="color: #A00000">-                                                                                 uuid, uuid, switch_core_get_variable("hostname"));</span>
<span style="color: #00A000">+                                                                                 uuid, uuid, switch_core_get_hostname());</span>
                        }
                }
<span style="color: #800080; font-weight: bold">@@ -1178,12 +1178,12 @@ static void core_event_handler(switch_event_t *event)</span>
                                                                         "update calls set callee_uuid='%q' where callee_uuid='%q' and hostname='%q'",
                                                                         switch_event_get_header_nil(event, "unique-id"),
                                                                         switch_event_get_header_nil(event, "old-unique-id"),
<span style="color: #A00000">-                                                                         switch_core_get_variable("hostname"),</span>
<span style="color: #00A000">+                                                                         switch_core_get_hostname(),</span>
                                                                         switch_event_get_header_nil(event, "unique-id"),
                                                                         switch_event_get_header_nil(event, "old-unique-id"),
<span style="color: #A00000">-                                                                         switch_core_get_variable("hostname"),</span>
<span style="color: #00A000">+                                                                         switch_core_get_hostname(),</span>
                                                                         switch_event_get_header_nil(event, "unique-id"),
<span style="color: #A00000">-                                                                         switch_event_get_header_nil(event, "old-unique-id"), switch_core_get_variable("hostname")</span>
<span style="color: #00A000">+                                                                         switch_event_get_header_nil(event, "old-unique-id"), switch_core_get_hostname()</span>
                                                                         );
                        break;
                }
<span style="color: #800080; font-weight: bold">@@ -1198,7 +1198,7 @@ static void core_event_handler(switch_event_t *event)</span>
                                                                 switch_event_get_header_nil(event, "channel-state"),
                                                                 switch_event_get_header_nil(event, "channel-call-state"),
                                                                 switch_event_get_header_nil(event, "caller-dialplan"),
<span style="color: #A00000">-                                                                 switch_event_get_header_nil(event, "caller-context"), switch_core_get_variable("hostname")</span>
<span style="color: #00A000">+                                                                 switch_event_get_header_nil(event, "caller-context"), switch_core_get_hostname()</span>
                                                                 );
                break;
        case SWITCH_EVENT_CODEC:
<span style="color: #800080; font-weight: bold">@@ -1211,7 +1211,7 @@ static void core_event_handler(switch_event_t *event)</span>
                         switch_event_get_header_nil(event, "channel-write-codec-name"),
                         switch_event_get_header_nil(event, "channel-write-codec-rate"),
                         switch_event_get_header_nil(event, "channel-write-codec-bit-rate"),
<span style="color: #A00000">-                         switch_event_get_header_nil(event, "unique-id"), switch_core_get_variable("hostname"));</span>
<span style="color: #00A000">+                         switch_event_get_header_nil(event, "unique-id"), switch_core_get_hostname());</span>
                break;
        case SWITCH_EVENT_CHANNEL_HOLD:
        case SWITCH_EVENT_CHANNEL_UNHOLD:
<span style="color: #800080; font-weight: bold">@@ -1223,7 +1223,7 @@ static void core_event_handler(switch_event_t *event)</span>
                                                                 switch_event_get_header_nil(event, "application-data"),
                                                                 switch_event_get_header_nil(event, "channel-presence-id"),
                                                                 switch_event_get_header_nil(event, "channel-presence-data"),
<span style="color: #A00000">-                                                                 switch_event_get_header_nil(event, "unique-id"), switch_core_get_variable("hostname")</span>
<span style="color: #00A000">+                                                                 switch_event_get_header_nil(event, "unique-id"), switch_core_get_hostname()</span>
                                                                 );
        }
<span style="color: #800080; font-weight: bold">@@ -1238,7 +1238,7 @@ static void core_event_handler(switch_event_t *event)</span>
                                                                                 switch_event_get_header_nil(event, "channel-presence-data"),
                                                                                 switch_event_get_header_nil(event, "channel-call-uuid"),
                                                                                 extra_cols,
<span style="color: #A00000">-                                                                                 switch_event_get_header_nil(event, "unique-id"), switch_core_get_variable("hostname"));</span>
<span style="color: #00A000">+                                                                                 switch_event_get_header_nil(event, "unique-id"), switch_core_get_hostname());</span>
                                free(extra_cols);
                        } else {
                                new_sql() = switch_mprintf("update channels set "
<span style="color: #800080; font-weight: bold">@@ -1246,7 +1246,7 @@ static void core_event_handler(switch_event_t *event)</span>
                                                                                 switch_event_get_header_nil(event, "channel-presence-id"),
                                                                                 switch_event_get_header_nil(event, "channel-presence-data"),
                                                                                 switch_event_get_header_nil(event, "channel-call-uuid"),
<span style="color: #A00000">-                                                                                 switch_event_get_header_nil(event, "unique-id"), switch_core_get_variable("hostname"));</span>
<span style="color: #00A000">+                                                                                 switch_event_get_header_nil(event, "unique-id"), switch_core_get_hostname());</span>
                        }
                }
<span style="color: #800080; font-weight: bold">@@ -1281,7 +1281,7 @@ static void core_event_handler(switch_event_t *event)</span>
                                                                                 switch_str_nil(name),
                                                                                 switch_str_nil(number),
                                                                                 switch_event_get_header_nil(event, "direction"),
<span style="color: #A00000">-                                                                                 switch_event_get_header_nil(event, "unique-id"), switch_core_get_variable("hostname"));</span>
<span style="color: #00A000">+                                                                                 switch_event_get_header_nil(event, "unique-id"), switch_core_get_hostname());</span>
                                name = switch_event_get_header(event, "callee-name");
                                number = switch_event_get_header(event, "callee-number");
<span style="color: #800080; font-weight: bold">@@ -1298,7 +1298,7 @@ static void core_event_handler(switch_event_t *event)</span>
                {
                        new_sql() = switch_mprintf("update channels set callstate='%q' where uuid='%q' and hostname='%q'",
                                                                         switch_event_get_header_nil(event, "channel-call-state"),
<span style="color: #A00000">-                                                                         switch_event_get_header_nil(event, "unique-id"), switch_core_get_variable("hostname"));</span>
<span style="color: #00A000">+                                                                         switch_event_get_header_nil(event, "unique-id"), switch_core_get_hostname());</span>
                }
                break;
<span style="color: #800080; font-weight: bold">@@ -1330,7 +1330,7 @@ static void core_event_handler(switch_event_t *event)</span>
                                                                                         switch_event_get_header_nil(event, "channel-presence-id"),
                                                                                         switch_event_get_header_nil(event, "channel-presence-data"),
                                                                                         extra_cols,
<span style="color: #A00000">-                                                                                         switch_event_get_header_nil(event, "unique-id"), switch_core_get_variable("hostname"));</span>
<span style="color: #00A000">+                                                                                         switch_event_get_header_nil(event, "unique-id"), switch_core_get_hostname());</span>
                                        free(extra_cols);
                                } else {
                                        new_sql() = switch_mprintf("update channels set state='%s',cid_name='%q',cid_num='%q',"
<span style="color: #800080; font-weight: bold">@@ -1345,13 +1345,13 @@ static void core_event_handler(switch_event_t *event)</span>
                                                                                         switch_event_get_header_nil(event, "caller-context"),
                                                                                         switch_event_get_header_nil(event, "channel-presence-id"),
                                                                                         switch_event_get_header_nil(event, "channel-presence-data"),
<span style="color: #A00000">-                                                                                         switch_event_get_header_nil(event, "unique-id"), switch_core_get_variable("hostname"));</span>
<span style="color: #00A000">+                                                                                         switch_event_get_header_nil(event, "unique-id"), switch_core_get_hostname());</span>
                                }
                                break;
                        default:
                                new_sql() = switch_mprintf("update channels set state='%s' where uuid='%s' and hostname='%q'",
                                                                                 switch_event_get_header_nil(event, "channel-state"),
<span style="color: #A00000">-                                                                                 switch_event_get_header_nil(event, "unique-id"), switch_core_get_variable("hostname"));</span>
<span style="color: #00A000">+                                                                                 switch_event_get_header_nil(event, "unique-id"), switch_core_get_hostname());</span>
                                break;
                        }
<span style="color: #800080; font-weight: bold">@@ -1377,7 +1377,7 @@ static void core_event_handler(switch_event_t *event)</span>
                        new_sql() = switch_mprintf("update channels set call_uuid='%q' where uuid='%s' and hostname='%q'",
                                                                         switch_event_get_header_nil(event, "channel-call-uuid"),
<span style="color: #A00000">-                                                                         switch_event_get_header_nil(event, "unique-id"), switch_core_get_variable("hostname"));</span>
<span style="color: #00A000">+                                                                         switch_event_get_header_nil(event, "unique-id"), switch_core_get_hostname());</span>
                        if (runtime.odbc_dbtype == DBTYPE_DEFAULT) {
                                func_name = "function";
<span style="color: #800080; font-weight: bold">@@ -1404,7 +1404,7 @@ static void core_event_handler(switch_event_t *event)</span>
                                                                         callee_cid_num,
                                                                         switch_event_get_header_nil(event, "Other-Leg-destination-number"),
                                                                         switch_event_get_header_nil(event, "Other-Leg-channel-name"),
<span style="color: #A00000">-                                                                         switch_event_get_header_nil(event, "Other-Leg-unique-id"), switch_core_get_variable("hostname")</span>
<span style="color: #00A000">+                                                                         switch_event_get_header_nil(event, "Other-Leg-unique-id"), switch_core_get_hostname()</span>
                                                                         );
                }
                break;
<span style="color: #800080; font-weight: bold">@@ -1413,14 +1413,14 @@ static void core_event_handler(switch_event_t *event)</span>
                        char *uuid = switch_event_get_header_nil(event, "caller-unique-id");
                        new_sql() = switch_mprintf("delete from calls where (caller_uuid='%q' or callee_uuid='%q') and hostname='%q'",
<span style="color: #A00000">-                                                                         uuid, uuid, switch_core_get_variable("hostname"));</span>
<span style="color: #00A000">+                                                                         uuid, uuid, switch_core_get_hostname());</span>
                        break;
                }
        case SWITCH_EVENT_SHUTDOWN:
                new_sql() = switch_mprintf("delete from channels where hostname='%q';"
                                                                 "delete from interfaces where hostname='%q';"
                                                                 "delete from calls where hostname='%q'",
<span style="color: #A00000">-                                                                 switch_core_get_variable("hostname"), switch_core_get_variable("hostname"), switch_core_get_variable("hostname")</span>
<span style="color: #00A000">+                                                                 switch_core_get_hostname(), switch_core_get_hostname(), switch_core_get_hostname()</span>
                                                                 );
                break;
        case SWITCH_EVENT_LOG:
<span style="color: #800080; font-weight: bold">@@ -1438,7 +1438,7 @@ static void core_event_handler(switch_event_t *event)</span>
                                        switch_mprintf
                                        ("insert into interfaces (type,name,description,syntax,ikey,filename,hostname) values('%q','%q','%q','%q','%q','%q','%q')", type, name,
                                         switch_str_nil(description), switch_str_nil(syntax), switch_str_nil(key), switch_str_nil(filename),
<span style="color: #A00000">-                                         switch_core_get_variable("hostname")</span>
<span style="color: #00A000">+                                         switch_core_get_hostname()</span>
                                         );
                        }
                        break;
<span style="color: #800080; font-weight: bold">@@ -1449,7 +1449,7 @@ static void core_event_handler(switch_event_t *event)</span>
                        const char *name = switch_event_get_header_nil(event, "name");
                        if (!zstr(type) && !zstr(name)) {
                                new_sql() = switch_mprintf("delete from interfaces where type='%q' and name='%q' and hostname='%q'", type, name,
<span style="color: #A00000">-                                                                                 switch_core_get_variable("hostname"));</span>
<span style="color: #00A000">+                                                                                 switch_core_get_hostname());</span>
                        }
                        break;
                }
<span style="color: #800080; font-weight: bold">@@ -1461,7 +1461,7 @@ static void core_event_handler(switch_event_t *event)</span>
                                break;
                        }
                        new_sql() = switch_mprintf("update channels set secure='%s' where uuid='%s' and hostname='%q'",
<span style="color: #A00000">-                                                                         type, switch_event_get_header_nil(event, "caller-unique-id"), switch_core_get_variable("hostname")</span>
<span style="color: #00A000">+                                                                         type, switch_event_get_header_nil(event, "caller-unique-id"), switch_core_get_hostname()</span>
                                                                         );
                        break;
                }
<span style="color: #800080; font-weight: bold">@@ -1472,12 +1472,12 @@ static void core_event_handler(switch_event_t *event)</span>
                        if (!strcmp("add", op)) {
                                new_sql() = switch_mprintf("insert into nat (port, proto, sticky, hostname) values (%s, %s, %d,'%q')",
                                                                                 switch_event_get_header_nil(event, "port"),
<span style="color: #A00000">-                                                                                 switch_event_get_header_nil(event, "proto"), sticky, switch_core_get_variable("hostname")</span>
<span style="color: #00A000">+                                                                                 switch_event_get_header_nil(event, "proto"), sticky, switch_core_get_hostname()</span>
                                                                                 );
                        } else if (!strcmp("del", op)) {
                                new_sql() = switch_mprintf("delete from nat where port=%s and proto=%s and hostname='%q'",
                                                                                 switch_event_get_header_nil(event, "port"),
<span style="color: #A00000">-                                                                                 switch_event_get_header_nil(event, "proto"), switch_core_get_variable("hostname"));</span>
<span style="color: #00A000">+                                                                                 switch_event_get_header_nil(event, "proto"), switch_core_get_hostname());</span>
                        } else if (!strcmp("status", op)) {
                                /* call show nat api */
                        } else if (!strcmp("status_response", op)) {
<span style="color: #800080; font-weight: bold">@@ -1664,7 +1664,7 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_</span>
                        char sql[512] = "";
                        char *tables[] = { "channels", "calls", "interfaces", "tasks", NULL };
                        int i;
<span style="color: #A00000">-                        const char *hostname = switch_core_get_variable("hostname");</span>
<span style="color: #00A000">+                        const char *hostname = switch_core_get_hostname();</span>
                        for (i = 0; tables[i]; i++) {
                                switch_snprintf(sql, sizeof(sql), "delete from %s where hostname='%s'", tables[i], hostname);
<span style="color: #000080; font-weight: bold">diff --git a/src/switch_event.c b/src/switch_event.c</span>
<span style="color: #000080; font-weight: bold">index 003fc82..3e12ea1 100644</span>
<span style="color: #A00000">--- a/src/switch_event.c</span>
<span style="color: #00A000">+++ b/src/switch_event.c</span>
<span style="color: #800080; font-weight: bold">@@ -1673,6 +1673,7 @@ SWITCH_DECLARE(char *) switch_event_expand_headers(switch_event_t *event, const</span>
                                        int offset = 0;
                                        int ooffset = 0;
                                        char *ptr;
<span style="color: #00A000">+                                        char *gvar = NULL;</span>
                                        if ((expanded = switch_event_expand_headers(event, (char *) vname)) == vname) {
                                                expanded = NULL;
<span style="color: #800080; font-weight: bold">@@ -1689,7 +1690,9 @@ SWITCH_DECLARE(char *) switch_event_expand_headers(switch_event_t *event, const</span>
                                        }
                                        if (!(sub_val = switch_event_get_header(event, vname))) {
<span style="color: #A00000">-                                                sub_val = switch_core_get_variable(vname);</span>
<span style="color: #00A000">+                                                if ((gvar = switch_core_get_variable_dup(vname))) {</span>
<span style="color: #00A000">+                                                        sub_val = gvar;</span>
<span style="color: #00A000">+                                                }</span>
                                        }
                                        if (offset || ooffset) {
<span style="color: #800080; font-weight: bold">@@ -1710,6 +1713,7 @@ SWITCH_DECLARE(char *) switch_event_expand_headers(switch_event_t *event, const</span>
                                                }
                                        }
<span style="color: #00A000">+                                        switch_safe_free(gvar);</span>
                                        switch_safe_free(expanded);
                                } else {
                                        switch_stream_handle_t stream = { 0 };
<span style="color: #000080; font-weight: bold">diff --git a/src/switch_nat.c b/src/switch_nat.c</span>
<span style="color: #000080; font-weight: bold">index 536baee..85b0247 100644</span>
<span style="color: #A00000">--- a/src/switch_nat.c</span>
<span style="color: #00A000">+++ b/src/switch_nat.c</span>
<span style="color: #800080; font-weight: bold">@@ -45,6 +45,7 @@</span>
typedef struct {
        switch_nat_type_t nat_type;
<span style="color: #00A000">+        char nat_type_str[5];</span>
        struct UPNPUrls urls;
        struct IGDdatas data;
        char *descURL;
<span style="color: #800080; font-weight: bold">@@ -420,6 +421,7 @@ SWITCH_DECLARE(void) switch_nat_init(switch_memory_pool_t *pool)</span>
                switch_core_set_variable("nat_public_addr", nat_globals.pub_addr);
                switch_core_set_variable("nat_private_addr", nat_globals.pvt_addr);
                switch_core_set_variable("nat_type", nat_globals.nat_type == SWITCH_NAT_TYPE_PMP ? "pmp" : "upnp");
<span style="color: #00A000">+                strncpy(nat_globals.nat_type_str, nat_globals.nat_type == SWITCH_NAT_TYPE_PMP ? "pmp" : "upnp", sizeof(nat_globals.nat_type_str) - 1);</span>
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "NAT detected type: %s, ExtIP: '%s'\n",
                                                 nat_globals.nat_type == SWITCH_NAT_TYPE_PMP ? "pmp" : "upnp", nat_globals.pub_addr);
<span style="color: #800080; font-weight: bold">@@ -564,6 +566,11 @@ static switch_status_t switch_nat_del_mapping_upnp(switch_port_t port, switch_na</span>
        return status;
}
<span style="color: #00A000">+SWITCH_DECLARE(const char *) switch_nat_get_type(void)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        return nat_globals.nat_type_str;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
SWITCH_DECLARE(switch_status_t) switch_nat_add_mapping_internal(switch_port_t port, switch_nat_ip_proto_t proto, switch_port_t * external_port,
                                                                                                                                switch_bool_t sticky, switch_bool_t publish)
{
<span style="color: #000080; font-weight: bold">diff --git a/src/switch_rtp.c b/src/switch_rtp.c</span>
<span style="color: #000080; font-weight: bold">index 4acadfe..e8d7558 100644</span>
<span style="color: #A00000">--- a/src/switch_rtp.c</span>
<span style="color: #00A000">+++ b/src/switch_rtp.c</span>
<span style="color: #800080; font-weight: bold">@@ -791,8 +791,8 @@ static void zrtp_logger(int level, const char *data, int len, int offset)</span>
SWITCH_DECLARE(void) switch_rtp_init(switch_memory_pool_t *pool)
{
#ifdef ENABLE_ZRTP
<span style="color: #A00000">-        const char *zid_string = switch_core_get_variable("switch_serial");</span>
<span style="color: #A00000">-        const char *zrtp_enabled = switch_core_get_variable("zrtp_enabled");</span>
<span style="color: #00A000">+        const char *zid_string = switch_core_get_variable_pdup("switch_serial", pool);</span>
<span style="color: #00A000">+        const char *zrtp_enabled = switch_core_get_variable_pdup("zrtp_enabled", pool);</span>
        zrtp_config_t zrtp_config;
        char zrtp_cache_path[256] = "";
        zrtp_on = zrtp_enabled ? switch_true(zrtp_enabled) : 0;
<span style="color: #000080; font-weight: bold">diff --git a/src/switch_utils.c b/src/switch_utils.c</span>
<span style="color: #000080; font-weight: bold">index 850b07f..eb5ed7f 100644</span>
<span style="color: #A00000">--- a/src/switch_utils.c</span>
<span style="color: #00A000">+++ b/src/switch_utils.c</span>
<span style="color: #800080; font-weight: bold">@@ -1154,8 +1154,8 @@ SWITCH_DECLARE(switch_status_t) switch_find_local_ip(char *buf, int len, int *ma</span>
{
        switch_status_t status = SWITCH_STATUS_FALSE;
        char *base;
<span style="color: #A00000">-        const char *force_local_ip_v4 = switch_core_get_variable("force_local_ip_v4");</span>
<span style="color: #A00000">-        const char *force_local_ip_v6 = switch_core_get_variable("force_local_ip_v6");</span>
<span style="color: #00A000">+        char *force_local_ip_v4 = switch_core_get_variable_dup("force_local_ip_v4");</span>
<span style="color: #00A000">+        char *force_local_ip_v6 = switch_core_get_variable_dup("force_local_ip_v6");</span>
#ifdef WIN32
        SOCKET tmp_socket;
<span style="color: #800080; font-weight: bold">@@ -1176,14 +1176,20 @@ SWITCH_DECLARE(switch_status_t) switch_find_local_ip(char *buf, int len, int *ma</span>
        case AF_INET:
                if (force_local_ip_v4) {
                        switch_copy_string(buf, force_local_ip_v4, len);
<span style="color: #00A000">+                        switch_safe_free(force_local_ip_v4);</span>
<span style="color: #00A000">+                        switch_safe_free(force_local_ip_v6);</span>
                        return SWITCH_STATUS_SUCCESS;
                }
        case AF_INET6:
                if (force_local_ip_v6) {
                        switch_copy_string(buf, force_local_ip_v6, len);
<span style="color: #00A000">+                        switch_safe_free(force_local_ip_v4);</span>
<span style="color: #00A000">+                        switch_safe_free(force_local_ip_v6);</span>
                        return SWITCH_STATUS_SUCCESS;
                }
        default:
<span style="color: #00A000">+                switch_safe_free(force_local_ip_v4);</span>
<span style="color: #00A000">+                switch_safe_free(force_local_ip_v6);</span>
                break;
        }
<span style="color: #000080; font-weight: bold">diff --git a/src/switch_xml.c b/src/switch_xml.c</span>
<span style="color: #000080; font-weight: bold">index 964a769..4c30d98 100644</span>
<span style="color: #A00000">--- a/src/switch_xml.c</span>
<span style="color: #00A000">+++ b/src/switch_xml.c</span>
<span style="color: #800080; font-weight: bold">@@ -1208,11 +1208,12 @@ static char *expand_vars(char *buf, char *ebuf, switch_size_t elen, switch_size_</span>
                                var = rp;
                                *e++ = '\0';
                                rp = e;
<span style="color: #A00000">-                                if ((val = switch_core_get_variable(var))) {</span>
<span style="color: #00A000">+                                if ((val = switch_core_get_variable_dup(var))) {</span>
                                        char *p;
                                        for (p = val; p && *p && wp <= ep; p++) {
                                                *wp++ = *p;
                                        }
<span style="color: #00A000">+                                        free(val);</span>
                                }
                                continue;
                        } else if (err) {
</pre></div>
<div class="highlight"><pre>committer: Brian West
comments:
FS-3023
<span style="color: #000080; font-weight: bold">diff --git a/src/include/switch_cpp.h b/src/include/switch_cpp.h</span>
<span style="color: #000080; font-weight: bold">index 0bd2a8b..f4a0922 100644</span>
<span style="color: #A00000">--- a/src/include/switch_cpp.h</span>
<span style="color: #00A000">+++ b/src/include/switch_cpp.h</span>
<span style="color: #800080; font-weight: bold">@@ -68,6 +68,10 @@ Note that the first parameter to the new operator is implicitly handled by c++..</span>
SWITCH_DECLARE(void) consoleLog(char *level_str, char *msg);
SWITCH_DECLARE(void) consoleCleanLog(char *msg);
<span style="color: #00A000">+SWITCH_DECLARE(bool) email(char *to, char *from, char *headers = NULL, char *body = NULL,</span>
<span style="color: #00A000">+ char *file = NULL, char *convert_cmd = NULL, char *convert_ext = NULL);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
         class CoreSession;
         class IVRMenu {
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.cxx</span>
<span style="color: #000080; font-weight: bold">index e91de6d..71e9f99 100644</span>
<span style="color: #A00000">--- a/src/mod/languages/mod_managed/freeswitch_wrap.cxx</span>
<span style="color: #00A000">+++ b/src/mod/languages/mod_managed/freeswitch_wrap.cxx</span>
<span style="color: #800080; font-weight: bold">@@ -33352,6 +33352,30 @@ SWIGEXPORT void SWIGSTDCALL CSharp_consoleCleanLog(char * jarg1) {</span>
}
<span style="color: #00A000">+SWIGEXPORT unsigned int SWIGSTDCALL CSharp_email(char * jarg1, char * jarg2, char * jarg3, char * jarg4, char * jarg5, char * jarg6, char * jarg7) {</span>
<span style="color: #00A000">+ unsigned int jresult ;</span>
<span style="color: #00A000">+ char *arg1 = (char *) 0 ;</span>
<span style="color: #00A000">+ char *arg2 = (char *) 0 ;</span>
<span style="color: #00A000">+ char *arg3 = (char *) NULL ;</span>
<span style="color: #00A000">+ char *arg4 = (char *) NULL ;</span>
<span style="color: #00A000">+ char *arg5 = (char *) NULL ;</span>
<span style="color: #00A000">+ char *arg6 = (char *) NULL ;</span>
<span style="color: #00A000">+ char *arg7 = (char *) NULL ;</span>
<span style="color: #00A000">+ bool result;</span>
<span style="color: #00A000">+ </span>
<span style="color: #00A000">+ arg1 = (char *)jarg1; </span>
<span style="color: #00A000">+ arg2 = (char *)jarg2; </span>
<span style="color: #00A000">+ arg3 = (char *)jarg3; </span>
<span style="color: #00A000">+ arg4 = (char *)jarg4; </span>
<span style="color: #00A000">+ arg5 = (char *)jarg5; </span>
<span style="color: #00A000">+ arg6 = (char *)jarg6; </span>
<span style="color: #00A000">+ arg7 = (char *)jarg7; </span>
<span style="color: #00A000">+ result = (bool)email(arg1,arg2,arg3,arg4,arg5,arg6,arg7);</span>
<span style="color: #00A000">+ jresult = result; </span>
<span style="color: #00A000">+ return jresult;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
SWIGEXPORT void * SWIGSTDCALL CSharp_new_IvrMenu(void * jarg1, char * jarg2, char * jarg3, char * jarg4, char * jarg5, char * jarg6, char * jarg7, char * jarg8, char * jarg9, char * jarg10, int jarg11, int jarg12, int jarg13, int jarg14, int jarg15, int jarg16) {
void * jresult ;
IVRMenu *arg1 = (IVRMenu *) 0 ;
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/languages/mod_managed/managed/swig.cs b/src/mod/languages/mod_managed/managed/swig.cs</span>
<span style="color: #000080; font-weight: bold">index 1f02c3f..c640199 100644</span>
<span style="color: #A00000">--- a/src/mod/languages/mod_managed/managed/swig.cs</span>
<span style="color: #00A000">+++ b/src/mod/languages/mod_managed/managed/swig.cs</span>
<span style="color: #800080; font-weight: bold">@@ -5364,6 +5364,11 @@ public class freeswitch {</span>
freeswitchPINVOKE.consoleCleanLog(msg);
}
<span style="color: #00A000">+ public static bool email(string to, string from, string headers, string body, string file, string convert_cmd, string convert_ext) {</span>
<span style="color: #00A000">+ bool ret = freeswitchPINVOKE.email(to, from, headers, body, file, convert_cmd, convert_ext);</span>
<span style="color: #00A000">+ return ret;</span>
<span style="color: #00A000">+ }</span>
<span style="color: #00A000">+</span>
public static void console_log(string level_str, string msg) {
freeswitchPINVOKE.console_log(level_str, msg);
}
<span style="color: #800080; font-weight: bold">@@ -13588,6 +13593,9 @@ class freeswitchPINVOKE {</span>
[DllImport("mod_managed", EntryPoint="CSharp_consoleCleanLog")]
public static extern void consoleCleanLog(string jarg1);
<span style="color: #00A000">+ [DllImport("mod_managed", EntryPoint="CSharp_email")]</span>
<span style="color: #00A000">+ public static extern bool email(string jarg1, string jarg2, string jarg3, string jarg4, string jarg5, string jarg6, string jarg7);</span>
<span style="color: #00A000">+</span>
[DllImport("mod_managed", EntryPoint="CSharp_new_IvrMenu")]
public static extern IntPtr new_IvrMenu(HandleRef jarg1, string jarg2, string jarg3, string jarg4, string jarg5, string jarg6, string jarg7, string jarg8, string jarg9, string jarg10, int jarg11, int jarg12, int jarg13, int jarg14, int jarg15, int jarg16);
<span style="color: #000080; font-weight: bold">diff --git a/src/switch_cpp.cpp b/src/switch_cpp.cpp</span>
<span style="color: #000080; font-weight: bold">index bbcd05d..c62946b 100644</span>
<span style="color: #A00000">--- a/src/switch_cpp.cpp</span>
<span style="color: #00A000">+++ b/src/switch_cpp.cpp</span>
<span style="color: #800080; font-weight: bold">@@ -1195,6 +1195,13 @@ SWITCH_DECLARE(void) console_clean_log(char *msg)</span>
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN,SWITCH_LOG_DEBUG, "%s", switch_str_nil(msg));
}
<span style="color: #00A000">+SWITCH_DECLARE(bool) email(char *to, char *from, char *headers, char *body, char *file, char *convert_cmd, char *convert_ext)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+ if (switch_simple_email(to, from, headers, body, file, convert_cmd, convert_ext) == SWITCH_TRUE) {</span>
<span style="color: #00A000">+ return true;</span>
<span style="color: #00A000">+ }</span>
<span style="color: #00A000">+ return false;</span>
<span style="color: #00A000">+}</span>
SWITCH_DECLARE(void) msleep(unsigned ms)
{
</pre></div>
<div class="highlight"><pre>committer: Anthony Minessale
comments:
FS-3024
<span style="color: #000080; font-weight: bold">diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c</span>
<span style="color: #000080; font-weight: bold">index 35311c9..2db2a0d 100644</span>
<span style="color: #A00000">--- a/src/switch_core_sqldb.c</span>
<span style="color: #00A000">+++ b/src/switch_core_sqldb.c</span>
<span style="color: #800080; font-weight: bold">@@ -1409,9 +1409,13 @@ static void core_event_handler(switch_event_t *event)</span>
                }
                break;
        case SWITCH_EVENT_CHANNEL_UNBRIDGE:
<span style="color: #A00000">-                new_sql() = switch_mprintf("delete from calls where (caller_uuid='%s' or callee_uuid='%q') and hostname='%q'",</span>
<span style="color: #A00000">-                                                                 switch_event_get_header_nil(event, "caller-unique-id"), switch_core_get_variable("hostname"));</span>
<span style="color: #A00000">-                break;</span>
<span style="color: #00A000">+                {</span>
<span style="color: #00A000">+                        char *uuid = switch_event_get_header_nil(event, "caller-unique-id");</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                        new_sql() = switch_mprintf("delete from calls where (caller_uuid='%q' or callee_uuid='%q') and hostname='%q'",</span>
<span style="color: #00A000">+                                                                         uuid, uuid, switch_core_get_variable("hostname"));</span>
<span style="color: #00A000">+                        break;</span>
<span style="color: #00A000">+                }</span>
        case SWITCH_EVENT_SHUTDOWN:
                new_sql() = switch_mprintf("delete from channels where hostname='%q';"
                                                                 "delete from interfaces where hostname='%q';"
</pre></div>
<div class="highlight"><pre>committer: David Yat Sin
comments:
Merge branch 'master' of git.sangoma.com:smg_freeswitch
</pre></div>
<div class="highlight"><pre>committer: David Yat Sin
comments:
freetdm: Fix for typo in print
<span style="color: #000080; font-weight: bold">diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c</span>
<span style="color: #000080; font-weight: bold">index 92cf9e5..563a203 100755</span>
<span style="color: #A00000">--- a/libs/freetdm/mod_freetdm/mod_freetdm.c</span>
<span style="color: #00A000">+++ b/libs/freetdm/mod_freetdm/mod_freetdm.c</span>
<span style="color: #800080; font-weight: bold">@@ -1570,8 +1570,8 @@ ftdm_status_t ftdm_channel_from_event(ftdm_sigmsg_t *sigmsg, switch_core_session</span>
                switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-ANI2", "%s", channel_caller_data->aniII);
                
                switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-DNIS", "%s", channel_caller_data->dnis.digits);
<span style="color: #A00000">-                switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-DNIS-TON", "%s", channel_caller_data->dnis.type);</span>
<span style="color: #A00000">-                switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-DNIS-Plan", "%s", channel_caller_data->dnis.plan);</span>
<span style="color: #00A000">+                switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-DNIS-TON", "%d", channel_caller_data->dnis.type);</span>
<span style="color: #00A000">+                switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-DNIS-Plan", "%d", channel_caller_data->dnis.plan);</span>
                switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-RDNIS", "%s", channel_caller_data->rdnis.digits);
                switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-RDNIS-TON", "%d", channel_caller_data->rdnis.type);
</pre></div>
<div class="highlight"><pre>committer: Leon de Rooij
comments:
Merge branch 'master' of ssh://git.freeswitch.org/freeswitch
</pre></div>
<div class="highlight"><pre>committer: Andrew Thompson
comments:
Added conference UUID to xml_list
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c</span>
<span style="color: #000080; font-weight: bold">index 12b3193..961a140 100644</span>
<span style="color: #A00000">--- a/src/mod/applications/mod_conference/mod_conference.c</span>
<span style="color: #00A000">+++ b/src/mod/applications/mod_conference/mod_conference.c</span>
<span style="color: #800080; font-weight: bold">@@ -3778,6 +3778,7 @@ static void conference_xlist(conference_obj_t *conference, switch_xml_t x_confer</span>
        switch_xml_set_attr_d(x_conference, "member-count", ival);
        switch_snprintf(i, sizeof(i), "%u", conference->rate);
        switch_xml_set_attr_d(x_conference, "rate", ival);
<span style="color: #00A000">+        switch_xml_set_attr_d(x_conference, "uuid", conference->uuid_str);</span>
        if (switch_test_flag(conference, CFLAG_LOCKED)) {
                switch_xml_set_attr_d(x_conference, "locked", "true");
</pre></div>
<div class="highlight"><pre>committer: Brian West
comments:
sigh
<span style="color: #000080; font-weight: bold">diff --git a/libs/openzap/mod_openzap/mod_openzap.c b/libs/openzap/mod_openzap/mod_openzap.c</span>
<span style="color: #000080; font-weight: bold">index 3e5227e..d52149c 100644</span>
<span style="color: #A00000">--- a/libs/openzap/mod_openzap/mod_openzap.c</span>
<span style="color: #00A000">+++ b/libs/openzap/mod_openzap/mod_openzap.c</span>
<span style="color: #800080; font-weight: bold">@@ -135,7 +135,9 @@ void dump_chan_xml(zap_span_t *span, uint32_t chan_id, switch_stream_handle_t *s</span>
static void zap_set_npi(const char *npi_string, uint8_t *target)
{
<span style="color: #A00000">-        if (!strcasecmp(npi_string, "isdn") || !strcasecmp(npi_string, "e164")) {</span>
<span style="color: #00A000">+        if (switch_is_number(npi_string)) {</span>
<span style="color: #00A000">+                *target = (uint8_t)atoi(npi_string);</span>
<span style="color: #00A000">+        } else if (!strcasecmp(npi_string, "isdn") || !strcasecmp(npi_string, "e164")) {</span>
                *target = ZAP_NPI_ISDN;
        } else if (!strcasecmp(npi_string, "data")) {
                *target = ZAP_NPI_DATA;
<span style="color: #800080; font-weight: bold">@@ -157,7 +159,9 @@ static void zap_set_npi(const char *npi_string, uint8_t *target)</span>
static void zap_set_ton(const char *ton_string, uint8_t *target)
{
<span style="color: #A00000">-        if (!strcasecmp(ton_string, "national")) {</span>
<span style="color: #00A000">+        if (switch_is_number(ton_string)) {</span>
<span style="color: #00A000">+                *target = (uint8_t)atoi(ton_string);</span>
<span style="color: #00A000">+        } else if (!strcasecmp(ton_string, "national")) {</span>
                *target = ZAP_TON_NATIONAL;
        } else if (!strcasecmp(ton_string, "international")) {
                *target = ZAP_TON_INTERNATIONAL;
<span style="color: #800080; font-weight: bold">@@ -1231,15 +1235,8 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi</span>
        }
        
        if ((var = switch_event_get_header(var_event, "openzap_outbound_ton")) || (var = switch_core_get_variable("openzap_outbound_ton"))) {
<span style="color: #A00000">-                if (!strcasecmp(var, "national")) {</span>
<span style="color: #A00000">-                        caller_data.ani.type = ZAP_TON_NATIONAL;</span>
<span style="color: #A00000">-                } else if (!strcasecmp(var, "international")) {</span>
<span style="color: #A00000">-                        caller_data.ani.type = ZAP_TON_INTERNATIONAL;</span>
<span style="color: #A00000">-                } else if (!strcasecmp(var, "local")) {</span>
<span style="color: #A00000">-                        caller_data.ani.type = ZAP_TON_SUBSCRIBER_NUMBER;</span>
<span style="color: #A00000">-                } else if (!strcasecmp(var, "unknown")) {</span>
<span style="color: #A00000">-                        caller_data.ani.type = ZAP_TON_UNKNOWN;</span>
<span style="color: #A00000">-                }</span>
<span style="color: #00A000">+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Setting TON to: %s\n", var);</span>
<span style="color: #00A000">+                zap_set_ton(var, &caller_data.ani.type);</span>
        } else {
                caller_data.ani.type = outbound_profile->destination_number_ton;
        }
<span style="color: #800080; font-weight: bold">@@ -1248,9 +1245,14 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi</span>
                zap_set_string((char *)caller_data.raw_data, var);
                caller_data.raw_data_len = strlen(var);
        }
<span style="color: #A00000">-</span>
<span style="color: #A00000">-        caller_data.ani.plan = outbound_profile->destination_number_numplan;</span>
<span style="color: #A00000">-</span>
<span style="color: #00A000">+        </span>
<span style="color: #00A000">+        if ((var = switch_event_get_header(var_event, "openzap_outbound_npi")) || (var = switch_core_get_variable("openzap_outbound_npi"))) {</span>
<span style="color: #00A000">+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Setting NPI to: %s\n", var);</span>
<span style="color: #00A000">+                zap_set_npi(var, &caller_data.ani.plan);</span>
<span style="color: #00A000">+        } else {</span>
<span style="color: #00A000">+                caller_data.ani.plan = outbound_profile->destination_number_numplan;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        </span>
        /* blindly copy data from outbound_profile. They will be overwritten
         * by calling zap_caller_data if needed after */
        caller_data.cid_num.type = outbound_profile->caller_ton;
</pre></div>
<div class="highlight"><pre>committer: Anthony Minessale
comments:
more loopback improvements
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/endpoints/mod_loopback/mod_loopback.c b/src/mod/endpoints/mod_loopback/mod_loopback.c</span>
<span style="color: #000080; font-weight: bold">index 727de27..be9b499 100644</span>
<span style="color: #A00000">--- a/src/mod/endpoints/mod_loopback/mod_loopback.c</span>
<span style="color: #00A000">+++ b/src/mod/endpoints/mod_loopback/mod_loopback.c</span>
<span style="color: #800080; font-weight: bold">@@ -82,6 +82,7 @@ struct private_object {</span>
        int32_t bowout_frame_count;
        char *other_uuid;
        switch_queue_t *frame_queue;
<span style="color: #00A000">+        int64_t packet_count;</span>
};
typedef struct private_object private_t;
<span style="color: #800080; font-weight: bold">@@ -577,40 +578,22 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch</span>
                if (tech_pvt->write_frame) {
                        switch_frame_free(&tech_pvt->write_frame);
                }
<span style="color: #A00000">-</span>
<span style="color: #00A000">+                </span>
                tech_pvt->write_frame = (switch_frame_t *) pop;
                tech_pvt->write_frame->codec = &tech_pvt->read_codec;
                *frame = tech_pvt->write_frame;
<span style="color: #00A000">+                tech_pvt->packet_count++;</span>
<span style="color: #00A000">+                switch_clear_flag_locked(tech_pvt, TFLAG_CNG);</span>
<span style="color: #00A000">+                switch_clear_flag(tech_pvt->write_frame, SFF_CNG);</span>
        } else {
                switch_set_flag(tech_pvt, TFLAG_CNG);
        }
        if (switch_test_flag(tech_pvt, TFLAG_CNG)) {
<span style="color: #A00000">-                unsigned char data[SWITCH_RECOMMENDED_BUFFER_SIZE];</span>
<span style="color: #A00000">-                uint32_t flag = 0;</span>
<span style="color: #A00000">-                switch_status_t encode_status;</span>
<span style="color: #A00000">-                uint32_t rate = tech_pvt->read_codec.implementation->actual_samples_per_second;</span>
<span style="color: #A00000">-</span>
                *frame = &tech_pvt->cng_frame;
                tech_pvt->cng_frame.codec = &tech_pvt->read_codec;
                tech_pvt->cng_frame.datalen = tech_pvt->read_codec.implementation->decoded_bytes_per_packet;
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                memset(tech_pvt->cng_frame.data, 0, tech_pvt->cng_frame.datalen);</span>
<span style="color: #A00000">-                memset(&data, 0, tech_pvt->read_codec.implementation->decoded_bytes_per_packet);</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                if (strcasecmp(tech_pvt->read_codec.implementation->iananame, "L16")) {</span>
<span style="color: #A00000">-                        encode_status = switch_core_codec_encode(&tech_pvt->read_codec,</span>
<span style="color: #A00000">-                                                                                                         NULL,</span>
<span style="color: #A00000">-                                                                                                         data,</span>
<span style="color: #A00000">-                                                                                                         tech_pvt->read_codec.implementation->decoded_bytes_per_packet,</span>
<span style="color: #A00000">-                                                                                                         tech_pvt->read_codec.implementation->actual_samples_per_second,</span>
<span style="color: #A00000">-                                                                                                         tech_pvt->cng_frame.data, &tech_pvt->cng_frame.datalen, &rate, &flag);</span>
<span style="color: #A00000">-                        if (encode_status != SWITCH_STATUS_SUCCESS) {</span>
<span style="color: #A00000">-                                switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);</span>
<span style="color: #A00000">-                        }</span>
<span style="color: #A00000">-                } else {</span>
<span style="color: #A00000">-                        switch_set_flag((&tech_pvt->cng_frame), SFF_CNG);</span>
<span style="color: #A00000">-                }</span>
<span style="color: #00A000">+                switch_set_flag((&tech_pvt->cng_frame), SFF_CNG);</span>
                switch_clear_flag_locked(tech_pvt, TFLAG_CNG);
        }
</pre></div>
<div class="highlight"><pre>committer: David Yat Sin
comments:
chlog: freetdm: isdn: fix for 5ESS call clearing procedures
<span style="color: #000080; font-weight: bold">diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c</span>
<span style="color: #000080; font-weight: bold">index df528ae..97984fb 100644</span>
<span style="color: #A00000">--- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c</span>
<span style="color: #00A000">+++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c</span>
<span style="color: #800080; font-weight: bold">@@ -683,8 +683,8 @@ static ftdm_status_t ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdm</span>
                                if (!sngisdn_test_flag(sngisdn_info, FLAG_SENT_PROCEED)) {
                                        /* By default, we do not send a progress indicator in the proceed */
                                        ftdm_sngisdn_progind_t prog_ind = {SNGISDN_PROGIND_LOC_USER, SNGISDN_PROGIND_DESCR_INVALID};
<span style="color: #A00000">-                                        </span>
                                        sngisdn_set_flag(sngisdn_info, FLAG_SENT_PROCEED);
<span style="color: #00A000">+                                        </span>
                                        sngisdn_snd_proceed(ftdmchan, prog_ind);
                                }
                        }
<span style="color: #800080; font-weight: bold">@@ -800,6 +800,15 @@ static ftdm_status_t ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdm</span>
                                                /* If we never received a PROCEED/ALERT/PROGRESS/CONNECT on an outgoing call, we need to send release instead of disconnect */
                                                sngisdn_snd_release(ftdmchan, 0);
                                                break;
<span style="color: #00A000">+                                        case FTDM_CHANNEL_STATE_PROCEED:</span>
<span style="color: #00A000">+                                                if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND) &&</span>
<span style="color: #00A000">+                                                        ((sngisdn_span_data_t*)(ftdmchan->span->signal_data))->switchtype == SNGISDN_SWITCH_5ESS) {</span>
<span style="color: #00A000">+                                                        </span>
<span style="color: #00A000">+                                                        /* When using 5ESS, if the user wants to clear an inbound call, the correct procedure is to send a PROGRESS with in-band info available, and play tones. Then send a DISCONNECT. If we reached this point, it means user did not try to play-tones, so send a RELEASE because remote side does not expect DISCONNECT in state 3 */</span>
<span style="color: #00A000">+                                                        sngisdn_snd_release(ftdmchan, 0);</span>
<span style="color: #00A000">+                                                        break;</span>
<span style="color: #00A000">+                                                }</span>
<span style="color: #00A000">+                                                /* fall-through */</span>
                                        default:
                                                sngisdn_snd_disconnect(ftdmchan);
                                                break;
</pre></div>
<div class="highlight"><pre>committer: David Yat Sin
comments:
Merge branch 'master' of git.freeswitch.org:freeswitch
</pre></div>
<div class="highlight"><pre>committer: David Yat Sin
comments:
chlog: freetdm: Fix for only checking first progress indicator for early-media flag
<span style="color: #000080; font-weight: bold">diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c</span>
<span style="color: #000080; font-weight: bold">index 0b52011..578677a 100644</span>
<span style="color: #A00000">--- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c</span>
<span style="color: #00A000">+++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c</span>
<span style="color: #800080; font-weight: bold">@@ -385,8 +385,12 @@ void sngisdn_process_cnst_ind (sngisdn_event_data_t *sngisdn_event)</span>
                                case FTDM_CHANNEL_STATE_DIALING:
                                case FTDM_CHANNEL_STATE_PROCEED:
                                case FTDM_CHANNEL_STATE_PROGRESS:
<span style="color: #A00000">-                                case FTDM_CHANNEL_STATE_RINGING:                                        </span>
<span style="color: #A00000">-                                        if (cnStEvnt->progInd.eh.pres && cnStEvnt->progInd.progDesc.val == IN_PD_IBAVAIL) {</span>
<span style="color: #00A000">+                                case FTDM_CHANNEL_STATE_RINGING:</span>
<span style="color: #00A000">+                                        if ((cnStEvnt->progInd.eh.pres && cnStEvnt->progInd.progDesc.val == IN_PD_IBAVAIL) ||</span>
<span style="color: #00A000">+                                                (cnStEvnt->progInd1.eh.pres && cnStEvnt->progInd1.progDesc.val == IN_PD_IBAVAIL) ||</span>
<span style="color: #00A000">+                                                (cnStEvnt->progInd2.eh.pres && cnStEvnt->progInd2.progDesc.val == IN_PD_IBAVAIL) ||</span>
<span style="color: #00A000">+                                                (cnStEvnt->progInd3.eh.pres && cnStEvnt->progInd3.progDesc.val == IN_PD_IBAVAIL)) {</span>
<span style="color: #00A000">+                                                </span>
                                                ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Early media available\n");
                                                sngisdn_set_flag(sngisdn_info, FLAG_MEDIA_READY);
                                        } else {
</pre></div>
<div class="highlight"><pre>committer: Anthony Minessale
comments:
only execute execute_on_[answer|media|ring] async when its expressed in app::arg form vs 'app arg form'
<span style="color: #000080; font-weight: bold">diff --git a/src/switch_channel.c b/src/switch_channel.c</span>
<span style="color: #000080; font-weight: bold">index de472a9..70b1879 100644</span>
<span style="color: #A00000">--- a/src/switch_channel.c</span>
<span style="color: #00A000">+++ b/src/switch_channel.c</span>
<span style="color: #800080; font-weight: bold">@@ -2595,14 +2595,15 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_ring_ready_value(swi</span>
                if (var) {
                        char *arg = NULL;
                        app = switch_core_session_strdup(channel->session, var);
<span style="color: #A00000">-                        if ((arg = strchr(app, ' '))) {</span>
<span style="color: #A00000">-                                *arg++ = '\0';</span>
<span style="color: #A00000">-                        }</span>
<span style="color: #A00000">-                        if (switch_core_session_in_thread(channel->session)) {</span>
<span style="color: #A00000">-                                switch_core_session_execute_application(channel->session, app, arg);</span>
<span style="color: #A00000">-                        } else {</span>
<span style="color: #00A000">+                        if (strstr(app, "::")) {</span>
                                switch_core_session_execute_application_async(channel->session, app, arg);
<span style="color: #00A000">+                        } else {</span>
<span style="color: #00A000">+                                if ((arg = strchr(app, ' '))) {</span>
<span style="color: #00A000">+                                        *arg++ = '\0';</span>
<span style="color: #00A000">+                                }</span>
<span style="color: #00A000">+                                </span>
<span style="color: #00A000">+                                switch_core_session_execute_application(channel->session, app, arg);</span>
                        }
                }
<span style="color: #800080; font-weight: bold">@@ -2653,14 +2654,16 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_pre_answered(switch_</span>
                         (var = switch_channel_get_variable(channel, SWITCH_CHANNEL_EXECUTE_ON_MEDIA_VARIABLE))) && !zstr(var)) {
                        char *arg = NULL;
                        app = switch_core_session_strdup(channel->session, var);
<span style="color: #A00000">-                        if ((arg = strchr(app, ' '))) {</span>
<span style="color: #A00000">-                                *arg++ = '\0';</span>
<span style="color: #A00000">-                        }</span>
<span style="color: #A00000">-                        if (switch_core_session_in_thread(channel->session)) {</span>
<span style="color: #A00000">-                                switch_core_session_execute_application(channel->session, app, arg);</span>
<span style="color: #A00000">-                        } else {</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                        if (strstr(app, "::")) {</span>
                                switch_core_session_execute_application_async(channel->session, app, arg);
<span style="color: #00A000">+                        } else {</span>
<span style="color: #00A000">+                                if ((arg = strchr(app, ' '))) {</span>
<span style="color: #00A000">+                                        *arg++ = '\0';</span>
<span style="color: #00A000">+                                }</span>
<span style="color: #00A000">+                                </span>
<span style="color: #00A000">+                                switch_core_session_execute_application(channel->session, app, arg);</span>
                        }
                }
<span style="color: #800080; font-weight: bold">@@ -2825,27 +2828,17 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_answered(switch_chan</span>
                 (!switch_channel_test_flag(channel, CF_EARLY_MEDIA) && (var = switch_channel_get_variable(channel, SWITCH_CHANNEL_EXECUTE_ON_MEDIA_VARIABLE))))
                && !zstr(var)) {
                char *arg = NULL;
<span style="color: #A00000">-                char *colon = NULL;</span>
                app = switch_core_session_strdup(channel->session, var);
<span style="color: #A00000">-                arg = strchr(app, ' ');</span>
<span style="color: #A00000">-                colon = strchr(app, ':');</span>
<span style="color: #A00000">-                if (colon && (!arg || arg > colon) && *(colon + 1) == ':') {</span>
<span style="color: #A00000">-                        switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG, "%s execute on answer: %s (BROADCAST)\n", channel->name, app);</span>
<span style="color: #A00000">-                        switch_ivr_broadcast(switch_core_session_get_uuid(channel->session), app, SMF_NONE);</span>
<span style="color: #00A000">+                if (strstr(app, "::")) {</span>
<span style="color: #00A000">+                        switch_core_session_execute_application_async(channel->session, app, arg);</span>
                } else {
<span style="color: #A00000">-                        if (arg) {</span>
<span style="color: #00A000">+                        if ((arg = strchr(app, ' '))) {</span>
                                *arg++ = '\0';
                        }
<span style="color: #A00000">-                        switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG, "%s execute on answer: %s(%s)\n", channel->name, app,</span>
<span style="color: #A00000">-                                                         switch_str_nil(arg));</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                        if (switch_core_session_in_thread(channel->session)) {</span>
<span style="color: #A00000">-                                switch_core_session_execute_application(channel->session, app, arg);</span>
<span style="color: #A00000">-                        } else {</span>
<span style="color: #A00000">-                                switch_core_session_execute_application_async(channel->session, app, arg);</span>
<span style="color: #A00000">-                        }</span>
<span style="color: #00A000">+                        </span>
<span style="color: #00A000">+                        switch_core_session_execute_application(channel->session, app, arg);</span>
                }
        }
</pre></div>
<div class="highlight"><pre>committer: Anthony Minessale
comments:
try another approach to previous mod_loopback fix ... FS-3011
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/endpoints/mod_loopback/mod_loopback.c b/src/mod/endpoints/mod_loopback/mod_loopback.c</span>
<span style="color: #000080; font-weight: bold">index f875f6b..727de27 100644</span>
<span style="color: #A00000">--- a/src/mod/endpoints/mod_loopback/mod_loopback.c</span>
<span style="color: #00A000">+++ b/src/mod/endpoints/mod_loopback/mod_loopback.c</span>
<span style="color: #800080; font-weight: bold">@@ -608,9 +608,9 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch</span>
                        if (encode_status != SWITCH_STATUS_SUCCESS) {
                                switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
                        }
<span style="color: #A00000">-</span>
<span style="color: #00A000">+                } else {</span>
<span style="color: #00A000">+                        switch_set_flag((&tech_pvt->cng_frame), SFF_CNG);</span>
                }
<span style="color: #A00000">-                //switch_set_flag((&tech_pvt->cng_frame), SFF_CNG);</span>
                switch_clear_flag_locked(tech_pvt, TFLAG_CNG);
        }
<span style="color: #800080; font-weight: bold">@@ -642,7 +642,10 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc</span>
        tech_pvt = switch_core_session_get_private(session);
        switch_assert(tech_pvt != NULL);
<span style="color: #A00000">-        if (switch_test_flag(frame, SFF_CNG) || switch_test_flag(tech_pvt, TFLAG_CNG) || (switch_test_flag(tech_pvt, TFLAG_BOWOUT) && switch_test_flag(tech_pvt, TFLAG_BOWOUT_USED))) {</span>
<span style="color: #00A000">+        if (switch_test_flag(frame, SFF_CNG) || </span>
<span style="color: #00A000">+                switch_test_flag(tech_pvt, TFLAG_CNG) || (switch_test_flag(tech_pvt, TFLAG_BOWOUT) && switch_test_flag(tech_pvt, TFLAG_BOWOUT_USED))) {</span>
<span style="color: #00A000">+                switch_core_timer_sync(&tech_pvt->timer);</span>
<span style="color: #00A000">+                switch_core_timer_sync(&tech_pvt->other_tech_pvt->timer);</span>
                return SWITCH_STATUS_SUCCESS;
        }
</pre></div>
<div class="highlight"><pre>committer: Anthony Minessale
comments:
revert 02d1af647bac6b937de02608d53ea1831f51b968
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/endpoints/mod_loopback/mod_loopback.c b/src/mod/endpoints/mod_loopback/mod_loopback.c</span>
<span style="color: #000080; font-weight: bold">index aa57668..f875f6b 100644</span>
<span style="color: #A00000">--- a/src/mod/endpoints/mod_loopback/mod_loopback.c</span>
<span style="color: #00A000">+++ b/src/mod/endpoints/mod_loopback/mod_loopback.c</span>
<span style="color: #800080; font-weight: bold">@@ -77,11 +77,11 @@ struct private_object {</span>
        switch_frame_t cng_frame;
        unsigned char cng_databuf[SWITCH_RECOMMENDED_BUFFER_SIZE];
<span style="color: #00A000">+        switch_timer_t timer;</span>
        switch_caller_profile_t *caller_profile;
        int32_t bowout_frame_count;
        char *other_uuid;
        switch_queue_t *frame_queue;
<span style="color: #A00000">-        switch_codec_implementation_t read_impl;</span>
};
typedef struct private_object private_t;
<span style="color: #800080; font-weight: bold">@@ -111,6 +111,7 @@ static switch_status_t tech_init(private_t *tech_pvt, switch_core_session_t *ses</span>
        int interval = 20;
        switch_status_t status = SWITCH_STATUS_SUCCESS;
        switch_channel_t *channel = switch_core_session_get_channel(session);
<span style="color: #00A000">+        const switch_codec_implementation_t *read_impl;</span>
        if (codec) {
                iananame = codec->implementation->iananame;
<span style="color: #800080; font-weight: bold">@@ -165,7 +166,15 @@ static switch_status_t tech_init(private_t *tech_pvt, switch_core_session_t *ses</span>
        switch_core_session_set_read_codec(session, &tech_pvt->read_codec);
        switch_core_session_set_write_codec(session, &tech_pvt->write_codec);
<span style="color: #A00000">-        tech_pvt->read_impl = *tech_pvt->read_codec.implementation;</span>
<span style="color: #00A000">+        if (tech_pvt->flag_mutex) {</span>
<span style="color: #00A000">+                switch_core_timer_destroy(&tech_pvt->timer);</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        read_impl = tech_pvt->read_codec.implementation;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        switch_core_timer_init(&tech_pvt->timer, "soft",</span>
<span style="color: #00A000">+                                                 read_impl->microseconds_per_packet / 1000, read_impl->samples_per_packet * 4, switch_core_session_get_pool(session));</span>
<span style="color: #00A000">+</span>
        if (!tech_pvt->flag_mutex) {
                switch_mutex_init(&tech_pvt->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
<span style="color: #800080; font-weight: bold">@@ -367,6 +376,7 @@ static switch_status_t channel_on_destroy(switch_core_session_t *session)</span>
        tech_pvt = switch_core_session_get_private(session);
        if (tech_pvt) {
<span style="color: #00A000">+                switch_core_timer_destroy(&tech_pvt->timer);</span>
                if (switch_core_codec_ready(&tech_pvt->read_codec)) {
                        switch_core_codec_destroy(&tech_pvt->read_codec);
<span style="color: #800080; font-weight: bold">@@ -558,10 +568,12 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch</span>
                goto end;
        }
<span style="color: #A00000">-        mutex = tech_pvt->mutex;</span>
<span style="color: #00A000">+        switch_core_timer_next(&tech_pvt->timer);</span>
<span style="color: #00A000">+        mutex = tech_pvt->mutex;</span>
<span style="color: #00A000">+        switch_mutex_lock(mutex);</span>
<span style="color: #A00000">-        if (switch_queue_pop_timeout(tech_pvt->frame_queue, &pop, tech_pvt->read_impl.microseconds_per_packet) == SWITCH_STATUS_SUCCESS && pop) {</span>
<span style="color: #00A000">+        if (switch_queue_trypop(tech_pvt->frame_queue, &pop) == SWITCH_STATUS_SUCCESS && pop) {</span>
                if (tech_pvt->write_frame) {
                        switch_frame_free(&tech_pvt->write_frame);
                }
<span style="color: #800080; font-weight: bold">@@ -573,8 +585,6 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch</span>
                switch_set_flag(tech_pvt, TFLAG_CNG);
        }
<span style="color: #A00000">-        switch_mutex_lock(mutex);</span>
<span style="color: #A00000">-</span>
        if (switch_test_flag(tech_pvt, TFLAG_CNG)) {
                unsigned char data[SWITCH_RECOMMENDED_BUFFER_SIZE];
                uint32_t flag = 0;
<span style="color: #800080; font-weight: bold">@@ -765,6 +775,8 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s</span>
                                switch_frame_free(&frame);
                        }
<span style="color: #00A000">+                        switch_core_timer_sync(&tech_pvt->timer);</span>
<span style="color: #00A000">+</span>
                }
                break;
        default:
</pre></div>
<div class="highlight"><pre>committer: Anthony Minessale
comments:
try to fix SOA problem with early and answer audio with dissimilar sdp
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c</span>
<span style="color: #000080; font-weight: bold">index 6c91ce1..8bceb3b 100644</span>
<span style="color: #A00000">--- a/src/mod/endpoints/mod_sofia/mod_sofia.c</span>
<span style="color: #00A000">+++ b/src/mod/endpoints/mod_sofia/mod_sofia.c</span>
<span style="color: #800080; font-weight: bold">@@ -707,11 +707,20 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)</span>
                cid = generate_pai_str(tech_pvt);
<span style="color: #A00000">-                if (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE) && tech_pvt->early_sdp && strcmp(tech_pvt->early_sdp, tech_pvt->local_sdp_str)) {</span>
<span style="color: #A00000">-                        /* The SIP RFC for SOA forbids sending a 183 with one sdp then a 200 with another but it won't do us much good unless </span>
<span style="color: #A00000">-                         we do so in this case we will abandon the SOA rules and go rogue.</span>
<span style="color: #A00000">-                         */</span>
<span style="color: #A00000">-                        sofia_clear_flag(tech_pvt, TFLAG_ENABLE_SOA);</span>
<span style="color: #00A000">+                if (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE) && tech_pvt->early_sdp) {</span>
<span style="color: #00A000">+                        char *a, *b;</span>
<span style="color: #00A000">+                        </span>
<span style="color: #00A000">+                        /* start at the s= line to avoid some devices who update the o= between messages */</span>
<span style="color: #00A000">+                        a = strstr(tech_pvt->early_sdp, "s=");</span>
<span style="color: #00A000">+                        b = strstr(tech_pvt->local_sdp_str, "s=");</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                        if (!a || !b || strcmp(a, b)) {</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                                /* The SIP RFC for SOA forbids sending a 183 with one sdp then a 200 with another but it won't do us much good unless </span>
<span style="color: #00A000">+                                 we do so in this case we will abandon the SOA rules and go rogue.</span>
<span style="color: #00A000">+                                */</span>
<span style="color: #00A000">+                                sofia_clear_flag(tech_pvt, TFLAG_ENABLE_SOA);</span>
<span style="color: #00A000">+                        }</span>
                }
                if (sofia_use_soa(tech_pvt)) {
</pre></div>
<div class="highlight"><pre>committer: Leon de Rooij
comments:
Merge branch 'master' of ssh://git.freeswitch.org/freeswitch
</pre></div>
<div class="highlight"><pre>committer: Mathieu Parent
comments:
Skinny: handle Enbloc messages
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/endpoints/mod_skinny/skinny_protocol.h b/src/mod/endpoints/mod_skinny/skinny_protocol.h</span>
<span style="color: #000080; font-weight: bold">index 20e7d7f..1a26558 100644</span>
<span style="color: #A00000">--- a/src/mod/endpoints/mod_skinny/skinny_protocol.h</span>
<span style="color: #00A000">+++ b/src/mod/endpoints/mod_skinny/skinny_protocol.h</span>
<span style="color: #800080; font-weight: bold">@@ -68,6 +68,13 @@ struct PACKED keypad_button_message {</span>
uint32_t call_id;
};
<span style="color: #00A000">+/* EnblocCallMessage */</span>
<span style="color: #00A000">+#define ENBLOC_CALL_MESSAGE 0x0004</span>
<span style="color: #00A000">+struct PACKED enbloc_call_message {</span>
<span style="color: #00A000">+ char called_party[24];</span>
<span style="color: #00A000">+ uint32_t line_instance;</span>
<span style="color: #00A000">+};</span>
<span style="color: #00A000">+</span>
/* StimulusMessage */
#define STIMULUS_MESSAGE 0x0005
struct PACKED stimulus_message {
<span style="color: #800080; font-weight: bold">@@ -562,6 +569,7 @@ union skinny_data {</span>
struct register_message reg;
struct port_message port;
struct keypad_button_message keypad_button;
<span style="color: #00A000">+ struct enbloc_call_message enbloc_call;</span>
struct stimulus_message stimulus;
struct off_hook_message off_hook;
struct on_hook_message on_hook;
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/endpoints/mod_skinny/skinny_server.c b/src/mod/endpoints/mod_skinny/skinny_server.c</span>
<span style="color: #000080; font-weight: bold">index 5874be4..e7c761d 100644</span>
<span style="color: #A00000">--- a/src/mod/endpoints/mod_skinny/skinny_server.c</span>
<span style="color: #00A000">+++ b/src/mod/endpoints/mod_skinny/skinny_server.c</span>
<span style="color: #800080; font-weight: bold">@@ -1171,6 +1171,29 @@ switch_status_t skinny_handle_keypad_button_message(listener_t *listener, skinny</span>
        return SWITCH_STATUS_SUCCESS;
}
<span style="color: #00A000">+switch_status_t skinny_handle_enbloc_call_message(listener_t *listener, skinny_message_t *request)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        uint32_t line_instance = 1;</span>
<span style="color: #00A000">+        switch_core_session_t *session = NULL;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        skinny_check_data_length(request, sizeof(request->data.enbloc_call.called_party));</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if(skinny_check_data_length_soft(request, sizeof(request->data.enbloc_call))) {</span>
<span style="color: #00A000">+                if (request->data.enbloc_call.line_instance > 0) {</span>
<span style="color: #00A000">+                        line_instance = request->data.enbloc_call.line_instance;</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        session = skinny_profile_find_session(listener->profile, listener, &line_instance, 0);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if(session) {</span>
<span style="color: #00A000">+                skinny_session_process_dest(session, listener, line_instance, request->data.enbloc_call.called_party, '\0', 0);</span>
<span style="color: #00A000">+                switch_core_session_rwunlock(session);</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return SWITCH_STATUS_SUCCESS;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
switch_status_t skinny_handle_stimulus_message(listener_t *listener, skinny_message_t *request)
{
        switch_status_t status = SWITCH_STATUS_SUCCESS;
<span style="color: #800080; font-weight: bold">@@ -2004,6 +2027,8 @@ switch_status_t skinny_handle_request(listener_t *listener, skinny_message_t *re</span>
                        return skinny_handle_port_message(listener, request);
                case KEYPAD_BUTTON_MESSAGE:
                        return skinny_handle_keypad_button_message(listener, request);
<span style="color: #00A000">+                case ENBLOC_CALL_MESSAGE:</span>
<span style="color: #00A000">+                        return skinny_handle_enbloc_call_message(listener, request);</span>
                case STIMULUS_MESSAGE:
                        return skinny_handle_stimulus_message(listener, request);
                case OFF_HOOK_MESSAGE:
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/endpoints/mod_skinny/skinny_tables.c b/src/mod/endpoints/mod_skinny/skinny_tables.c</span>
<span style="color: #000080; font-weight: bold">index 053b350..466a705 100644</span>
<span style="color: #A00000">--- a/src/mod/endpoints/mod_skinny/skinny_tables.c</span>
<span style="color: #00A000">+++ b/src/mod/endpoints/mod_skinny/skinny_tables.c</span>
<span style="color: #800080; font-weight: bold">@@ -39,6 +39,7 @@ struct skinny_table SKINNY_MESSAGE_TYPES[] = {</span>
{"RegisterMessage", REGISTER_MESSAGE},
{"PortMessage", PORT_MESSAGE},
{"KeypadButtonMessage", KEYPAD_BUTTON_MESSAGE},
<span style="color: #00A000">+ {"EnblocCallMessage", ENBLOC_CALL_MESSAGE},</span>
{"StimulusMessage", STIMULUS_MESSAGE},
{"OffHookMessage", OFF_HOOK_MESSAGE},
{"OnHookMessage", ON_HOOK_MESSAGE},
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/endpoints/mod_skinny/skinny_tables.h b/src/mod/endpoints/mod_skinny/skinny_tables.h</span>
<span style="color: #000080; font-weight: bold">index c119e1f..bc92f9f 100644</span>
<span style="color: #A00000">--- a/src/mod/endpoints/mod_skinny/skinny_tables.h</span>
<span style="color: #00A000">+++ b/src/mod/endpoints/mod_skinny/skinny_tables.h</span>
<span style="color: #800080; font-weight: bold">@@ -87,7 +87,7 @@ uint32_t func(const char *str)\</span>
}
<span style="color: #A00000">-extern struct skinny_table SKINNY_MESSAGE_TYPES[66];</span>
<span style="color: #00A000">+extern struct skinny_table SKINNY_MESSAGE_TYPES[67];</span>
const char *skinny_message_type2str(uint32_t id);
uint32_t skinny_str2message_type(const char *str);
#define SKINNY_PUSH_MESSAGE_TYPES SKINNY_DECLARE_PUSH_MATCH(SKINNY_MESSAGE_TYPES)
</pre></div>
<div class="highlight"><pre>committer: Leon de Rooij
comments:
Merge branch 'master' of ssh://git.freeswitch.org/freeswitch
</pre></div>
<div class="highlight"><pre>committer: Marc Olivier Chouinard
comments:
switch_xml: Fix a lock on reloadxml when stderr write is blocked. Also remove an error parsing print since reason generated were wrong and duplicate.
<span style="color: #000080; font-weight: bold">diff --git a/src/switch_xml.c b/src/switch_xml.c</span>
<span style="color: #000080; font-weight: bold">index fe6a199..964a769 100644</span>
<span style="color: #A00000">--- a/src/switch_xml.c</span>
<span style="color: #00A000">+++ b/src/switch_xml.c</span>
<span style="color: #800080; font-weight: bold">@@ -1286,9 +1286,7 @@ static int preprocess_glob(const char *cwd, const char *pattern, int write_fd, i</span>
        }
        if (glob(pattern, GLOB_NOCHECK, NULL, &glob_data) != 0) {
<span style="color: #A00000">-                if (stderr) {</span>
<span style="color: #A00000">-                        fprintf(stderr, "Error including %s\n", pattern);</span>
<span style="color: #A00000">-                }</span>
<span style="color: #00A000">+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error including %s\n", pattern);</span>
                goto end;
        }
<span style="color: #800080; font-weight: bold">@@ -1299,11 +1297,9 @@ static int preprocess_glob(const char *cwd, const char *pattern, int write_fd, i</span>
                        *e = '\0';
                }
                if (preprocess(dir_path, glob_data.gl_pathv[n], write_fd, rlevel) < 0) {
<span style="color: #A00000">-                        const char *reason = strerror(errno);</span>
                        if (rlevel > 100) {
<span style="color: #A00000">-                                reason = "Maximum recursion limit reached";</span>
<span style="color: #00A000">+                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error including %s (Maximum recursion limit reached)\n", pattern);</span>
                        }
<span style="color: #A00000">-                        fprintf(stderr, "Error including %s (%s)\n", pattern, reason);</span>
                }
                free(dir_path);
        }
</pre></div>
<div class="highlight"><pre>committer: Jeff Lenk
comments:
vs2010 reswig
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx</span>
<span style="color: #000080; font-weight: bold">index 9ebd6ff..808d548 100644</span>
<span style="color: #A00000">--- a/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx</span>
<span style="color: #00A000">+++ b/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx</span>
<span style="color: #800080; font-weight: bold">@@ -8947,6 +8947,22 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_asr_feed(void * jarg1, void * jarg</span>
}
<span style="color: #00A000">+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_asr_feed_dtmf(void * jarg1, void * jarg2, void * jarg3) {</span>
<span style="color: #00A000">+ int jresult ;</span>
<span style="color: #00A000">+ switch_asr_handle_t *arg1 = (switch_asr_handle_t *) 0 ;</span>
<span style="color: #00A000">+ switch_dtmf_t *arg2 = (switch_dtmf_t *) 0 ;</span>
<span style="color: #00A000">+ switch_asr_flag_t *arg3 = (switch_asr_flag_t *) 0 ;</span>
<span style="color: #00A000">+ switch_status_t result;</span>
<span style="color: #00A000">+ </span>
<span style="color: #00A000">+ arg1 = (switch_asr_handle_t *)jarg1; </span>
<span style="color: #00A000">+ arg2 = (switch_dtmf_t *)jarg2; </span>
<span style="color: #00A000">+ arg3 = (switch_asr_flag_t *)jarg3; </span>
<span style="color: #00A000">+ result = (switch_status_t)switch_core_asr_feed_dtmf(arg1,(switch_dtmf_t const *)arg2,arg3);</span>
<span style="color: #00A000">+ jresult = result; </span>
<span style="color: #00A000">+ return jresult;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_asr_check_results(void * jarg1, void * jarg2) {
int jresult ;
switch_asr_handle_t *arg1 = (switch_asr_handle_t *) 0 ;
<span style="color: #800080; font-weight: bold">@@ -9007,6 +9023,46 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_asr_unload_grammar(void * jarg1, c</span>
}
<span style="color: #00A000">+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_asr_enable_grammar(void * jarg1, char * jarg2) {</span>
<span style="color: #00A000">+ int jresult ;</span>
<span style="color: #00A000">+ switch_asr_handle_t *arg1 = (switch_asr_handle_t *) 0 ;</span>
<span style="color: #00A000">+ char *arg2 = (char *) 0 ;</span>
<span style="color: #00A000">+ switch_status_t result;</span>
<span style="color: #00A000">+ </span>
<span style="color: #00A000">+ arg1 = (switch_asr_handle_t *)jarg1; </span>
<span style="color: #00A000">+ arg2 = (char *)jarg2; </span>
<span style="color: #00A000">+ result = (switch_status_t)switch_core_asr_enable_grammar(arg1,(char const *)arg2);</span>
<span style="color: #00A000">+ jresult = result; </span>
<span style="color: #00A000">+ return jresult;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_asr_disable_grammar(void * jarg1, char * jarg2) {</span>
<span style="color: #00A000">+ int jresult ;</span>
<span style="color: #00A000">+ switch_asr_handle_t *arg1 = (switch_asr_handle_t *) 0 ;</span>
<span style="color: #00A000">+ char *arg2 = (char *) 0 ;</span>
<span style="color: #00A000">+ switch_status_t result;</span>
<span style="color: #00A000">+ </span>
<span style="color: #00A000">+ arg1 = (switch_asr_handle_t *)jarg1; </span>
<span style="color: #00A000">+ arg2 = (char *)jarg2; </span>
<span style="color: #00A000">+ result = (switch_status_t)switch_core_asr_disable_grammar(arg1,(char const *)arg2);</span>
<span style="color: #00A000">+ jresult = result; </span>
<span style="color: #00A000">+ return jresult;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_asr_disable_all_grammars(void * jarg1) {</span>
<span style="color: #00A000">+ int jresult ;</span>
<span style="color: #00A000">+ switch_asr_handle_t *arg1 = (switch_asr_handle_t *) 0 ;</span>
<span style="color: #00A000">+ switch_status_t result;</span>
<span style="color: #00A000">+ </span>
<span style="color: #00A000">+ arg1 = (switch_asr_handle_t *)jarg1; </span>
<span style="color: #00A000">+ result = (switch_status_t)switch_core_asr_disable_all_grammars(arg1);</span>
<span style="color: #00A000">+ jresult = result; </span>
<span style="color: #00A000">+ return jresult;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_asr_pause(void * jarg1) {
int jresult ;
switch_asr_handle_t *arg1 = (switch_asr_handle_t *) 0 ;
<span style="color: #800080; font-weight: bold">@@ -18313,6 +18369,94 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_switch_asr_interface_next_get(void * jarg1)</span>
}
<span style="color: #00A000">+SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_interface_asr_enable_grammar_set(void * jarg1, void * jarg2) {</span>
<span style="color: #00A000">+ switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;</span>
<span style="color: #00A000">+ switch_status_t (*arg2)(switch_asr_handle_t *,char const *) = (switch_status_t (*)(switch_asr_handle_t *,char const *)) 0 ;</span>
<span style="color: #00A000">+ </span>
<span style="color: #00A000">+ arg1 = (switch_asr_interface *)jarg1; </span>
<span style="color: #00A000">+ arg2 = (switch_status_t (*)(switch_asr_handle_t *,char const *))jarg2; </span>
<span style="color: #00A000">+ if (arg1) (arg1)->asr_enable_grammar = arg2;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_asr_interface_asr_enable_grammar_get(void * jarg1) {</span>
<span style="color: #00A000">+ void * jresult ;</span>
<span style="color: #00A000">+ switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;</span>
<span style="color: #00A000">+ switch_status_t (*result)(switch_asr_handle_t *,char const *) = 0 ;</span>
<span style="color: #00A000">+ </span>
<span style="color: #00A000">+ arg1 = (switch_asr_interface *)jarg1; </span>
<span style="color: #00A000">+ result = (switch_status_t (*)(switch_asr_handle_t *,char const *)) ((arg1)->asr_enable_grammar);</span>
<span style="color: #00A000">+ jresult = (void *)result; </span>
<span style="color: #00A000">+ return jresult;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_interface_asr_disable_grammar_set(void * jarg1, void * jarg2) {</span>
<span style="color: #00A000">+ switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;</span>
<span style="color: #00A000">+ switch_status_t (*arg2)(switch_asr_handle_t *,char const *) = (switch_status_t (*)(switch_asr_handle_t *,char const *)) 0 ;</span>
<span style="color: #00A000">+ </span>
<span style="color: #00A000">+ arg1 = (switch_asr_interface *)jarg1; </span>
<span style="color: #00A000">+ arg2 = (switch_status_t (*)(switch_asr_handle_t *,char const *))jarg2; </span>
<span style="color: #00A000">+ if (arg1) (arg1)->asr_disable_grammar = arg2;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_asr_interface_asr_disable_grammar_get(void * jarg1) {</span>
<span style="color: #00A000">+ void * jresult ;</span>
<span style="color: #00A000">+ switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;</span>
<span style="color: #00A000">+ switch_status_t (*result)(switch_asr_handle_t *,char const *) = 0 ;</span>
<span style="color: #00A000">+ </span>
<span style="color: #00A000">+ arg1 = (switch_asr_interface *)jarg1; </span>
<span style="color: #00A000">+ result = (switch_status_t (*)(switch_asr_handle_t *,char const *)) ((arg1)->asr_disable_grammar);</span>
<span style="color: #00A000">+ jresult = (void *)result; </span>
<span style="color: #00A000">+ return jresult;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_interface_asr_disable_all_grammars_set(void * jarg1, void * jarg2) {</span>
<span style="color: #00A000">+ switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;</span>
<span style="color: #00A000">+ switch_status_t (*arg2)(switch_asr_handle_t *) = (switch_status_t (*)(switch_asr_handle_t *)) 0 ;</span>
<span style="color: #00A000">+ </span>
<span style="color: #00A000">+ arg1 = (switch_asr_interface *)jarg1; </span>
<span style="color: #00A000">+ arg2 = (switch_status_t (*)(switch_asr_handle_t *))jarg2; </span>
<span style="color: #00A000">+ if (arg1) (arg1)->asr_disable_all_grammars = arg2;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_asr_interface_asr_disable_all_grammars_get(void * jarg1) {</span>
<span style="color: #00A000">+ void * jresult ;</span>
<span style="color: #00A000">+ switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;</span>
<span style="color: #00A000">+ switch_status_t (*result)(switch_asr_handle_t *) = 0 ;</span>
<span style="color: #00A000">+ </span>
<span style="color: #00A000">+ arg1 = (switch_asr_interface *)jarg1; </span>
<span style="color: #00A000">+ result = (switch_status_t (*)(switch_asr_handle_t *)) ((arg1)->asr_disable_all_grammars);</span>
<span style="color: #00A000">+ jresult = (void *)result; </span>
<span style="color: #00A000">+ return jresult;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_interface_asr_feed_dtmf_set(void * jarg1, void * jarg2) {</span>
<span style="color: #00A000">+ switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;</span>
<span style="color: #00A000">+ switch_status_t (*arg2)(switch_asr_handle_t *,switch_dtmf_t const *,switch_asr_flag_t *) = (switch_status_t (*)(switch_asr_handle_t *,switch_dtmf_t const *,switch_asr_flag_t *)) 0 ;</span>
<span style="color: #00A000">+ </span>
<span style="color: #00A000">+ arg1 = (switch_asr_interface *)jarg1; </span>
<span style="color: #00A000">+ arg2 = (switch_status_t (*)(switch_asr_handle_t *,switch_dtmf_t const *,switch_asr_flag_t *))jarg2; </span>
<span style="color: #00A000">+ if (arg1) (arg1)->asr_feed_dtmf = arg2;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_asr_interface_asr_feed_dtmf_get(void * jarg1) {</span>
<span style="color: #00A000">+ void * jresult ;</span>
<span style="color: #00A000">+ switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;</span>
<span style="color: #00A000">+ switch_status_t (*result)(switch_asr_handle_t *,switch_dtmf_t const *,switch_asr_flag_t *) = 0 ;</span>
<span style="color: #00A000">+ </span>
<span style="color: #00A000">+ arg1 = (switch_asr_interface *)jarg1; </span>
<span style="color: #00A000">+ result = (switch_status_t (*)(switch_asr_handle_t *,switch_dtmf_t const *,switch_asr_flag_t *)) ((arg1)->asr_feed_dtmf);</span>
<span style="color: #00A000">+ jresult = (void *)result; </span>
<span style="color: #00A000">+ return jresult;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_asr_interface() {
void * jresult ;
switch_asr_interface *result = 0 ;
<span style="color: #800080; font-weight: bold">@@ -26320,6 +26464,46 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_detect_speech_unload_grammar(void *</span>
}
<span style="color: #00A000">+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_detect_speech_enable_grammar(void * jarg1, char * jarg2) {</span>
<span style="color: #00A000">+ int jresult ;</span>
<span style="color: #00A000">+ switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;</span>
<span style="color: #00A000">+ char *arg2 = (char *) 0 ;</span>
<span style="color: #00A000">+ switch_status_t result;</span>
<span style="color: #00A000">+ </span>
<span style="color: #00A000">+ arg1 = (switch_core_session_t *)jarg1; </span>
<span style="color: #00A000">+ arg2 = (char *)jarg2; </span>
<span style="color: #00A000">+ result = (switch_status_t)switch_ivr_detect_speech_enable_grammar(arg1,(char const *)arg2);</span>
<span style="color: #00A000">+ jresult = result; </span>
<span style="color: #00A000">+ return jresult;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_detect_speech_disable_grammar(void * jarg1, char * jarg2) {</span>
<span style="color: #00A000">+ int jresult ;</span>
<span style="color: #00A000">+ switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;</span>
<span style="color: #00A000">+ char *arg2 = (char *) 0 ;</span>
<span style="color: #00A000">+ switch_status_t result;</span>
<span style="color: #00A000">+ </span>
<span style="color: #00A000">+ arg1 = (switch_core_session_t *)jarg1; </span>
<span style="color: #00A000">+ arg2 = (char *)jarg2; </span>
<span style="color: #00A000">+ result = (switch_status_t)switch_ivr_detect_speech_disable_grammar(arg1,(char const *)arg2);</span>
<span style="color: #00A000">+ jresult = result; </span>
<span style="color: #00A000">+ return jresult;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_detect_speech_disable_all_grammars(void * jarg1) {</span>
<span style="color: #00A000">+ int jresult ;</span>
<span style="color: #00A000">+ switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;</span>
<span style="color: #00A000">+ switch_status_t result;</span>
<span style="color: #00A000">+ </span>
<span style="color: #00A000">+ arg1 = (switch_core_session_t *)jarg1; </span>
<span style="color: #00A000">+ result = (switch_status_t)switch_ivr_detect_speech_disable_all_grammars(arg1);</span>
<span style="color: #00A000">+ jresult = result; </span>
<span style="color: #00A000">+ return jresult;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_set_param_detect_speech(void * jarg1, char * jarg2, char * jarg3) {
int jresult ;
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
<span style="color: #800080; font-weight: bold">@@ -26336,6 +26520,18 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_set_param_detect_speech(void * jarg</span>
}
<span style="color: #00A000">+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_detect_speech_start_input_timers(void * jarg1) {</span>
<span style="color: #00A000">+ int jresult ;</span>
<span style="color: #00A000">+ switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;</span>
<span style="color: #00A000">+ switch_status_t result;</span>
<span style="color: #00A000">+ </span>
<span style="color: #00A000">+ arg1 = (switch_core_session_t *)jarg1; </span>
<span style="color: #00A000">+ result = (switch_status_t)switch_ivr_detect_speech_start_input_timers(arg1);</span>
<span style="color: #00A000">+ jresult = result; </span>
<span style="color: #00A000">+ return jresult;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_record_session(void * jarg1, char * jarg2, unsigned long jarg3, void * jarg4) {
int jresult ;
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/languages/mod_managed/managed/swig.2010.cs b/src/mod/languages/mod_managed/managed/swig.2010.cs</span>
<span style="color: #000080; font-weight: bold">index 059fb89..61c0a4e 100644</span>
<span style="color: #A00000">--- a/src/mod/languages/mod_managed/managed/swig.2010.cs</span>
<span style="color: #00A000">+++ b/src/mod/languages/mod_managed/managed/swig.2010.cs</span>
<span style="color: #800080; font-weight: bold">@@ -2000,6 +2000,11 @@ public class freeswitch {</span>
return ret;
}
<span style="color: #00A000">+ public static switch_status_t switch_core_asr_feed_dtmf(switch_asr_handle ah, switch_dtmf_t dtmf, SWIGTYPE_p_unsigned_long flags) {</span>
<span style="color: #00A000">+ switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_asr_feed_dtmf(switch_asr_handle.getCPtr(ah), switch_dtmf_t.getCPtr(dtmf), SWIGTYPE_p_unsigned_long.getCPtr(flags));</span>
<span style="color: #00A000">+ return ret;</span>
<span style="color: #00A000">+ }</span>
<span style="color: #00A000">+</span>
public static switch_status_t switch_core_asr_check_results(switch_asr_handle ah, SWIGTYPE_p_unsigned_long flags) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_asr_check_results(switch_asr_handle.getCPtr(ah), SWIGTYPE_p_unsigned_long.getCPtr(flags));
return ret;
<span style="color: #800080; font-weight: bold">@@ -2020,6 +2025,21 @@ public class freeswitch {</span>
return ret;
}
<span style="color: #00A000">+ public static switch_status_t switch_core_asr_enable_grammar(switch_asr_handle ah, string name) {</span>
<span style="color: #00A000">+ switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_asr_enable_grammar(switch_asr_handle.getCPtr(ah), name);</span>
<span style="color: #00A000">+ return ret;</span>
<span style="color: #00A000">+ }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+ public static switch_status_t switch_core_asr_disable_grammar(switch_asr_handle ah, string name) {</span>
<span style="color: #00A000">+ switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_asr_disable_grammar(switch_asr_handle.getCPtr(ah), name);</span>
<span style="color: #00A000">+ return ret;</span>
<span style="color: #00A000">+ }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+ public static switch_status_t switch_core_asr_disable_all_grammars(switch_asr_handle ah) {</span>
<span style="color: #00A000">+ switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_asr_disable_all_grammars(switch_asr_handle.getCPtr(ah));</span>
<span style="color: #00A000">+ return ret;</span>
<span style="color: #00A000">+ }</span>
<span style="color: #00A000">+</span>
public static switch_status_t switch_core_asr_pause(switch_asr_handle ah) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_asr_pause(switch_asr_handle.getCPtr(ah));
return ret;
<span style="color: #800080; font-weight: bold">@@ -4070,11 +4090,31 @@ public class freeswitch {</span>
return ret;
}
<span style="color: #00A000">+ public static switch_status_t switch_ivr_detect_speech_enable_grammar(SWIGTYPE_p_switch_core_session session, string name) {</span>
<span style="color: #00A000">+ switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_detect_speech_enable_grammar(SWIGTYPE_p_switch_core_session.getCPtr(session), name);</span>
<span style="color: #00A000">+ return ret;</span>
<span style="color: #00A000">+ }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+ public static switch_status_t switch_ivr_detect_speech_disable_grammar(SWIGTYPE_p_switch_core_session session, string name) {</span>
<span style="color: #00A000">+ switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_detect_speech_disable_grammar(SWIGTYPE_p_switch_core_session.getCPtr(session), name);</span>
<span style="color: #00A000">+ return ret;</span>
<span style="color: #00A000">+ }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+ public static switch_status_t switch_ivr_detect_speech_disable_all_grammars(SWIGTYPE_p_switch_core_session session) {</span>
<span style="color: #00A000">+ switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_detect_speech_disable_all_grammars(SWIGTYPE_p_switch_core_session.getCPtr(session));</span>
<span style="color: #00A000">+ return ret;</span>
<span style="color: #00A000">+ }</span>
<span style="color: #00A000">+</span>
public static switch_status_t switch_ivr_set_param_detect_speech(SWIGTYPE_p_switch_core_session session, string name, string val) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_set_param_detect_speech(SWIGTYPE_p_switch_core_session.getCPtr(session), name, val);
return ret;
}
<span style="color: #00A000">+ public static switch_status_t switch_ivr_detect_speech_start_input_timers(SWIGTYPE_p_switch_core_session session) {</span>
<span style="color: #00A000">+ switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_detect_speech_start_input_timers(SWIGTYPE_p_switch_core_session.getCPtr(session));</span>
<span style="color: #00A000">+ return ret;</span>
<span style="color: #00A000">+ }</span>
<span style="color: #00A000">+</span>
public static switch_status_t switch_ivr_record_session(SWIGTYPE_p_switch_core_session session, string file, uint limit, switch_file_handle fh) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_record_session(SWIGTYPE_p_switch_core_session.getCPtr(session), file, limit, switch_file_handle.getCPtr(fh));
return ret;
<span style="color: #800080; font-weight: bold">@@ -7907,6 +7947,9 @@ class freeswitchPINVOKE {</span>
[DllImport("mod_managed", EntryPoint="CSharp_switch_core_asr_feed")]
public static extern int switch_core_asr_feed(HandleRef jarg1, HandleRef jarg2, uint jarg3, HandleRef jarg4);
<span style="color: #00A000">+ [DllImport("mod_managed", EntryPoint="CSharp_switch_core_asr_feed_dtmf")]</span>
<span style="color: #00A000">+ public static extern int switch_core_asr_feed_dtmf(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3);</span>
<span style="color: #00A000">+</span>
[DllImport("mod_managed", EntryPoint="CSharp_switch_core_asr_check_results")]
public static extern int switch_core_asr_check_results(HandleRef jarg1, HandleRef jarg2);
<span style="color: #800080; font-weight: bold">@@ -7919,6 +7962,15 @@ class freeswitchPINVOKE {</span>
[DllImport("mod_managed", EntryPoint="CSharp_switch_core_asr_unload_grammar")]
public static extern int switch_core_asr_unload_grammar(HandleRef jarg1, string jarg2);
<span style="color: #00A000">+ [DllImport("mod_managed", EntryPoint="CSharp_switch_core_asr_enable_grammar")]</span>
<span style="color: #00A000">+ public static extern int switch_core_asr_enable_grammar(HandleRef jarg1, string jarg2);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+ [DllImport("mod_managed", EntryPoint="CSharp_switch_core_asr_disable_grammar")]</span>
<span style="color: #00A000">+ public static extern int switch_core_asr_disable_grammar(HandleRef jarg1, string jarg2);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+ [DllImport("mod_managed", EntryPoint="CSharp_switch_core_asr_disable_all_grammars")]</span>
<span style="color: #00A000">+ public static extern int switch_core_asr_disable_all_grammars(HandleRef jarg1);</span>
<span style="color: #00A000">+</span>
[DllImport("mod_managed", EntryPoint="CSharp_switch_core_asr_pause")]
public static extern int switch_core_asr_pause(HandleRef jarg1);
<span style="color: #800080; font-weight: bold">@@ -10196,6 +10248,30 @@ class freeswitchPINVOKE {</span>
[DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_next_get")]
public static extern IntPtr switch_asr_interface_next_get(HandleRef jarg1);
<span style="color: #00A000">+ [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_enable_grammar_set")]</span>
<span style="color: #00A000">+ public static extern void switch_asr_interface_asr_enable_grammar_set(HandleRef jarg1, HandleRef jarg2);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+ [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_enable_grammar_get")]</span>
<span style="color: #00A000">+ public static extern IntPtr switch_asr_interface_asr_enable_grammar_get(HandleRef jarg1);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+ [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_disable_grammar_set")]</span>
<span style="color: #00A000">+ public static extern void switch_asr_interface_asr_disable_grammar_set(HandleRef jarg1, HandleRef jarg2);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+ [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_disable_grammar_get")]</span>
<span style="color: #00A000">+ public static extern IntPtr switch_asr_interface_asr_disable_grammar_get(HandleRef jarg1);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+ [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_disable_all_grammars_set")]</span>
<span style="color: #00A000">+ public static extern void switch_asr_interface_asr_disable_all_grammars_set(HandleRef jarg1, HandleRef jarg2);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+ [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_disable_all_grammars_get")]</span>
<span style="color: #00A000">+ public static extern IntPtr switch_asr_interface_asr_disable_all_grammars_get(HandleRef jarg1);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+ [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_feed_dtmf_set")]</span>
<span style="color: #00A000">+ public static extern void switch_asr_interface_asr_feed_dtmf_set(HandleRef jarg1, HandleRef jarg2);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+ [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_feed_dtmf_get")]</span>
<span style="color: #00A000">+ public static extern IntPtr switch_asr_interface_asr_feed_dtmf_get(HandleRef jarg1);</span>
<span style="color: #00A000">+</span>
[DllImport("mod_managed", EntryPoint="CSharp_new_switch_asr_interface")]
public static extern IntPtr new_switch_asr_interface();
<span style="color: #800080; font-weight: bold">@@ -12140,9 +12216,21 @@ class freeswitchPINVOKE {</span>
[DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_detect_speech_unload_grammar")]
public static extern int switch_ivr_detect_speech_unload_grammar(HandleRef jarg1, string jarg2);
<span style="color: #00A000">+ [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_detect_speech_enable_grammar")]</span>
<span style="color: #00A000">+ public static extern int switch_ivr_detect_speech_enable_grammar(HandleRef jarg1, string jarg2);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+ [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_detect_speech_disable_grammar")]</span>
<span style="color: #00A000">+ public static extern int switch_ivr_detect_speech_disable_grammar(HandleRef jarg1, string jarg2);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+ [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_detect_speech_disable_all_grammars")]</span>
<span style="color: #00A000">+ public static extern int switch_ivr_detect_speech_disable_all_grammars(HandleRef jarg1);</span>
<span style="color: #00A000">+</span>
[DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_set_param_detect_speech")]
public static extern int switch_ivr_set_param_detect_speech(HandleRef jarg1, string jarg2, string jarg3);
<span style="color: #00A000">+ [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_detect_speech_start_input_timers")]</span>
<span style="color: #00A000">+ public static extern int switch_ivr_detect_speech_start_input_timers(HandleRef jarg1);</span>
<span style="color: #00A000">+</span>
[DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_record_session")]
public static extern int switch_ivr_record_session(HandleRef jarg1, string jarg2, uint jarg3, HandleRef jarg4);
<span style="color: #800080; font-weight: bold">@@ -14967,6 +15055,36 @@ namespace FreeSWITCH.Native {</span>
using System;
using System.Runtime.InteropServices;
<span style="color: #00A000">+public class SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__switch_dtmf_t_p_unsigned_long__switch_status_t {</span>
<span style="color: #00A000">+ private HandleRef swigCPtr;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+ internal SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__switch_dtmf_t_p_unsigned_long__switch_status_t(IntPtr cPtr, bool futureUse) {</span>
<span style="color: #00A000">+ swigCPtr = new HandleRef(this, cPtr);</span>
<span style="color: #00A000">+ }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+ protected SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__switch_dtmf_t_p_unsigned_long__switch_status_t() {</span>
<span style="color: #00A000">+ swigCPtr = new HandleRef(null, IntPtr.Zero);</span>
<span style="color: #00A000">+ }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+ internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__switch_dtmf_t_p_unsigned_long__switch_status_t obj) {</span>
<span style="color: #00A000">+ return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;</span>
<span style="color: #00A000">+ }</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+/* ----------------------------------------------------------------------------</span>
<span style="color: #00A000">+ * This file was automatically generated by SWIG (http://www.swig.org).</span>
<span style="color: #00A000">+ * Version 2.0.1</span>
<span style="color: #00A000">+ *</span>
<span style="color: #00A000">+ * Do not make changes to this file unless you know what you are doing--modify</span>
<span style="color: #00A000">+ * the SWIG interface file instead.</span>
<span style="color: #00A000">+ * ----------------------------------------------------------------------------- */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+namespace FreeSWITCH.Native {</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+using System;</span>
<span style="color: #00A000">+using System.Runtime.InteropServices;</span>
<span style="color: #00A000">+</span>
public class SWIGTYPE_p_f_p_switch_asr_handle_p_unsigned_long__switch_status_t {
private HandleRef swigCPtr;
<span style="color: #800080; font-weight: bold">@@ -19993,6 +20111,50 @@ public class switch_asr_interface : IDisposable {</span>
}
}
<span style="color: #00A000">+ public SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char__switch_status_t asr_enable_grammar {</span>
<span style="color: #00A000">+ set {</span>
<span style="color: #00A000">+ freeswitchPINVOKE.switch_asr_interface_asr_enable_grammar_set(swigCPtr, SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char__switch_status_t.getCPtr(value));</span>
<span style="color: #00A000">+ } </span>
<span style="color: #00A000">+ get {</span>
<span style="color: #00A000">+ IntPtr cPtr = freeswitchPINVOKE.switch_asr_interface_asr_enable_grammar_get(swigCPtr);</span>
<span style="color: #00A000">+ SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char__switch_status_t(cPtr, false);</span>
<span style="color: #00A000">+ return ret;</span>
<span style="color: #00A000">+ } </span>
<span style="color: #00A000">+ }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+ public SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char__switch_status_t asr_disable_grammar {</span>
<span style="color: #00A000">+ set {</span>
<span style="color: #00A000">+ freeswitchPINVOKE.switch_asr_interface_asr_disable_grammar_set(swigCPtr, SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char__switch_status_t.getCPtr(value));</span>
<span style="color: #00A000">+ } </span>
<span style="color: #00A000">+ get {</span>
<span style="color: #00A000">+ IntPtr cPtr = freeswitchPINVOKE.switch_asr_interface_asr_disable_grammar_get(swigCPtr);</span>
<span style="color: #00A000">+ SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char__switch_status_t(cPtr, false);</span>
<span style="color: #00A000">+ return ret;</span>
<span style="color: #00A000">+ } </span>
<span style="color: #00A000">+ }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+ public SWIGTYPE_p_f_p_switch_asr_handle__switch_status_t asr_disable_all_grammars {</span>
<span style="color: #00A000">+ set {</span>
<span style="color: #00A000">+ freeswitchPINVOKE.switch_asr_interface_asr_disable_all_grammars_set(swigCPtr, SWIGTYPE_p_f_p_switch_asr_handle__switch_status_t.getCPtr(value));</span>
<span style="color: #00A000">+ } </span>
<span style="color: #00A000">+ get {</span>
<span style="color: #00A000">+ IntPtr cPtr = freeswitchPINVOKE.switch_asr_interface_asr_disable_all_grammars_get(swigCPtr);</span>
<span style="color: #00A000">+ SWIGTYPE_p_f_p_switch_asr_handle__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_asr_handle__switch_status_t(cPtr, false);</span>
<span style="color: #00A000">+ return ret;</span>
<span style="color: #00A000">+ } </span>
<span style="color: #00A000">+ }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+ public SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__switch_dtmf_t_p_unsigned_long__switch_status_t asr_feed_dtmf {</span>
<span style="color: #00A000">+ set {</span>
<span style="color: #00A000">+ freeswitchPINVOKE.switch_asr_interface_asr_feed_dtmf_set(swigCPtr, SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__switch_dtmf_t_p_unsigned_long__switch_status_t.getCPtr(value));</span>
<span style="color: #00A000">+ } </span>
<span style="color: #00A000">+ get {</span>
<span style="color: #00A000">+ IntPtr cPtr = freeswitchPINVOKE.switch_asr_interface_asr_feed_dtmf_get(swigCPtr);</span>
<span style="color: #00A000">+ SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__switch_dtmf_t_p_unsigned_long__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__switch_dtmf_t_p_unsigned_long__switch_status_t(cPtr, false);</span>
<span style="color: #00A000">+ return ret;</span>
<span style="color: #00A000">+ } </span>
<span style="color: #00A000">+ }</span>
<span style="color: #00A000">+</span>
public switch_asr_interface() : this(freeswitchPINVOKE.new_switch_asr_interface(), true) {
}
<span style="color: #800080; font-weight: bold">@@ -28589,7 +28751,8 @@ public enum switch_rtp_bug_flag_t {</span>
RTP_BUG_IGNORE_MARK_BIT = (1 << 2),
RTP_BUG_SEND_LINEAR_TIMESTAMPS = (1 << 3),
RTP_BUG_START_SEQ_AT_ZERO = (1 << 4),
<span style="color: #A00000">- RTP_BUG_NEVER_SEND_MARKER = (1 << 5)</span>
<span style="color: #00A000">+ RTP_BUG_NEVER_SEND_MARKER = (1 << 5),</span>
<span style="color: #00A000">+ RTP_BUG_IGNORE_DTMF_DURATION = (1 << 6)</span>
}
}
<span style="color: #800080; font-weight: bold">@@ -30446,7 +30609,7 @@ public enum switch_status_t {</span>
SWITCH_STATUS_FALSE,
SWITCH_STATUS_TIMEOUT,
SWITCH_STATUS_RESTART,
<span style="color: #A00000">- SWITCH_STATUS_TERM,</span>
<span style="color: #00A000">+ SWITCH_STATUS_INTR,</span>
SWITCH_STATUS_NOTIMPL,
SWITCH_STATUS_MEMERR,
SWITCH_STATUS_NOOP,
<span style="color: #800080; font-weight: bold">@@ -30463,6 +30626,7 @@ public enum switch_status_t {</span>
SWITCH_STATUS_TOO_SMALL,
SWITCH_STATUS_FOUND,
SWITCH_STATUS_CONTINUE,
<span style="color: #00A000">+ SWITCH_STATUS_TERM,</span>
SWITCH_STATUS_NOT_INITALIZED
}
</pre></div>
<div class="highlight"><pre>committer: Michael Jerris
comments:
add more details to xml_curl errors
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c b/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c</span>
<span style="color: #000080; font-weight: bold">index 9bf837e..bc143d7 100644</span>
<span style="color: #A00000">--- a/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c</span>
<span style="color: #00A000">+++ b/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c</span>
<span style="color: #800080; font-weight: bold">@@ -293,12 +293,12 @@ static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, con</span>
        }
        if (config_data.err) {
<span style="color: #A00000">-                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error encountered!\n");</span>
<span style="color: #00A000">+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error encountered! [%s]\ndata: [%s]\n", binding->url, data);</span>
                xml = NULL;
        } else {
                if (httpRes == 200) {
                        if (!(xml = switch_xml_parse_file(filename))) {
<span style="color: #A00000">-                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Parsing Result!\n");</span>
<span style="color: #00A000">+                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Parsing Result! [%s]\ndata: [%s]\n", binding->url, data);</span>
                        }
                } else {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Received HTTP error %ld trying to fetch %s\ndata: [%s]\n", httpRes, binding->url,
</pre></div>
<div class="highlight"><pre>committer: Brian West
comments:
swigall
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.cxx</span>
<span style="color: #000080; font-weight: bold">index 3ee6ff6..e91de6d 100644</span>
<span style="color: #A00000">--- a/src/mod/languages/mod_managed/freeswitch_wrap.cxx</span>
<span style="color: #00A000">+++ b/src/mod/languages/mod_managed/freeswitch_wrap.cxx</span>
<span style="color: #800080; font-weight: bold">@@ -9238,6 +9238,22 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_asr_feed(void * jarg1, void * jarg</span>
}
<span style="color: #00A000">+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_asr_feed_dtmf(void * jarg1, void * jarg2, void * jarg3) {</span>
<span style="color: #00A000">+ int jresult ;</span>
<span style="color: #00A000">+ switch_asr_handle_t *arg1 = (switch_asr_handle_t *) 0 ;</span>
<span style="color: #00A000">+ switch_dtmf_t *arg2 = (switch_dtmf_t *) 0 ;</span>
<span style="color: #00A000">+ switch_asr_flag_t *arg3 = (switch_asr_flag_t *) 0 ;</span>
<span style="color: #00A000">+ switch_status_t result;</span>
<span style="color: #00A000">+ </span>
<span style="color: #00A000">+ arg1 = (switch_asr_handle_t *)jarg1; </span>
<span style="color: #00A000">+ arg2 = (switch_dtmf_t *)jarg2; </span>
<span style="color: #00A000">+ arg3 = (switch_asr_flag_t *)jarg3; </span>
<span style="color: #00A000">+ result = (switch_status_t)switch_core_asr_feed_dtmf(arg1,(switch_dtmf_t const *)arg2,arg3);</span>
<span style="color: #00A000">+ jresult = result; </span>
<span style="color: #00A000">+ return jresult;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_asr_check_results(void * jarg1, void * jarg2) {
int jresult ;
switch_asr_handle_t *arg1 = (switch_asr_handle_t *) 0 ;
<span style="color: #800080; font-weight: bold">@@ -9298,6 +9314,46 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_asr_unload_grammar(void * jarg1, c</span>
}
<span style="color: #00A000">+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_asr_enable_grammar(void * jarg1, char * jarg2) {</span>
<span style="color: #00A000">+ int jresult ;</span>
<span style="color: #00A000">+ switch_asr_handle_t *arg1 = (switch_asr_handle_t *) 0 ;</span>
<span style="color: #00A000">+ char *arg2 = (char *) 0 ;</span>
<span style="color: #00A000">+ switch_status_t result;</span>
<span style="color: #00A000">+ </span>
<span style="color: #00A000">+ arg1 = (switch_asr_handle_t *)jarg1; </span>
<span style="color: #00A000">+ arg2 = (char *)jarg2; </span>
<span style="color: #00A000">+ result = (switch_status_t)switch_core_asr_enable_grammar(arg1,(char const *)arg2);</span>
<span style="color: #00A000">+ jresult = result; </span>
<span style="color: #00A000">+ return jresult;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_asr_disable_grammar(void * jarg1, char * jarg2) {</span>
<span style="color: #00A000">+ int jresult ;</span>
<span style="color: #00A000">+ switch_asr_handle_t *arg1 = (switch_asr_handle_t *) 0 ;</span>
<span style="color: #00A000">+ char *arg2 = (char *) 0 ;</span>
<span style="color: #00A000">+ switch_status_t result;</span>
<span style="color: #00A000">+ </span>
<span style="color: #00A000">+ arg1 = (switch_asr_handle_t *)jarg1; </span>
<span style="color: #00A000">+ arg2 = (char *)jarg2; </span>
<span style="color: #00A000">+ result = (switch_status_t)switch_core_asr_disable_grammar(arg1,(char const *)arg2);</span>
<span style="color: #00A000">+ jresult = result; </span>
<span style="color: #00A000">+ return jresult;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_asr_disable_all_grammars(void * jarg1) {</span>
<span style="color: #00A000">+ int jresult ;</span>
<span style="color: #00A000">+ switch_asr_handle_t *arg1 = (switch_asr_handle_t *) 0 ;</span>
<span style="color: #00A000">+ switch_status_t result;</span>
<span style="color: #00A000">+ </span>
<span style="color: #00A000">+ arg1 = (switch_asr_handle_t *)jarg1; </span>
<span style="color: #00A000">+ result = (switch_status_t)switch_core_asr_disable_all_grammars(arg1);</span>
<span style="color: #00A000">+ jresult = result; </span>
<span style="color: #00A000">+ return jresult;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_asr_pause(void * jarg1) {
int jresult ;
switch_asr_handle_t *arg1 = (switch_asr_handle_t *) 0 ;
<span style="color: #800080; font-weight: bold">@@ -18820,6 +18876,98 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_switch_asr_interface_next_get(void * jarg1)</span>
}
<span style="color: #00A000">+SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_interface_asr_enable_grammar_set(void * jarg1, void * jarg2) {</span>
<span style="color: #00A000">+ switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;</span>
<span style="color: #00A000">+ switch_status_t (*arg2)(switch_asr_handle_t *,char const *) = (switch_status_t (*)(switch_asr_handle_t *,char const *)) 0 ;</span>
<span style="color: #00A000">+ </span>
<span style="color: #00A000">+ arg1 = (switch_asr_interface *)jarg1; </span>
<span style="color: #00A000">+ arg2 = (switch_status_t (*)(switch_asr_handle_t *,char const *))jarg2; </span>
<span style="color: #00A000">+ if (arg1) (arg1)->asr_enable_grammar = arg2;</span>
<span style="color: #00A000">+ </span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_asr_interface_asr_enable_grammar_get(void * jarg1) {</span>
<span style="color: #00A000">+ void * jresult ;</span>
<span style="color: #00A000">+ switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;</span>
<span style="color: #00A000">+ switch_status_t (*result)(switch_asr_handle_t *,char const *) = 0 ;</span>
<span style="color: #00A000">+ </span>
<span style="color: #00A000">+ arg1 = (switch_asr_interface *)jarg1; </span>
<span style="color: #00A000">+ result = (switch_status_t (*)(switch_asr_handle_t *,char const *)) ((arg1)->asr_enable_grammar);</span>
<span style="color: #00A000">+ jresult = (void *)result; </span>
<span style="color: #00A000">+ return jresult;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_interface_asr_disable_grammar_set(void * jarg1, void * jarg2) {</span>
<span style="color: #00A000">+ switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;</span>
<span style="color: #00A000">+ switch_status_t (*arg2)(switch_asr_handle_t *,char const *) = (switch_status_t (*)(switch_asr_handle_t *,char const *)) 0 ;</span>
<span style="color: #00A000">+ </span>
<span style="color: #00A000">+ arg1 = (switch_asr_interface *)jarg1; </span>
<span style="color: #00A000">+ arg2 = (switch_status_t (*)(switch_asr_handle_t *,char const *))jarg2; </span>
<span style="color: #00A000">+ if (arg1) (arg1)->asr_disable_grammar = arg2;</span>
<span style="color: #00A000">+ </span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_asr_interface_asr_disable_grammar_get(void * jarg1) {</span>
<span style="color: #00A000">+ void * jresult ;</span>
<span style="color: #00A000">+ switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;</span>
<span style="color: #00A000">+ switch_status_t (*result)(switch_asr_handle_t *,char const *) = 0 ;</span>
<span style="color: #00A000">+ </span>
<span style="color: #00A000">+ arg1 = (switch_asr_interface *)jarg1; </span>
<span style="color: #00A000">+ result = (switch_status_t (*)(switch_asr_handle_t *,char const *)) ((arg1)->asr_disable_grammar);</span>
<span style="color: #00A000">+ jresult = (void *)result; </span>
<span style="color: #00A000">+ return jresult;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_interface_asr_disable_all_grammars_set(void * jarg1, void * jarg2) {</span>
<span style="color: #00A000">+ switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;</span>
<span style="color: #00A000">+ switch_status_t (*arg2)(switch_asr_handle_t *) = (switch_status_t (*)(switch_asr_handle_t *)) 0 ;</span>
<span style="color: #00A000">+ </span>
<span style="color: #00A000">+ arg1 = (switch_asr_interface *)jarg1; </span>
<span style="color: #00A000">+ arg2 = (switch_status_t (*)(switch_asr_handle_t *))jarg2; </span>
<span style="color: #00A000">+ if (arg1) (arg1)->asr_disable_all_grammars = arg2;</span>
<span style="color: #00A000">+ </span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_asr_interface_asr_disable_all_grammars_get(void * jarg1) {</span>
<span style="color: #00A000">+ void * jresult ;</span>
<span style="color: #00A000">+ switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;</span>
<span style="color: #00A000">+ switch_status_t (*result)(switch_asr_handle_t *) = 0 ;</span>
<span style="color: #00A000">+ </span>
<span style="color: #00A000">+ arg1 = (switch_asr_interface *)jarg1; </span>
<span style="color: #00A000">+ result = (switch_status_t (*)(switch_asr_handle_t *)) ((arg1)->asr_disable_all_grammars);</span>
<span style="color: #00A000">+ jresult = (void *)result; </span>
<span style="color: #00A000">+ return jresult;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_interface_asr_feed_dtmf_set(void * jarg1, void * jarg2) {</span>
<span style="color: #00A000">+ switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;</span>
<span style="color: #00A000">+ switch_status_t (*arg2)(switch_asr_handle_t *,switch_dtmf_t const *,switch_asr_flag_t *) = (switch_status_t (*)(switch_asr_handle_t *,switch_dtmf_t const *,switch_asr_flag_t *)) 0 ;</span>
<span style="color: #00A000">+ </span>
<span style="color: #00A000">+ arg1 = (switch_asr_interface *)jarg1; </span>
<span style="color: #00A000">+ arg2 = (switch_status_t (*)(switch_asr_handle_t *,switch_dtmf_t const *,switch_asr_flag_t *))jarg2; </span>
<span style="color: #00A000">+ if (arg1) (arg1)->asr_feed_dtmf = arg2;</span>
<span style="color: #00A000">+ </span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_asr_interface_asr_feed_dtmf_get(void * jarg1) {</span>
<span style="color: #00A000">+ void * jresult ;</span>
<span style="color: #00A000">+ switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;</span>
<span style="color: #00A000">+ switch_status_t (*result)(switch_asr_handle_t *,switch_dtmf_t const *,switch_asr_flag_t *) = 0 ;</span>
<span style="color: #00A000">+ </span>
<span style="color: #00A000">+ arg1 = (switch_asr_interface *)jarg1; </span>
<span style="color: #00A000">+ result = (switch_status_t (*)(switch_asr_handle_t *,switch_dtmf_t const *,switch_asr_flag_t *)) ((arg1)->asr_feed_dtmf);</span>
<span style="color: #00A000">+ jresult = (void *)result; </span>
<span style="color: #00A000">+ return jresult;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_asr_interface() {
void * jresult ;
switch_asr_interface *result = 0 ;
<span style="color: #800080; font-weight: bold">@@ -27013,6 +27161,46 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_detect_speech_unload_grammar(void *</span>
}
<span style="color: #00A000">+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_detect_speech_enable_grammar(void * jarg1, char * jarg2) {</span>
<span style="color: #00A000">+ int jresult ;</span>
<span style="color: #00A000">+ switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;</span>
<span style="color: #00A000">+ char *arg2 = (char *) 0 ;</span>
<span style="color: #00A000">+ switch_status_t result;</span>
<span style="color: #00A000">+ </span>
<span style="color: #00A000">+ arg1 = (switch_core_session_t *)jarg1; </span>
<span style="color: #00A000">+ arg2 = (char *)jarg2; </span>
<span style="color: #00A000">+ result = (switch_status_t)switch_ivr_detect_speech_enable_grammar(arg1,(char const *)arg2);</span>
<span style="color: #00A000">+ jresult = result; </span>
<span style="color: #00A000">+ return jresult;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_detect_speech_disable_grammar(void * jarg1, char * jarg2) {</span>
<span style="color: #00A000">+ int jresult ;</span>
<span style="color: #00A000">+ switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;</span>
<span style="color: #00A000">+ char *arg2 = (char *) 0 ;</span>
<span style="color: #00A000">+ switch_status_t result;</span>
<span style="color: #00A000">+ </span>
<span style="color: #00A000">+ arg1 = (switch_core_session_t *)jarg1; </span>
<span style="color: #00A000">+ arg2 = (char *)jarg2; </span>
<span style="color: #00A000">+ result = (switch_status_t)switch_ivr_detect_speech_disable_grammar(arg1,(char const *)arg2);</span>
<span style="color: #00A000">+ jresult = result; </span>
<span style="color: #00A000">+ return jresult;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_detect_speech_disable_all_grammars(void * jarg1) {</span>
<span style="color: #00A000">+ int jresult ;</span>
<span style="color: #00A000">+ switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;</span>
<span style="color: #00A000">+ switch_status_t result;</span>
<span style="color: #00A000">+ </span>
<span style="color: #00A000">+ arg1 = (switch_core_session_t *)jarg1; </span>
<span style="color: #00A000">+ result = (switch_status_t)switch_ivr_detect_speech_disable_all_grammars(arg1);</span>
<span style="color: #00A000">+ jresult = result; </span>
<span style="color: #00A000">+ return jresult;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_set_param_detect_speech(void * jarg1, char * jarg2, char * jarg3) {
int jresult ;
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
<span style="color: #800080; font-weight: bold">@@ -27029,6 +27217,18 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_set_param_detect_speech(void * jarg</span>
}
<span style="color: #00A000">+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_detect_speech_start_input_timers(void * jarg1) {</span>
<span style="color: #00A000">+ int jresult ;</span>
<span style="color: #00A000">+ switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;</span>
<span style="color: #00A000">+ switch_status_t result;</span>
<span style="color: #00A000">+ </span>
<span style="color: #00A000">+ arg1 = (switch_core_session_t *)jarg1; </span>
<span style="color: #00A000">+ result = (switch_status_t)switch_ivr_detect_speech_start_input_timers(arg1);</span>
<span style="color: #00A000">+ jresult = result; </span>
<span style="color: #00A000">+ return jresult;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_record_session(void * jarg1, char * jarg2, unsigned long jarg3, void * jarg4) {
int jresult ;
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/languages/mod_managed/managed/swig.cs b/src/mod/languages/mod_managed/managed/swig.cs</span>
<span style="color: #000080; font-weight: bold">index 48d585e..1f02c3f 100644</span>
<span style="color: #A00000">--- a/src/mod/languages/mod_managed/managed/swig.cs</span>
<span style="color: #00A000">+++ b/src/mod/languages/mod_managed/managed/swig.cs</span>
<span style="color: #800080; font-weight: bold">@@ -1990,6 +1990,11 @@ public class freeswitch {</span>
return ret;
}
<span style="color: #00A000">+ public static switch_status_t switch_core_asr_feed_dtmf(switch_asr_handle ah, switch_dtmf_t dtmf, SWIGTYPE_p_unsigned_long flags) {</span>
<span style="color: #00A000">+ switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_asr_feed_dtmf(switch_asr_handle.getCPtr(ah), switch_dtmf_t.getCPtr(dtmf), SWIGTYPE_p_unsigned_long.getCPtr(flags));</span>
<span style="color: #00A000">+ return ret;</span>
<span style="color: #00A000">+ }</span>
<span style="color: #00A000">+</span>
public static switch_status_t switch_core_asr_check_results(switch_asr_handle ah, SWIGTYPE_p_unsigned_long flags) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_asr_check_results(switch_asr_handle.getCPtr(ah), SWIGTYPE_p_unsigned_long.getCPtr(flags));
return ret;
<span style="color: #800080; font-weight: bold">@@ -2010,6 +2015,21 @@ public class freeswitch {</span>
return ret;
}
<span style="color: #00A000">+ public static switch_status_t switch_core_asr_enable_grammar(switch_asr_handle ah, string name) {</span>
<span style="color: #00A000">+ switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_asr_enable_grammar(switch_asr_handle.getCPtr(ah), name);</span>
<span style="color: #00A000">+ return ret;</span>
<span style="color: #00A000">+ }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+ public static switch_status_t switch_core_asr_disable_grammar(switch_asr_handle ah, string name) {</span>
<span style="color: #00A000">+ switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_asr_disable_grammar(switch_asr_handle.getCPtr(ah), name);</span>
<span style="color: #00A000">+ return ret;</span>
<span style="color: #00A000">+ }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+ public static switch_status_t switch_core_asr_disable_all_grammars(switch_asr_handle ah) {</span>
<span style="color: #00A000">+ switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_asr_disable_all_grammars(switch_asr_handle.getCPtr(ah));</span>
<span style="color: #00A000">+ return ret;</span>
<span style="color: #00A000">+ }</span>
<span style="color: #00A000">+</span>
public static switch_status_t switch_core_asr_pause(switch_asr_handle ah) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_asr_pause(switch_asr_handle.getCPtr(ah));
return ret;
<span style="color: #800080; font-weight: bold">@@ -4060,11 +4080,31 @@ public class freeswitch {</span>
return ret;
}
<span style="color: #00A000">+ public static switch_status_t switch_ivr_detect_speech_enable_grammar(SWIGTYPE_p_switch_core_session session, string name) {</span>
<span style="color: #00A000">+ switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_detect_speech_enable_grammar(SWIGTYPE_p_switch_core_session.getCPtr(session), name);</span>
<span style="color: #00A000">+ return ret;</span>
<span style="color: #00A000">+ }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+ public static switch_status_t switch_ivr_detect_speech_disable_grammar(SWIGTYPE_p_switch_core_session session, string name) {</span>
<span style="color: #00A000">+ switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_detect_speech_disable_grammar(SWIGTYPE_p_switch_core_session.getCPtr(session), name);</span>
<span style="color: #00A000">+ return ret;</span>
<span style="color: #00A000">+ }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+ public static switch_status_t switch_ivr_detect_speech_disable_all_grammars(SWIGTYPE_p_switch_core_session session) {</span>
<span style="color: #00A000">+ switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_detect_speech_disable_all_grammars(SWIGTYPE_p_switch_core_session.getCPtr(session));</span>
<span style="color: #00A000">+ return ret;</span>
<span style="color: #00A000">+ }</span>
<span style="color: #00A000">+</span>
public static switch_status_t switch_ivr_set_param_detect_speech(SWIGTYPE_p_switch_core_session session, string name, string val) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_set_param_detect_speech(SWIGTYPE_p_switch_core_session.getCPtr(session), name, val);
return ret;
}
<span style="color: #00A000">+ public static switch_status_t switch_ivr_detect_speech_start_input_timers(SWIGTYPE_p_switch_core_session session) {</span>
<span style="color: #00A000">+ switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_detect_speech_start_input_timers(SWIGTYPE_p_switch_core_session.getCPtr(session));</span>
<span style="color: #00A000">+ return ret;</span>
<span style="color: #00A000">+ }</span>
<span style="color: #00A000">+</span>
public static switch_status_t switch_ivr_record_session(SWIGTYPE_p_switch_core_session session, string file, uint limit, switch_file_handle fh) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_record_session(SWIGTYPE_p_switch_core_session.getCPtr(session), file, limit, switch_file_handle.getCPtr(fh));
return ret;
<span style="color: #800080; font-weight: bold">@@ -7893,6 +7933,9 @@ class freeswitchPINVOKE {</span>
[DllImport("mod_managed", EntryPoint="CSharp_switch_core_asr_feed")]
public static extern int switch_core_asr_feed(HandleRef jarg1, HandleRef jarg2, uint jarg3, HandleRef jarg4);
<span style="color: #00A000">+ [DllImport("mod_managed", EntryPoint="CSharp_switch_core_asr_feed_dtmf")]</span>
<span style="color: #00A000">+ public static extern int switch_core_asr_feed_dtmf(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3);</span>
<span style="color: #00A000">+</span>
[DllImport("mod_managed", EntryPoint="CSharp_switch_core_asr_check_results")]
public static extern int switch_core_asr_check_results(HandleRef jarg1, HandleRef jarg2);
<span style="color: #800080; font-weight: bold">@@ -7905,6 +7948,15 @@ class freeswitchPINVOKE {</span>
[DllImport("mod_managed", EntryPoint="CSharp_switch_core_asr_unload_grammar")]
public static extern int switch_core_asr_unload_grammar(HandleRef jarg1, string jarg2);
<span style="color: #00A000">+ [DllImport("mod_managed", EntryPoint="CSharp_switch_core_asr_enable_grammar")]</span>
<span style="color: #00A000">+ public static extern int switch_core_asr_enable_grammar(HandleRef jarg1, string jarg2);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+ [DllImport("mod_managed", EntryPoint="CSharp_switch_core_asr_disable_grammar")]</span>
<span style="color: #00A000">+ public static extern int switch_core_asr_disable_grammar(HandleRef jarg1, string jarg2);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+ [DllImport("mod_managed", EntryPoint="CSharp_switch_core_asr_disable_all_grammars")]</span>
<span style="color: #00A000">+ public static extern int switch_core_asr_disable_all_grammars(HandleRef jarg1);</span>
<span style="color: #00A000">+</span>
[DllImport("mod_managed", EntryPoint="CSharp_switch_core_asr_pause")]
public static extern int switch_core_asr_pause(HandleRef jarg1);
<span style="color: #800080; font-weight: bold">@@ -10182,6 +10234,30 @@ class freeswitchPINVOKE {</span>
[DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_next_get")]
public static extern IntPtr switch_asr_interface_next_get(HandleRef jarg1);
<span style="color: #00A000">+ [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_enable_grammar_set")]</span>
<span style="color: #00A000">+ public static extern void switch_asr_interface_asr_enable_grammar_set(HandleRef jarg1, HandleRef jarg2);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+ [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_enable_grammar_get")]</span>
<span style="color: #00A000">+ public static extern IntPtr switch_asr_interface_asr_enable_grammar_get(HandleRef jarg1);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+ [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_disable_grammar_set")]</span>
<span style="color: #00A000">+ public static extern void switch_asr_interface_asr_disable_grammar_set(HandleRef jarg1, HandleRef jarg2);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+ [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_disable_grammar_get")]</span>
<span style="color: #00A000">+ public static extern IntPtr switch_asr_interface_asr_disable_grammar_get(HandleRef jarg1);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+ [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_disable_all_grammars_set")]</span>
<span style="color: #00A000">+ public static extern void switch_asr_interface_asr_disable_all_grammars_set(HandleRef jarg1, HandleRef jarg2);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+ [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_disable_all_grammars_get")]</span>
<span style="color: #00A000">+ public static extern IntPtr switch_asr_interface_asr_disable_all_grammars_get(HandleRef jarg1);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+ [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_feed_dtmf_set")]</span>
<span style="color: #00A000">+ public static extern void switch_asr_interface_asr_feed_dtmf_set(HandleRef jarg1, HandleRef jarg2);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+ [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_feed_dtmf_get")]</span>
<span style="color: #00A000">+ public static extern IntPtr switch_asr_interface_asr_feed_dtmf_get(HandleRef jarg1);</span>
<span style="color: #00A000">+</span>
[DllImport("mod_managed", EntryPoint="CSharp_new_switch_asr_interface")]
public static extern IntPtr new_switch_asr_interface();
<span style="color: #800080; font-weight: bold">@@ -12126,9 +12202,21 @@ class freeswitchPINVOKE {</span>
[DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_detect_speech_unload_grammar")]
public static extern int switch_ivr_detect_speech_unload_grammar(HandleRef jarg1, string jarg2);
<span style="color: #00A000">+ [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_detect_speech_enable_grammar")]</span>
<span style="color: #00A000">+ public static extern int switch_ivr_detect_speech_enable_grammar(HandleRef jarg1, string jarg2);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+ [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_detect_speech_disable_grammar")]</span>
<span style="color: #00A000">+ public static extern int switch_ivr_detect_speech_disable_grammar(HandleRef jarg1, string jarg2);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+ [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_detect_speech_disable_all_grammars")]</span>
<span style="color: #00A000">+ public static extern int switch_ivr_detect_speech_disable_all_grammars(HandleRef jarg1);</span>
<span style="color: #00A000">+</span>
[DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_set_param_detect_speech")]
public static extern int switch_ivr_set_param_detect_speech(HandleRef jarg1, string jarg2, string jarg3);
<span style="color: #00A000">+ [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_detect_speech_start_input_timers")]</span>
<span style="color: #00A000">+ public static extern int switch_ivr_detect_speech_start_input_timers(HandleRef jarg1);</span>
<span style="color: #00A000">+</span>
[DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_record_session")]
public static extern int switch_ivr_record_session(HandleRef jarg1, string jarg2, uint jarg3, HandleRef jarg4);
<span style="color: #800080; font-weight: bold">@@ -14943,6 +15031,36 @@ namespace FreeSWITCH.Native {</span>
using System;
using System.Runtime.InteropServices;
<span style="color: #00A000">+public class SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__switch_dtmf_t_p_unsigned_long__switch_status_t {</span>
<span style="color: #00A000">+ private HandleRef swigCPtr;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+ internal SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__switch_dtmf_t_p_unsigned_long__switch_status_t(IntPtr cPtr, bool futureUse) {</span>
<span style="color: #00A000">+ swigCPtr = new HandleRef(this, cPtr);</span>
<span style="color: #00A000">+ }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+ protected SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__switch_dtmf_t_p_unsigned_long__switch_status_t() {</span>
<span style="color: #00A000">+ swigCPtr = new HandleRef(null, IntPtr.Zero);</span>
<span style="color: #00A000">+ }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+ internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__switch_dtmf_t_p_unsigned_long__switch_status_t obj) {</span>
<span style="color: #00A000">+ return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;</span>
<span style="color: #00A000">+ }</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+/* ----------------------------------------------------------------------------</span>
<span style="color: #00A000">+ * This file was automatically generated by SWIG (http://www.swig.org).</span>
<span style="color: #00A000">+ * Version 1.3.35</span>
<span style="color: #00A000">+ *</span>
<span style="color: #00A000">+ * Do not make changes to this file unless you know what you are doing--modify</span>
<span style="color: #00A000">+ * the SWIG interface file instead.</span>
<span style="color: #00A000">+ * ----------------------------------------------------------------------------- */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+namespace FreeSWITCH.Native {</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+using System;</span>
<span style="color: #00A000">+using System.Runtime.InteropServices;</span>
<span style="color: #00A000">+</span>
public class SWIGTYPE_p_f_p_switch_asr_handle_p_unsigned_long__switch_status_t {
private HandleRef swigCPtr;
<span style="color: #800080; font-weight: bold">@@ -19959,6 +20077,50 @@ public class switch_asr_interface : IDisposable {</span>
}
}
<span style="color: #00A000">+ public SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char__switch_status_t asr_enable_grammar {</span>
<span style="color: #00A000">+ set {</span>
<span style="color: #00A000">+ freeswitchPINVOKE.switch_asr_interface_asr_enable_grammar_set(swigCPtr, SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char__switch_status_t.getCPtr(value));</span>
<span style="color: #00A000">+ } </span>
<span style="color: #00A000">+ get {</span>
<span style="color: #00A000">+ IntPtr cPtr = freeswitchPINVOKE.switch_asr_interface_asr_enable_grammar_get(swigCPtr);</span>
<span style="color: #00A000">+ SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char__switch_status_t(cPtr, false);</span>
<span style="color: #00A000">+ return ret;</span>
<span style="color: #00A000">+ } </span>
<span style="color: #00A000">+ }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+ public SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char__switch_status_t asr_disable_grammar {</span>
<span style="color: #00A000">+ set {</span>
<span style="color: #00A000">+ freeswitchPINVOKE.switch_asr_interface_asr_disable_grammar_set(swigCPtr, SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char__switch_status_t.getCPtr(value));</span>
<span style="color: #00A000">+ } </span>
<span style="color: #00A000">+ get {</span>
<span style="color: #00A000">+ IntPtr cPtr = freeswitchPINVOKE.switch_asr_interface_asr_disable_grammar_get(swigCPtr);</span>
<span style="color: #00A000">+ SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char__switch_status_t(cPtr, false);</span>
<span style="color: #00A000">+ return ret;</span>
<span style="color: #00A000">+ } </span>
<span style="color: #00A000">+ }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+ public SWIGTYPE_p_f_p_switch_asr_handle__switch_status_t asr_disable_all_grammars {</span>
<span style="color: #00A000">+ set {</span>
<span style="color: #00A000">+ freeswitchPINVOKE.switch_asr_interface_asr_disable_all_grammars_set(swigCPtr, SWIGTYPE_p_f_p_switch_asr_handle__switch_status_t.getCPtr(value));</span>
<span style="color: #00A000">+ } </span>
<span style="color: #00A000">+ get {</span>
<span style="color: #00A000">+ IntPtr cPtr = freeswitchPINVOKE.switch_asr_interface_asr_disable_all_grammars_get(swigCPtr);</span>
<span style="color: #00A000">+ SWIGTYPE_p_f_p_switch_asr_handle__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_asr_handle__switch_status_t(cPtr, false);</span>
<span style="color: #00A000">+ return ret;</span>
<span style="color: #00A000">+ } </span>
<span style="color: #00A000">+ }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+ public SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__switch_dtmf_t_p_unsigned_long__switch_status_t asr_feed_dtmf {</span>
<span style="color: #00A000">+ set {</span>
<span style="color: #00A000">+ freeswitchPINVOKE.switch_asr_interface_asr_feed_dtmf_set(swigCPtr, SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__switch_dtmf_t_p_unsigned_long__switch_status_t.getCPtr(value));</span>
<span style="color: #00A000">+ } </span>
<span style="color: #00A000">+ get {</span>
<span style="color: #00A000">+ IntPtr cPtr = freeswitchPINVOKE.switch_asr_interface_asr_feed_dtmf_get(swigCPtr);</span>
<span style="color: #00A000">+ SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__switch_dtmf_t_p_unsigned_long__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__switch_dtmf_t_p_unsigned_long__switch_status_t(cPtr, false);</span>
<span style="color: #00A000">+ return ret;</span>
<span style="color: #00A000">+ } </span>
<span style="color: #00A000">+ }</span>
<span style="color: #00A000">+</span>
public switch_asr_interface() : this(freeswitchPINVOKE.new_switch_asr_interface(), true) {
}
</pre></div>
<div class="highlight"><pre>committer: Moises Silva
comments:
test
<span style="color: #000080; font-weight: bold">diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c</span>
<span style="color: #000080; font-weight: bold">index 529a30f..0f92f59 100644</span>
<span style="color: #A00000">--- a/libs/freetdm/src/ftdm_io.c</span>
<span style="color: #00A000">+++ b/libs/freetdm/src/ftdm_io.c</span>
<span style="color: #800080; font-weight: bold">@@ -37,6 +37,9 @@</span>
*
*/
<span style="color: #00A000">+#ifdef MOYTEST</span>
<span style="color: #00A000">+crap</span>
<span style="color: #00A000">+#endif</span>
#define _GNU_SOURCE
#include "private/ftdm_core.h"
#include <stdarg.h>
</pre></div>
<div class="highlight"><pre>committer: Travis Cross
comments:
lower log-level of a mod_spy message
When a session loses a race to bridge a call, the CHANNEL_BRIDGE event
handler is still run, yet session_locate is going to return null as it
won't get a read-lock on the peer's session. Since this is a normal
and common condition, let's log this as a debug message rather than as
an error condition.
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/applications/mod_spy/mod_spy.c b/src/mod/applications/mod_spy/mod_spy.c</span>
<span style="color: #000080; font-weight: bold">index e0a9317..1797539 100644</span>
<span style="color: #A00000">--- a/src/mod/applications/mod_spy/mod_spy.c</span>
<span style="color: #00A000">+++ b/src/mod/applications/mod_spy/mod_spy.c</span>
<span style="color: #800080; font-weight: bold">@@ -201,7 +201,7 @@ static void event_handler(switch_event_t *event)</span>
                }
                if (!(peer_session = switch_core_session_locate(peer_uuid))) {
<span style="color: #A00000">-                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't locate peer session for uuid %s\n", peer_uuid);</span>
<span style="color: #00A000">+                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Can't locate peer session for uuid %s\n", peer_uuid);</span>
                        return;
                }
</pre></div>
<div class="highlight"><pre>committer: Travis Cross
comments:
fix typo: cant -> can't
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/applications/mod_spy/mod_spy.c b/src/mod/applications/mod_spy/mod_spy.c</span>
<span style="color: #000080; font-weight: bold">index 9986703..e0a9317 100644</span>
<span style="color: #A00000">--- a/src/mod/applications/mod_spy/mod_spy.c</span>
<span style="color: #00A000">+++ b/src/mod/applications/mod_spy/mod_spy.c</span>
<span style="color: #800080; font-weight: bold">@@ -201,14 +201,14 @@ static void event_handler(switch_event_t *event)</span>
                }
                if (!(peer_session = switch_core_session_locate(peer_uuid))) {
<span style="color: #A00000">-                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cant locate peer session for uuid %s\n", peer_uuid);</span>
<span style="color: #00A000">+                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't locate peer session for uuid %s\n", peer_uuid);</span>
                        return;
                }
                peer_channel = switch_core_session_get_channel(peer_session);
                
                if (switch_event_create(&peer_event, SWITCH_EVENT_CHANNEL_BRIDGE) != SWITCH_STATUS_SUCCESS) {
<span style="color: #A00000">-                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cant create bridge event for peer channel %s\n", peer_uuid);</span>
<span style="color: #00A000">+                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't create bridge event for peer channel %s\n", peer_uuid);</span>
                        goto end;
                }
<span style="color: #800080; font-weight: bold">@@ -249,7 +249,7 @@ SWITCH_STANDARD_APP(userspy_function)</span>
                        status = switch_core_hash_insert(globals.spy_hash, argv[0], (void *) uuid);
                        if ((status != SWITCH_STATUS_SUCCESS)) {
<span style="color: #A00000">-                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cant insert to spy hash\n");</span>
<span style="color: #00A000">+                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Can't insert to spy hash\n");</span>
                                switch_channel_hangup(channel, SWITCH_CAUSE_SERVICE_NOT_IMPLEMENTED);
                                switch_thread_rwlock_unlock(globals.spy_hash_lock);
                                return;
</pre></div>
<div class="highlight"><pre>committer: Brian West
comments:
Merge branch 'openmethods-merged-dtmf-20110126' of git://scm.dashjr.org/var/scmroot/git/freeswitch
</pre></div>
<div class="highlight"><pre>committer: Jeff Lenk
comments:
OPENZAP-140 VS2010 build cleanup
<span style="color: #000080; font-weight: bold">diff --git a/libs/freetdm/msvc/testboost/testboost.2010.vcxproj b/libs/freetdm/msvc/testboost/testboost.2010.vcxproj</span>
<span style="color: #000080; font-weight: bold">index 6206148..314440b 100644</span>
<span style="color: #A00000">--- a/libs/freetdm/msvc/testboost/testboost.2010.vcxproj</span>
<span style="color: #00A000">+++ b/libs/freetdm/msvc/testboost/testboost.2010.vcxproj</span>
<span style="color: #800080; font-weight: bold">@@ -105,7 +105,7 @@</span>
<DisableSpecificWarnings>4100;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
<Link>
<span style="color: #A00000">- <AdditionalDependencies>..\..\debug\freetdm.lib;%(AdditionalDependencies)</AdditionalDependencies></span>
<span style="color: #00A000">+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies></span>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<span style="color: #800080; font-weight: bold">@@ -162,7 +162,7 @@</span>
<DisableSpecificWarnings>4100;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
<Link>
<span style="color: #A00000">- <AdditionalDependencies>freetdm.lib;%(AdditionalDependencies)</AdditionalDependencies></span>
<span style="color: #00A000">+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies></span>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<span style="color: #800080; font-weight: bold">@@ -199,7 +199,7 @@</span>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
<span style="color: #A00000">- <AdditionalDependencies>freetdm.lib;%(AdditionalDependencies)</AdditionalDependencies></span>
<span style="color: #00A000">+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies></span>
<AdditionalLibraryDirectories>../../$(PlatformName)\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<span style="color: #000080; font-weight: bold">diff --git a/libs/freetdm/msvc/testboost/testsangomaboost.2010.vcxproj b/libs/freetdm/msvc/testboost/testsangomaboost.2010.vcxproj</span>
<span style="color: #000080; font-weight: bold">index 5994da6..4077a60 100644</span>
<span style="color: #A00000">--- a/libs/freetdm/msvc/testboost/testsangomaboost.2010.vcxproj</span>
<span style="color: #00A000">+++ b/libs/freetdm/msvc/testboost/testsangomaboost.2010.vcxproj</span>
<span style="color: #800080; font-weight: bold">@@ -105,7 +105,7 @@</span>
<DisableSpecificWarnings>4100;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
<Link>
<span style="color: #A00000">- <AdditionalDependencies>..\..\debug\freetdm.lib;%(AdditionalDependencies)</AdditionalDependencies></span>
<span style="color: #00A000">+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies></span>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<span style="color: #800080; font-weight: bold">@@ -162,7 +162,7 @@</span>
<DisableSpecificWarnings>4100;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
<Link>
<span style="color: #A00000">- <AdditionalDependencies>freetdm.lib;%(AdditionalDependencies)</AdditionalDependencies></span>
<span style="color: #00A000">+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies></span>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<span style="color: #800080; font-weight: bold">@@ -199,7 +199,7 @@</span>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
<span style="color: #A00000">- <AdditionalDependencies>freetdm.lib;%(AdditionalDependencies)</AdditionalDependencies></span>
<span style="color: #00A000">+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies></span>
<AdditionalLibraryDirectories>../../$(PlatformName)\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<span style="color: #000080; font-weight: bold">diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.2010.vcxproj b/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.2010.vcxproj</span>
<span style="color: #000080; font-weight: bold">index 78689c3..684e432 100644</span>
<span style="color: #A00000">--- a/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.2010.vcxproj</span>
<span style="color: #00A000">+++ b/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.2010.vcxproj</span>
<span style="color: #800080; font-weight: bold">@@ -61,11 +61,11 @@</span>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<span style="color: #A00000">- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir></span>
<span style="color: #A00000">- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir></span>
<span style="color: #00A000">+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir></span>
<span style="color: #00A000">+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Platform)\$(Configuration)\</IntDir></span>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
<span style="color: #A00000">- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir></span>
<span style="color: #A00000">- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir></span>
<span style="color: #00A000">+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir></span>
<span style="color: #00A000">+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Platform)\$(Configuration)\</IntDir></span>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir>
<span style="color: #800080; font-weight: bold">@@ -102,7 +102,7 @@</span>
<DisableSpecificWarnings>4100;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
<Link>
<span style="color: #A00000">- <AdditionalDependencies>freetdm.lib;%(AdditionalDependencies)</AdditionalDependencies></span>
<span style="color: #00A000">+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies></span>
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<span style="color: #800080; font-weight: bold">@@ -151,7 +151,7 @@</span>
<DisableSpecificWarnings>4100;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
<Link>
<span style="color: #A00000">- <AdditionalDependencies>freetdm.lib;%(AdditionalDependencies)</AdditionalDependencies></span>
<span style="color: #00A000">+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies></span>
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<span style="color: #000080; font-weight: bold">diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.2010.vcxproj b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.2010.vcxproj</span>
<span style="color: #000080; font-weight: bold">index 40d0a73..a21be22 100644</span>
<span style="color: #A00000">--- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.2010.vcxproj</span>
<span style="color: #00A000">+++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.2010.vcxproj</span>
<span style="color: #800080; font-weight: bold">@@ -61,14 +61,14 @@</span>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<span style="color: #A00000">- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir></span>
<span style="color: #A00000">- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir></span>
<span style="color: #00A000">+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir></span>
<span style="color: #00A000">+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Platform)\$(Configuration)\</IntDir></span>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
<span style="color: #A00000">- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir></span>
<span style="color: #A00000">- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir></span>
<span style="color: #00A000">+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir></span>
<span style="color: #00A000">+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Platform)\$(Configuration)\</IntDir></span>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir>
</pre></div>
<div class="highlight"><pre>committer: Daniel Swarbrick
comments:
mostly complete implementation of channel list via SNMP
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/event_handlers/mod_snmp/FREESWITCH-MIB b/src/mod/event_handlers/mod_snmp/FREESWITCH-MIB</span>
<span style="color: #000080; font-weight: bold">index 11c3999..8448526 100644</span>
<span style="color: #A00000">--- a/src/mod/event_handlers/mod_snmp/FREESWITCH-MIB</span>
<span style="color: #00A000">+++ b/src/mod/event_handlers/mod_snmp/FREESWITCH-MIB</span>
<span style="color: #800080; font-weight: bold">@@ -3,11 +3,14 @@ FREESWITCH-MIB DEFINITIONS ::= BEGIN</span>
IMPORTS
OBJECT-TYPE, MODULE-IDENTITY,
Integer32, Gauge32, Counter32, Counter64, TimeTicks,
<span style="color: #A00000">- enterprises,</span>
<span style="color: #00A000">+ enterprises</span>
FROM SNMPv2-SMI
<span style="color: #A00000">- DisplayString</span>
<span style="color: #00A000">+ DisplayString, DateAndTime</span>
FROM SNMPv2-TC
<span style="color: #00A000">+</span>
<span style="color: #00A000">+ InetAddressType, InetAddress</span>
<span style="color: #00A000">+ FROM INET-ADDRESS-MIB</span>
;
<span style="color: #800080; font-weight: bold">@@ -109,13 +112,27 @@ maxSessionsPerSecond OBJECT-TYPE</span>
ChannelEntry ::= SEQUENCE {
<span style="color: #A00000">- chanUUID DisplayString,</span>
<span style="color: #A00000">- chanDirection DisplayString,</span>
<span style="color: #A00000">- chanCreated DisplayString,</span>
<span style="color: #A00000">- chanName DisplayString,</span>
<span style="color: #A00000">- chanState DisplayString,</span>
<span style="color: #A00000">- chanCIDName DisplayString,</span>
<span style="color: #A00000">- chanCIDNum DisplayString</span>
<span style="color: #00A000">+ chanIndex Integer32,</span>
<span style="color: #00A000">+ chanUUID DisplayString,</span>
<span style="color: #00A000">+ chanDirection DisplayString,</span>
<span style="color: #00A000">+ chanCreated DateAndTime,</span>
<span style="color: #00A000">+ chanName DisplayString,</span>
<span style="color: #00A000">+ chanState DisplayString,</span>
<span style="color: #00A000">+ chanCIDName DisplayString,</span>
<span style="color: #00A000">+ chanCIDNum DisplayString,</span>
<span style="color: #00A000">+ chanInetAddressType InetAddressType,</span>
<span style="color: #00A000">+ chanInetAddress InetAddress,</span>
<span style="color: #00A000">+ chanDest DisplayString,</span>
<span style="color: #00A000">+ chanApplication DisplayString,</span>
<span style="color: #00A000">+ chanAppData DisplayString,</span>
<span style="color: #00A000">+ chanDialplan DisplayString,</span>
<span style="color: #00A000">+ chanContext DisplayString,</span>
<span style="color: #00A000">+ chanReadCodec DisplayString,</span>
<span style="color: #00A000">+ chanReadRate Gauge32,</span>
<span style="color: #00A000">+ chanReadBitRate Gauge32,</span>
<span style="color: #00A000">+ chanWriteCodec DisplayString,</span>
<span style="color: #00A000">+ chanWriteRate Gauge32,</span>
<span style="color: #00A000">+ chanWriteBitRate Gauge32</span>
}
channelList OBJECT-TYPE
<span style="color: #800080; font-weight: bold">@@ -135,60 +152,172 @@ channelEntry OBJECT-TYPE</span>
INDEX { chanIndex }
::= { channelList 1 }
<span style="color: #00A000">+chanIndex OBJECT-TYPE</span>
<span style="color: #00A000">+ SYNTAX Integer32</span>
<span style="color: #00A000">+ MAX-ACCESS read-only</span>
<span style="color: #00A000">+ STATUS current</span>
<span style="color: #00A000">+ DESCRIPTION</span>
<span style="color: #00A000">+ "Channel SNMP index."</span>
<span style="color: #00A000">+ ::= { channelEntry 1 }</span>
<span style="color: #00A000">+</span>
chanUUID OBJECT-TYPE
SYNTAX DisplayString
MAX-ACCESS read-only
STATUS current
DESCRIPTION
<span style="color: #A00000">- "The channel UUID."</span>
<span style="color: #A00000">- ::= { channelEntry 1 }</span>
<span style="color: #00A000">+ "Channel UUID."</span>
<span style="color: #00A000">+ ::= { channelEntry 2 }</span>
chanDirection OBJECT-TYPE
SYNTAX DisplayString
MAX-ACCESS read-only
STATUS current
DESCRIPTION
<span style="color: #A00000">- "The channel direction."</span>
<span style="color: #A00000">- ::= { channelEntry 2 }</span>
<span style="color: #00A000">+ "Channel direction."</span>
<span style="color: #00A000">+ ::= { channelEntry 3 }</span>
chanCreated OBJECT-TYPE
<span style="color: #A00000">- SYNTAX DisplayString</span>
<span style="color: #00A000">+ SYNTAX DateAndTime</span>
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Channel creation timestamp."
<span style="color: #A00000">- ::= { channelEntry 3 }</span>
<span style="color: #00A000">+ ::= { channelEntry 4 }</span>
chanName OBJECT-TYPE
SYNTAX DisplayString
MAX-ACCESS read-only
STATUS current
DESCRIPTION
<span style="color: #A00000">- "The channel name."</span>
<span style="color: #A00000">- ::= { channelEntry 4 }</span>
<span style="color: #00A000">+ "Channel name."</span>
<span style="color: #00A000">+ ::= { channelEntry 5 }</span>
chanState OBJECT-TYPE
SYNTAX DisplayString
MAX-ACCESS read-only
STATUS current
DESCRIPTION
<span style="color: #A00000">- "The channel state."</span>
<span style="color: #A00000">- ::= { channelEntry 5 }</span>
<span style="color: #00A000">+ "Channel state."</span>
<span style="color: #00A000">+ ::= { channelEntry 6 }</span>
chanCIDName OBJECT-TYPE
SYNTAX DisplayString
MAX-ACCESS read-only
STATUS current
DESCRIPTION
<span style="color: #A00000">- "The channel caller ID name."</span>
<span style="color: #A00000">- ::= { channelEntry 6 }</span>
<span style="color: #00A000">+ "Channel caller ID name."</span>
<span style="color: #00A000">+ ::= { channelEntry 7 }</span>
chanCIDNum OBJECT-TYPE
SYNTAX DisplayString
MAX-ACCESS read-only
STATUS current
DESCRIPTION
<span style="color: #A00000">- "The channel caller ID number."</span>
<span style="color: #A00000">- ::= { channelEntry 7 }</span>
<span style="color: #00A000">+ "Channel caller ID number."</span>
<span style="color: #00A000">+ ::= { channelEntry 8 }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+chanInetAddressType OBJECT-TYPE</span>
<span style="color: #00A000">+ SYNTAX InetAddressType</span>
<span style="color: #00A000">+ MAX-ACCESS read-only</span>
<span style="color: #00A000">+ STATUS current</span>
<span style="color: #00A000">+ DESCRIPTION</span>
<span style="color: #00A000">+ "Channel originator's IP address type (IPv4 or IPv6)."</span>
<span style="color: #00A000">+ ::= { channelEntry 9 }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+chanInetAddress OBJECT-TYPE</span>
<span style="color: #00A000">+ SYNTAX InetAddress</span>
<span style="color: #00A000">+ MAX-ACCESS read-only</span>
<span style="color: #00A000">+ STATUS current</span>
<span style="color: #00A000">+ DESCRIPTION</span>
<span style="color: #00A000">+ "Channel originator's IP address."</span>
<span style="color: #00A000">+ ::= { channelEntry 10 }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+chanDest OBJECT-TYPE</span>
<span style="color: #00A000">+ SYNTAX DisplayString</span>
<span style="color: #00A000">+ MAX-ACCESS read-only</span>
<span style="color: #00A000">+ STATUS current</span>
<span style="color: #00A000">+ DESCRIPTION</span>
<span style="color: #00A000">+ "Channel destination."</span>
<span style="color: #00A000">+ ::= { channelEntry 11 }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+chanApplication OBJECT-TYPE</span>
<span style="color: #00A000">+ SYNTAX DisplayString</span>
<span style="color: #00A000">+ MAX-ACCESS read-only</span>
<span style="color: #00A000">+ STATUS current</span>
<span style="color: #00A000">+ DESCRIPTION</span>
<span style="color: #00A000">+ "Channel application."</span>
<span style="color: #00A000">+ ::= { channelEntry 12 }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+chanAppData OBJECT-TYPE</span>
<span style="color: #00A000">+ SYNTAX DisplayString</span>
<span style="color: #00A000">+ MAX-ACCESS read-only</span>
<span style="color: #00A000">+ STATUS current</span>
<span style="color: #00A000">+ DESCRIPTION</span>
<span style="color: #00A000">+ "Channel application data."</span>
<span style="color: #00A000">+ ::= { channelEntry 13 }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+chanDialplan OBJECT-TYPE</span>
<span style="color: #00A000">+ SYNTAX DisplayString</span>
<span style="color: #00A000">+ MAX-ACCESS read-only</span>
<span style="color: #00A000">+ STATUS current</span>
<span style="color: #00A000">+ DESCRIPTION</span>
<span style="color: #00A000">+ "Channel dialplan."</span>
<span style="color: #00A000">+ ::= { channelEntry 14 }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+chanContext OBJECT-TYPE</span>
<span style="color: #00A000">+ SYNTAX DisplayString</span>
<span style="color: #00A000">+ MAX-ACCESS read-only</span>
<span style="color: #00A000">+ STATUS current</span>
<span style="color: #00A000">+ DESCRIPTION</span>
<span style="color: #00A000">+ "Channel dialplan context."</span>
<span style="color: #00A000">+ ::= { channelEntry 15 }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+chanReadCodec OBJECT-TYPE</span>
<span style="color: #00A000">+ SYNTAX DisplayString</span>
<span style="color: #00A000">+ MAX-ACCESS read-only</span>
<span style="color: #00A000">+ STATUS current</span>
<span style="color: #00A000">+ DESCRIPTION</span>
<span style="color: #00A000">+ "Channel read codec."</span>
<span style="color: #00A000">+ ::= { channelEntry 16 }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+chanReadRate OBJECT-TYPE</span>
<span style="color: #00A000">+ SYNTAX Gauge32</span>
<span style="color: #00A000">+ MAX-ACCESS read-only</span>
<span style="color: #00A000">+ STATUS current</span>
<span style="color: #00A000">+ DESCRIPTION</span>
<span style="color: #00A000">+ "Channel read samples per second."</span>
<span style="color: #00A000">+ ::= { channelEntry 17 }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+chanReadBitRate OBJECT-TYPE</span>
<span style="color: #00A000">+ SYNTAX Gauge32</span>
<span style="color: #00A000">+ MAX-ACCESS read-only</span>
<span style="color: #00A000">+ STATUS current</span>
<span style="color: #00A000">+ DESCRIPTION</span>
<span style="color: #00A000">+ "Channel read bits per second."</span>
<span style="color: #00A000">+ ::= { channelEntry 18 }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+chanWriteCodec OBJECT-TYPE</span>
<span style="color: #00A000">+ SYNTAX DisplayString</span>
<span style="color: #00A000">+ MAX-ACCESS read-only</span>
<span style="color: #00A000">+ STATUS current</span>
<span style="color: #00A000">+ DESCRIPTION</span>
<span style="color: #00A000">+ "Channel write codec."</span>
<span style="color: #00A000">+ ::= { channelEntry 19 }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+chanWriteRate OBJECT-TYPE</span>
<span style="color: #00A000">+ SYNTAX Gauge32</span>
<span style="color: #00A000">+ MAX-ACCESS read-only</span>
<span style="color: #00A000">+ STATUS current</span>
<span style="color: #00A000">+ DESCRIPTION</span>
<span style="color: #00A000">+ "Channel write samples per second."</span>
<span style="color: #00A000">+ ::= { channelEntry 20 }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+chanWriteBitRate OBJECT-TYPE</span>
<span style="color: #00A000">+ SYNTAX Gauge32</span>
<span style="color: #00A000">+ MAX-ACCESS read-only</span>
<span style="color: #00A000">+ STATUS current</span>
<span style="color: #00A000">+ DESCRIPTION</span>
<span style="color: #00A000">+ "Channel write bits per second."</span>
<span style="color: #00A000">+ ::= { channelEntry 21 }</span>
END
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/event_handlers/mod_snmp/subagent.c b/src/mod/event_handlers/mod_snmp/subagent.c</span>
<span style="color: #000080; font-weight: bold">index 7b9faa7..43975ee 100644</span>
<span style="color: #A00000">--- a/src/mod/event_handlers/mod_snmp/subagent.c</span>
<span style="color: #00A000">+++ b/src/mod/event_handlers/mod_snmp/subagent.c</span>
<span style="color: #800080; font-weight: bold">@@ -42,6 +42,17 @@ netsnmp_handler_registration *ch_reginfo;</span>
uint32_t idx;
<span style="color: #00A000">+static void time_t_to_datetime(time_t epoch, char *buf, switch_size_t buflen)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        struct tm *dt;</span>
<span style="color: #00A000">+        uint16_t year;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        dt = gmtime(&epoch);</span>
<span style="color: #00A000">+        year = dt->tm_year + 1900;</span>
<span style="color: #00A000">+        switch_snprintf(buf, buflen, "%c%c%c%c%c%c%c%c+%c%c", year >> 8, year & 0xff, dt->tm_mon + 1, dt->tm_mday, dt->tm_hour, dt->tm_min, dt->tm_sec, 0, 0, 0);</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
static int sql_count_callback(void *pArg, int argc, char **argv, char **columnNames)
{
        uint32_t *count = (uint32_t *) pArg;
<span style="color: #800080; font-weight: bold">@@ -69,11 +80,31 @@ static int channelList_callback(void *pArg, int argc, char **argv, char **column</span>
        entry->idx = idx++;
        strncpy(entry->uuid, argv[0], sizeof(entry->uuid));
        strncpy(entry->direction, argv[1], sizeof(entry->direction));
<span style="color: #A00000">-        strncpy(entry->created, argv[2], sizeof(entry->created));</span>
<span style="color: #00A000">+        entry->created_epoch = atoi(argv[3]);</span>
        strncpy(entry->name, argv[4], sizeof(entry->name));
        strncpy(entry->state, argv[5], sizeof(entry->state));
        strncpy(entry->cid_name, argv[6], sizeof(entry->cid_name));
        strncpy(entry->cid_num, argv[7], sizeof(entry->cid_num));
<span style="color: #00A000">+        strncpy(entry->dest, argv[9], sizeof(entry->dest));</span>
<span style="color: #00A000">+        strncpy(entry->application, argv[10], sizeof(entry->application));</span>
<span style="color: #00A000">+        strncpy(entry->application_data, argv[11], sizeof(entry->application_data));</span>
<span style="color: #00A000">+        strncpy(entry->dialplan, argv[12], sizeof(entry->dialplan));</span>
<span style="color: #00A000">+        strncpy(entry->context, argv[13], sizeof(entry->context));</span>
<span style="color: #00A000">+        strncpy(entry->read_codec, argv[14], sizeof(entry->read_codec));</span>
<span style="color: #00A000">+        entry->read_rate = atoi(argv[15]);</span>
<span style="color: #00A000">+        entry->read_bitrate = atoi(argv[16]);</span>
<span style="color: #00A000">+        strncpy(entry->write_codec, argv[17], sizeof(entry->write_codec));</span>
<span style="color: #00A000">+        entry->write_rate = atoi(argv[18]);</span>
<span style="color: #00A000">+        entry->write_bitrate = atoi(argv[19]);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        memset(&entry->ip_addr, 0, sizeof(entry->ip_addr));</span>
<span style="color: #00A000">+        if (strchr(argv[8], ':')) {</span>
<span style="color: #00A000">+                switch_inet_pton(AF_INET6, argv[8], &entry->ip_addr);</span>
<span style="color: #00A000">+                entry->addr_family = AF_INET6;</span>
<span style="color: #00A000">+        } else {</span>
<span style="color: #00A000">+                switch_inet_pton(AF_INET, argv[8], &entry->ip_addr);</span>
<span style="color: #00A000">+                entry->addr_family = AF_INET;</span>
<span style="color: #00A000">+        }</span>
        netsnmp_tdata_row_add_index(row, ASN_INTEGER, &entry->idx, sizeof(entry->idx));
        netsnmp_tdata_add_row(ch_table, row);
<span style="color: #800080; font-weight: bold">@@ -128,9 +159,9 @@ void init_subagent(switch_memory_pool_t *pool)</span>
        netsnmp_register_scalar_group(netsnmp_create_handler_registration("systemStats", handle_systemStats, systemStats_oid, OID_LENGTH(systemStats_oid), HANDLER_CAN_RONLY), 1, 7);
        ch_table_info = switch_core_alloc(pool, sizeof(netsnmp_table_registration_info));
<span style="color: #A00000">-        netsnmp_table_helper_add_index(ch_table_info, ASN_INTEGER);</span>
<span style="color: #A00000">-        ch_table_info->min_column = 1;</span>
<span style="color: #A00000">-        ch_table_info->max_column = 7;</span>
<span style="color: #00A000">+        netsnmp_table_helper_add_indexes(ch_table_info, ASN_INTEGER, 0);</span>
<span style="color: #00A000">+        ch_table_info->min_column = CH_INDEX;</span>
<span style="color: #00A000">+        ch_table_info->max_column = CH_WRITE_BITRATE;</span>
        ch_table = netsnmp_tdata_create_table("channelList", 0);
        ch_reginfo = netsnmp_create_handler_registration("channelList", handle_channelList, channelList_oid, OID_LENGTH(channelList_oid), HANDLER_CAN_RONLY);
        netsnmp_tdata_register(ch_reginfo, ch_table, ch_table_info);
<span style="color: #800080; font-weight: bold">@@ -191,15 +222,15 @@ int handle_systemStats(netsnmp_mib_handler *handler, netsnmp_handler_registratio</span>
                        break;
                case SS_SESSIONS_SINCE_STARTUP:
                        int_val = switch_core_session_id() - 1;
<span style="color: #A00000">-                        snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER, (u_char *) &int_val, sizeof(int_val));</span>
<span style="color: #00A000">+                        snmp_set_var_typed_integer(requests->requestvb, ASN_COUNTER, int_val);</span>
                        break;
                case SS_CURRENT_SESSIONS:
                        int_val = switch_core_session_count();
<span style="color: #A00000">-                        snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val));</span>
<span style="color: #00A000">+                        snmp_set_var_typed_integer(requests->requestvb, ASN_GAUGE, int_val);</span>
                        break;
                case SS_MAX_SESSIONS:
                        switch_core_session_ctl(SCSC_MAX_SESSIONS, &int_val);
<span style="color: #A00000">-                        snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val));</span>
<span style="color: #00A000">+                        snmp_set_var_typed_integer(requests->requestvb, ASN_GAUGE, int_val);</span>
                        break;
                case SS_CURRENT_CALLS:
                        {
<span style="color: #800080; font-weight: bold">@@ -213,17 +244,17 @@ int handle_systemStats(netsnmp_mib_handler *handler, netsnmp_handler_registratio</span>
                        gethostname(hostname, sizeof(hostname));
                        sprintf(sql, "SELECT COUNT(*) FROM calls WHERE hostname='%s'", hostname);
                        switch_cache_db_execute_sql_callback(dbh, sql, sql_count_callback, &int_val, NULL);
<span style="color: #A00000">-                        snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val));</span>
<span style="color: #00A000">+                        snmp_set_var_typed_integer(requests->requestvb, ASN_GAUGE, int_val);</span>
                        switch_cache_db_release_db_handle(&dbh);
                        }
                        break;
                case SS_SESSIONS_PER_SECOND:
                        switch_core_session_ctl(SCSC_LAST_SPS, &int_val);
<span style="color: #A00000">-                        snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val));</span>
<span style="color: #00A000">+                        snmp_set_var_typed_integer(requests->requestvb, ASN_GAUGE, int_val);</span>
                        break;
                case SS_MAX_SESSIONS_PER_SECOND:
                        switch_core_session_ctl(SCSC_SPS, &int_val);
<span style="color: #A00000">-                        snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val));</span>
<span style="color: #00A000">+                        snmp_set_var_typed_integer(requests->requestvb, ASN_GAUGE, int_val);</span>
                        break;
                default:
                        snmp_log(LOG_WARNING, "Unregistered OID-suffix requested (%d)\n", (int) subid);
<span style="color: #800080; font-weight: bold">@@ -246,6 +277,7 @@ int handle_channelList(netsnmp_mib_handler *handler, netsnmp_handler_registratio</span>
        netsnmp_request_info *request;
        netsnmp_table_request_info *table_info;
        chan_entry_t *entry;
<span style="color: #00A000">+        char dt_str[12];</span>
        switch (reqinfo->mode) {
        case MODE_GET:
<span style="color: #800080; font-weight: bold">@@ -254,6 +286,9 @@ int handle_channelList(netsnmp_mib_handler *handler, netsnmp_handler_registratio</span>
                        entry = (chan_entry_t *) netsnmp_tdata_extract_entry(request);
                        switch (table_info->colnum) {
<span style="color: #00A000">+                        case CH_INDEX:</span>
<span style="color: #00A000">+                                snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER, entry->idx);</span>
<span style="color: #00A000">+                                break;</span>
                        case CH_UUID:
                                snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR, (u_char *) entry->uuid, strlen(entry->uuid));
                                break;
<span style="color: #800080; font-weight: bold">@@ -261,7 +296,8 @@ int handle_channelList(netsnmp_mib_handler *handler, netsnmp_handler_registratio</span>
                                snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR, (u_char *) entry->direction, strlen(entry->direction));
                                break;
                        case CH_CREATED:
<span style="color: #A00000">-                                snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR, (u_char *) entry->created, strlen(entry->created));</span>
<span style="color: #00A000">+                                time_t_to_datetime(entry->created_epoch, (char *) &dt_str, sizeof(dt_str));</span>
<span style="color: #00A000">+                                snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR, (u_char *) &dt_str, sizeof(dt_str));</span>
                                break;
                        case CH_NAME:
                                snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR, (u_char *) entry->name, strlen(entry->name));
<span style="color: #800080; font-weight: bold">@@ -275,6 +311,53 @@ int handle_channelList(netsnmp_mib_handler *handler, netsnmp_handler_registratio</span>
                        case CH_CID_NUM:
                                snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR, (u_char *) entry->cid_num, strlen(entry->cid_num));
                                break;
<span style="color: #00A000">+                        case CH_IP_ADDR_TYPE:</span>
<span style="color: #00A000">+                                if (entry->addr_family == AF_INET6) {</span>
<span style="color: #00A000">+                                        snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER, INETADDRESSTYPE_IPV6);</span>
<span style="color: #00A000">+                                } else {</span>
<span style="color: #00A000">+                                        snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER, INETADDRESSTYPE_IPV4);</span>
<span style="color: #00A000">+                                }</span>
<span style="color: #00A000">+                                break;</span>
<span style="color: #00A000">+                        case CH_IP_ADDR:</span>
<span style="color: #00A000">+                                if (entry->addr_family == AF_INET6) {</span>
<span style="color: #00A000">+                                        snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR, (u_char *) &entry->ip_addr.v6, sizeof(entry->ip_addr.v6));</span>
<span style="color: #00A000">+                                } else {</span>
<span style="color: #00A000">+                                        snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR, (u_char *) &entry->ip_addr.v4, sizeof(entry->ip_addr.v4));</span>
<span style="color: #00A000">+                                }</span>
<span style="color: #00A000">+                                break;</span>
<span style="color: #00A000">+                        case CH_DEST:</span>
<span style="color: #00A000">+                                snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR, (u_char *) entry->dest, strlen(entry->dest));</span>
<span style="color: #00A000">+                                break;</span>
<span style="color: #00A000">+                        case CH_APPLICATION:</span>
<span style="color: #00A000">+                                snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR, (u_char *) entry->application, strlen(entry->application));</span>
<span style="color: #00A000">+                                break;</span>
<span style="color: #00A000">+                        case CH_APPLICATION_DATA:</span>
<span style="color: #00A000">+                                snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR, (u_char *) entry->application_data, strlen(entry->application_data));</span>
<span style="color: #00A000">+                                break;</span>
<span style="color: #00A000">+                        case CH_DIALPLAN:</span>
<span style="color: #00A000">+                                snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR, (u_char *) entry->dialplan, strlen(entry->dialplan));</span>
<span style="color: #00A000">+                                break;</span>
<span style="color: #00A000">+                        case CH_CONTEXT:</span>
<span style="color: #00A000">+                                snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR, (u_char *) entry->context, strlen(entry->context));</span>
<span style="color: #00A000">+                                break;</span>
<span style="color: #00A000">+                        case CH_READ_CODEC:</span>
<span style="color: #00A000">+                                snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR, (u_char *) entry->read_codec, strlen(entry->read_codec));</span>
<span style="color: #00A000">+                                break;</span>
<span style="color: #00A000">+                        case CH_READ_RATE:</span>
<span style="color: #00A000">+                                snmp_set_var_typed_value(request->requestvb, ASN_GAUGE, (u_char *) &entry->read_rate, sizeof(entry->read_rate));</span>
<span style="color: #00A000">+                                break;</span>
<span style="color: #00A000">+                        case CH_READ_BITRATE:</span>
<span style="color: #00A000">+                                snmp_set_var_typed_value(request->requestvb, ASN_GAUGE, (u_char *) &entry->read_bitrate, sizeof(entry->read_bitrate));</span>
<span style="color: #00A000">+                                break;</span>
<span style="color: #00A000">+                        case CH_WRITE_CODEC:</span>
<span style="color: #00A000">+                                snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR, (u_char *) entry->write_codec, strlen(entry->write_codec));</span>
<span style="color: #00A000">+                                break;</span>
<span style="color: #00A000">+                        case CH_WRITE_RATE:</span>
<span style="color: #00A000">+                                snmp_set_var_typed_value(request->requestvb, ASN_GAUGE, (u_char *) &entry->write_rate, sizeof(entry->write_rate));</span>
<span style="color: #00A000">+                                break;</span>
<span style="color: #00A000">+                        case CH_WRITE_BITRATE:</span>
<span style="color: #00A000">+                                snmp_set_var_typed_value(request->requestvb, ASN_GAUGE, (u_char *) &entry->write_bitrate, sizeof(entry->write_bitrate));</span>
<span style="color: #00A000">+                                break;</span>
                        default:
                                snmp_log(LOG_WARNING, "Unregistered OID-suffix requested (%d)\n", table_info->colnum);
                                netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/event_handlers/mod_snmp/subagent.h b/src/mod/event_handlers/mod_snmp/subagent.h</span>
<span style="color: #000080; font-weight: bold">index 0070b2c..5da87a6 100644</span>
<span style="color: #A00000">--- a/src/mod/event_handlers/mod_snmp/subagent.h</span>
<span style="color: #00A000">+++ b/src/mod/event_handlers/mod_snmp/subagent.h</span>
<span style="color: #800080; font-weight: bold">@@ -15,23 +15,58 @@</span>
#define SS_MAX_SESSIONS_PER_SECOND        7
/* .1.3.6.1.4.1.27880.1.9 */
<span style="color: #A00000">-#define CH_UUID                                1</span>
<span style="color: #A00000">-#define CH_DIRECTION                        2</span>
<span style="color: #A00000">-#define CH_CREATED                        3</span>
<span style="color: #A00000">-#define CH_NAME                                4</span>
<span style="color: #A00000">-#define CH_STATE                        5</span>
<span style="color: #A00000">-#define CH_CID_NAME                        6</span>
<span style="color: #A00000">-#define CH_CID_NUM                        7</span>
<span style="color: #00A000">+#define CH_INDEX                        1</span>
<span style="color: #00A000">+#define CH_UUID                                2</span>
<span style="color: #00A000">+#define CH_DIRECTION                        3</span>
<span style="color: #00A000">+#define CH_CREATED                        4</span>
<span style="color: #00A000">+#define CH_NAME                                5</span>
<span style="color: #00A000">+#define CH_STATE                        6</span>
<span style="color: #00A000">+#define CH_CID_NAME                        7</span>
<span style="color: #00A000">+#define CH_CID_NUM                        8</span>
<span style="color: #00A000">+#define CH_IP_ADDR_TYPE                        9</span>
<span style="color: #00A000">+#define CH_IP_ADDR                        10</span>
<span style="color: #00A000">+#define CH_DEST                                11</span>
<span style="color: #00A000">+#define CH_APPLICATION                        12</span>
<span style="color: #00A000">+#define CH_APPLICATION_DATA                13</span>
<span style="color: #00A000">+#define CH_DIALPLAN                        14</span>
<span style="color: #00A000">+#define CH_CONTEXT                        15</span>
<span style="color: #00A000">+#define CH_READ_CODEC                        16</span>
<span style="color: #00A000">+#define CH_READ_RATE                        17</span>
<span style="color: #00A000">+#define CH_READ_BITRATE                        18</span>
<span style="color: #00A000">+#define CH_WRITE_CODEC                        19</span>
<span style="color: #00A000">+#define CH_WRITE_RATE                        20</span>
<span style="color: #00A000">+#define CH_WRITE_BITRATE                21</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/* Why aren't these in net-snmp-includes.h ? */</span>
<span style="color: #00A000">+#define INETADDRESSTYPE_UNKNOWN                0</span>
<span style="color: #00A000">+#define INETADDRESSTYPE_IPV4                1</span>
<span style="color: #00A000">+#define INETADDRESSTYPE_IPV6                2</span>
<span style="color: #00A000">+#define INETADDRESSTYPE_IPV4Z                3</span>
<span style="color: #00A000">+#define INETADDRESSTYPE_IPV6Z                4</span>
<span style="color: #00A000">+#define INETADDRESSTYPE_DNS                16</span>
typedef struct {
        uint32_t idx;
        char uuid[38];
        char direction[32];
<span style="color: #A00000">-        char created[128];</span>
<span style="color: #00A000">+        time_t created_epoch;</span>
        char name[1024];
        char state[64];
        char cid_name[1024];
        char cid_num[256];
<span style="color: #00A000">+        ip_t ip_addr;</span>
<span style="color: #00A000">+        uint8_t addr_family;</span>
<span style="color: #00A000">+        char dest[1024];</span>
<span style="color: #00A000">+        char application[128];</span>
<span style="color: #00A000">+        char application_data[4096];</span>
<span style="color: #00A000">+        char dialplan[128];</span>
<span style="color: #00A000">+        char context[128];</span>
<span style="color: #00A000">+        char read_codec[128];</span>
<span style="color: #00A000">+        uint32_t read_rate;</span>
<span style="color: #00A000">+        uint32_t read_bitrate;</span>
<span style="color: #00A000">+        char write_codec[128];</span>
<span style="color: #00A000">+        uint32_t write_rate;</span>
<span style="color: #00A000">+        uint32_t write_bitrate;</span>
} chan_entry_t;
void init_subagent(switch_memory_pool_t *pool);
</pre></div>
<div class="highlight"><pre>committer: Leon de Rooij
comments:
Merge branch 'master' of ssh://git.freeswitch.org/freeswitch
</pre></div>
<div class="highlight"><pre>committer: Konrad Hammel
comments:
freetdm: ss7 - bug fix: fix for bug introduced by merge of RELAY work
<span style="color: #000080; font-weight: bold">diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c</span>
<span style="color: #000080; font-weight: bold">index c971179..adee000 100644</span>
<span style="color: #A00000">--- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c</span>
<span style="color: #00A000">+++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c</span>
<span style="color: #800080; font-weight: bold">@@ -495,8 +495,6 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)</span>
        /**************************************************************************/
        case FTDM_CHANNEL_STATE_COLLECT:        /* IAM received but wating on digits */
<span style="color: #A00000">-                isup_intf = &g_ftdm_sngss7_data.cfg.isupIntf[sngss7_info->circuit->infId];</span>
<span style="color: #A00000">-</span>
                if (ftdmchan->last_state == FTDM_CHANNEL_STATE_SUSPENDED) {
                        SS7_DEBUG("re-entering state from processing block/unblock request ... do nothing\n");
                        break;
<span style="color: #800080; font-weight: bold">@@ -516,8 +514,8 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)</span>
                        /*now go to the RING state */
                        ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_RING);
                        
<span style="color: #A00000">-                } else if (i >= isup_intf->min_digits) {</span>
<span style="color: #A00000">-                        SS7_DEBUG_CHAN(ftdmchan, "Received %d digits (min digits = %d)\n", i, isup_intf->min_digits);</span>
<span style="color: #00A000">+                } else if (i >= sngss7_info->circuit->min_digits) {</span>
<span style="color: #00A000">+                        SS7_DEBUG_CHAN(ftdmchan, "Received %d digits (min digits = %d)\n", i, sngss7_info->circuit->min_digits);</span>
                        /*now go to the RING state */
                        ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_RING);
<span style="color: #800080; font-weight: bold">@@ -527,7 +525,7 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)</span>
                        if (ftdmchan->last_state != FTDM_CHANNEL_STATE_IDLE) {
                                SS7_INFO_CHAN(ftdmchan,"Received %d out of %d so far: %s...starting T35\n",
                                                                                i,
<span style="color: #A00000">-                                                                                isup_intf->min_digits,</span>
<span style="color: #00A000">+                                                                                sngss7_info->circuit->min_digits,</span>
                                                                                ftdmchan->caller_data.dnis.digits);
                
                                /* start ISUP t35 */
<span style="color: #000080; font-weight: bold">diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c</span>
<span style="color: #000080; font-weight: bold">index 93f2678..d2fa973 100644</span>
<span style="color: #A00000">--- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c</span>
<span style="color: #00A000">+++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c</span>
<span style="color: #800080; font-weight: bold">@@ -1509,11 +1509,6 @@ static int ftmod_ss7_parse_isup_interface(ftdm_conf_node_t *isup_interface)</span>
                        SS7_DEBUG("Found an isup mptRouteId = %d\n", sng_isup.mtpRouteId);
                /**********************************************************************/
<span style="color: #A00000">-                } else if (!strcasecmp(parm->var, "min_digits")) {</span>
<span style="color: #A00000">-                        sng_isup.min_digits = atoi(parm->val);</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                        SS7_DEBUG("\tFound min_digits = %d\n", sng_isup.min_digits);</span>
<span style="color: #A00000">-                /**********************************************************************/</span>
                } else if (!strcasecmp(parm->var, "ssf")) {
                /**********************************************************************/
                        ret = find_ssf_type_in_map(parm->val);
</pre></div>
<div class="highlight"><pre>committer: Konrad Hammel
comments:
chlog: freetdm: ss7 - update for new licensing, will not work with old licenses                         contact Sangoma (techdesk@sangoma.com) to obtain a new license
<span style="color: #000080; font-weight: bold">diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c</span>
<span style="color: #000080; font-weight: bold">index 42b95a1..15fc1ef 100644</span>
<span style="color: #A00000">--- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c</span>
<span style="color: #00A000">+++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c</span>
<span style="color: #800080; font-weight: bold">@@ -80,8 +80,7 @@ int ft_to_sngss7_cfg_all(void)</span>
                /* start of by checking if the license and sig file are valid */
                if (sng_validate_license(g_ftdm_sngss7_data.cfg.license,
<span style="color: #A00000">-                                                                 g_ftdm_sngss7_data.cfg.signature,</span>
<span style="color: #A00000">-                                                                 g_ftdm_sngss7_data.cfg.spc)) {</span>
<span style="color: #00A000">+                                                                 g_ftdm_sngss7_data.cfg.signature)) {</span>
                        SS7_CRITICAL("License verification failed..ending!\n");
                        return 1;
<span style="color: #000080; font-weight: bold">diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c</span>
<span style="color: #000080; font-weight: bold">index 1dfcab4..f4143fc 100644</span>
<span style="color: #A00000">--- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c</span>
<span style="color: #00A000">+++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c</span>
<span style="color: #800080; font-weight: bold">@@ -79,8 +79,8 @@ void handle_sng_log(uint8_t level, char *fmt,...)</span>
                ftdm_log(FTDM_LOG_INFO, "sng_ss7->%s", data);
                break;
        /**************************************************************************/
<span style="color: #A00000">-        case SNG_LOGLEVEL_STATS:</span>
<span style="color: #A00000">-                ftdm_log(FTDM_LOG_INFO, "sng_ss7->%s", data);</span>
<span style="color: #00A000">+        case SNG_LOGLEVEL_NOTICE:</span>
<span style="color: #00A000">+                ftdm_log(FTDM_LOG_NOTICE, "sng_ss7->%s", data);</span>
                break;
        /**************************************************************************/
        case SNG_LOGLEVEL_ERROR:
</pre></div>
<div class="highlight"><pre>committer: Konrad Hammel
comments:
chlog: freetdm: ss7 - bug fix: a route now supports multiple linksets
<span style="color: #000080; font-weight: bold">diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c</span>
<span style="color: #000080; font-weight: bold">index d972cd7..92cf9e5 100755</span>
<span style="color: #A00000">--- a/libs/freetdm/mod_freetdm/mod_freetdm.c</span>
<span style="color: #00A000">+++ b/libs/freetdm/mod_freetdm/mod_freetdm.c</span>
<span style="color: #800080; font-weight: bold">@@ -2462,7 +2462,7 @@ static ftdm_conf_node_t *get_ss7_config_node(switch_xml_t cfg, const char *confn</span>
        }
        /* add mtp routes */
<span style="color: #A00000">-        if (add_config_list_nodes(isup, rootnode, "mtp_routes", "mtp_route", NULL, NULL)) {</span>
<span style="color: #00A000">+        if (add_config_list_nodes(isup, rootnode, "mtp_routes", "mtp_route", "linksets", "linkset")) {</span>
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to process mtp_routes for sng_isup config %s\n", confname);
                ftdm_conf_node_destroy(rootnode);
                return NULL;
<span style="color: #000080; font-weight: bold">diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c</span>
<span style="color: #000080; font-weight: bold">index 277951c..93f2678 100644</span>
<span style="color: #A00000">--- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c</span>
<span style="color: #00A000">+++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c</span>
<span style="color: #800080; font-weight: bold">@@ -1269,6 +1269,10 @@ static int ftmod_ss7_parse_mtp_route(ftdm_conf_node_t *mtp_route)</span>
        int                                                 num_parms = mtp_route->n_parameters;
        int                                                 i;
<span style="color: #00A000">+        ftdm_conf_node_t                *linkset;</span>
<span style="color: #00A000">+        int                                                ls_id;</span>
<span style="color: #00A000">+        int                                                numLinks;</span>
<span style="color: #00A000">+</span>
        /* initalize the mtpRoute structure */
        memset(&mtpRoute, 0x0, sizeof(mtpRoute));
<span style="color: #800080; font-weight: bold">@@ -1299,11 +1303,6 @@ static int ftmod_ss7_parse_mtp_route(ftdm_conf_node_t *mtp_route)</span>
                        mtpRoute.dpc = atoi(parm->val);
                        SS7_DEBUG("Found an mtpRoute dpc = %d\n", mtpRoute.dpc);
                /**********************************************************************/
<span style="color: #A00000">-                } else if (!strcasecmp(parm->var, "linksetId")) {</span>
<span style="color: #A00000">-                /**********************************************************************/</span>
<span style="color: #A00000">-                        mtpRoute.linkSetId = atoi(parm->val);</span>
<span style="color: #A00000">-                        SS7_DEBUG("Found an mtpRoute linkset = %s\n", parm->val);</span>
<span style="color: #A00000">-                /**********************************************************************/</span>
                } else if (!strcasecmp(parm->var, "isSTP")) {
                /**********************************************************************/
                        if (!strcasecmp(parm->val, "no")) {
<span style="color: #800080; font-weight: bold">@@ -1383,15 +1382,47 @@ static int ftmod_ss7_parse_mtp_route(ftdm_conf_node_t *mtp_route)</span>
                parm = parm + 1;
        }
<span style="color: #A00000">-        /* pull up the linktype, switchtype, and SSF from the linkset */</span>
<span style="color: #A00000">-        mtpRoute.linkType = g_ftdm_sngss7_data.cfg.mtpLinkSet[mtpRoute.linkSetId].linkType;</span>
<span style="color: #A00000">-        mtpRoute.switchType = g_ftdm_sngss7_data.cfg.mtpLinkSet[mtpRoute.linkSetId].switchType;</span>
<span style="color: #A00000">-        mtpRoute.ssf = g_ftdm_sngss7_data.cfg.mtpLinkSet[mtpRoute.linkSetId].ssf;</span>
<span style="color: #A00000">-</span>
        /* fill in the rest of the values in the mtpRoute struct */
        mtpRoute.nwId = mtpRoute.id;
        mtpRoute.cmbLinkSetId = mtpRoute.id;
<span style="color: #00A000">+        /* parse in the list of linksets this route is reachable by */</span>
<span style="color: #00A000">+        linkset = mtp_route->child->child;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        while (linkset != NULL) {</span>
<span style="color: #00A000">+        /**************************************************************************/</span>
<span style="color: #00A000">+                /* extract the linkset Id */</span>
<span style="color: #00A000">+                ls_id = atoi(linkset->parameters->val);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                if (g_ftdm_sngss7_data.cfg.mtpLinkSet[ls_id].id != 0) {</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found mtpRoute linkset id = %d that is valid\n",ls_id);</span>
<span style="color: #00A000">+                } else {</span>
<span style="color: #00A000">+                        SS7_ERROR("Found mtpRoute linkset id = %d that is invalid\n",ls_id);</span>
<span style="color: #00A000">+                        goto move_along;</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                /* pull up the linktype, switchtype, and SSF from the linkset */</span>
<span style="color: #00A000">+                mtpRoute.linkType = g_ftdm_sngss7_data.cfg.mtpLinkSet[ls_id].linkType;</span>
<span style="color: #00A000">+                mtpRoute.switchType = g_ftdm_sngss7_data.cfg.mtpLinkSet[ls_id].switchType;</span>
<span style="color: #00A000">+                mtpRoute.ssf = g_ftdm_sngss7_data.cfg.mtpLinkSet[ls_id].ssf;</span>
<span style="color: #00A000">+                </span>
<span style="color: #00A000">+                /* extract the number of cmbLinkSetId aleady on this linkset */</span>
<span style="color: #00A000">+                numLinks = g_ftdm_sngss7_data.cfg.mtpLinkSet[ls_id].numLinks;</span>
<span style="color: #00A000">+                </span>
<span style="color: #00A000">+                /* add this routes cmbLinkSetId to the list */</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtpLinkSet[ls_id].links[numLinks] = mtpRoute.cmbLinkSetId;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                /* increment the number of cmbLinkSets on this linkset */</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtpLinkSet[ls_id].numLinks++;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+move_along:</span>
<span style="color: #00A000">+                /* move to the next linkset element */</span>
<span style="color: #00A000">+                linkset = linkset->next;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /**************************************************************************/</span>
<span style="color: #00A000">+        } /* while (linkset != null) */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
        ftmod_ss7_fill_in_mtp3_route(&mtpRoute);
        ftmod_ss7_fill_in_nsap(&mtpRoute);
</pre></div>
<div class="highlight"><pre>committer: Konrad Hammel
comments:
chlog: freetdm: ss7 - added support for RELAY
<span style="color: #000080; font-weight: bold">diff --git a/libs/freetdm/Makefile.am b/libs/freetdm/Makefile.am</span>
<span style="color: #000080; font-weight: bold">index 96f1c9a..b3353f3 100644</span>
<span style="color: #A00000">--- a/libs/freetdm/Makefile.am</span>
<span style="color: #00A000">+++ b/libs/freetdm/Makefile.am</span>
<span style="color: #800080; font-weight: bold">@@ -240,7 +240,8 @@ ftmod_sangoma_ss7_la_SOURCES = \</span>
        $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c \
        $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_sta.c \
        $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_sts.c \
<span style="color: #A00000">-        $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c</span>
<span style="color: #00A000">+        $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c \</span>
<span style="color: #00A000">+        $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_relay.c</span>
ftmod_sangoma_ss7_la_CFLAGS = $(AM_CFLAGS) $(FTDM_CFLAGS) -D_GNU_SOURCE
ftmod_sangoma_ss7_la_LDFLAGS = -shared -module -avoid-version -lsng_ss7
<span style="color: #000080; font-weight: bold">diff --git a/libs/freetdm/configure.ac b/libs/freetdm/configure.ac</span>
<span style="color: #000080; font-weight: bold">index a070e99..1f4fc9c 100644</span>
<span style="color: #A00000">--- a/libs/freetdm/configure.ac</span>
<span style="color: #00A000">+++ b/libs/freetdm/configure.ac</span>
<span style="color: #800080; font-weight: bold">@@ -267,7 +267,7 @@ fi</span>
#
HAVE_SNG_SS7="no"
AC_MSG_RESULT([${as_nl}<<>> Sangoma SS7 stack])
<span style="color: #A00000">-AC_CHECK_LIB([sng_ss7], [sng_isup_init], [HAVE_SNG_SS7="yes"])</span>
<span style="color: #00A000">+AC_CHECK_LIB([sng_ss7], [sng_isup_init_gen], [HAVE_SNG_SS7="yes"])</span>
AC_MSG_RESULT([checking whether to build ftmod_sangoma_ss7... ${HAVE_SNG_SS7}])
AM_CONDITIONAL([HAVE_SNG_SS7], [test "${HAVE_SNG_SS7}" = "yes"])
<span style="color: #000080; font-weight: bold">diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c</span>
<span style="color: #000080; font-weight: bold">index 970cb5b..d972cd7 100755</span>
<span style="color: #A00000">--- a/libs/freetdm/mod_freetdm/mod_freetdm.c</span>
<span style="color: #00A000">+++ b/libs/freetdm/mod_freetdm/mod_freetdm.c</span>
<span style="color: #800080; font-weight: bold">@@ -2360,8 +2360,9 @@ static int add_config_list_nodes(switch_xml_t swnode, ftdm_conf_node_t *rootnode</span>
static ftdm_conf_node_t *get_ss7_config_node(switch_xml_t cfg, const char *confname)
{
<span style="color: #A00000">-        switch_xml_t signode, ss7configs, isup;</span>
<span style="color: #A00000">-        ftdm_conf_node_t *rootnode;</span>
<span style="color: #00A000">+        switch_xml_t signode, ss7configs, isup, gen, param;</span>
<span style="color: #00A000">+        ftdm_conf_node_t *rootnode, *list;</span>
<span style="color: #00A000">+        char *var, *val;</span>
        /* try to find the conf in the hash first */
        rootnode = switch_core_hash_find(globals.ss7_configs, confname);
<span style="color: #800080; font-weight: bold">@@ -2405,8 +2406,56 @@ static ftdm_conf_node_t *get_ss7_config_node(switch_xml_t cfg, const char *confn</span>
                return NULL;
        }
<span style="color: #00A000">+        /* add sng_gen */</span>
<span style="color: #00A000">+        gen = switch_xml_child(isup, "sng_gen");</span>
<span style="color: #00A000">+        if (gen == NULL) {</span>
<span style="color: #00A000">+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to process sng_gen for sng_isup config %s\n", confname);</span>
<span style="color: #00A000">+                ftdm_conf_node_destroy(rootnode);</span>
<span style="color: #00A000">+                return NULL;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if ((FTDM_SUCCESS != ftdm_conf_node_create("sng_gen", &list, rootnode))) {</span>
<span style="color: #00A000">+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to create %s node for %s\n", "sng_gen", confname);</span>
<span style="color: #00A000">+                ftdm_conf_node_destroy(rootnode);</span>
<span style="color: #00A000">+                return NULL;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        for (param = switch_xml_child(gen, "param"); param; param = param->next) {</span>
<span style="color: #00A000">+                var = (char *) switch_xml_attr_soft(param, "name");</span>
<span style="color: #00A000">+                val = (char *) switch_xml_attr_soft(param, "value");</span>
<span style="color: #00A000">+                ftdm_conf_node_add_param(list, var, val);</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* add relay channels */</span>
<span style="color: #00A000">+        if (add_config_list_nodes(isup, rootnode, "sng_relay", "relay_channel", NULL, NULL)) {</span>
<span style="color: #00A000">+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to process sng_relay for sng_isup config %s\n", confname);</span>
<span style="color: #00A000">+                ftdm_conf_node_destroy(rootnode);</span>
<span style="color: #00A000">+                return NULL;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* add mtp1 links */</span>
<span style="color: #00A000">+        if (add_config_list_nodes(isup, rootnode, "mtp1_links", "mtp1_link", NULL, NULL)) {</span>
<span style="color: #00A000">+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to process mtp1_links for sng_isup config %s\n", confname);</span>
<span style="color: #00A000">+                ftdm_conf_node_destroy(rootnode);</span>
<span style="color: #00A000">+                return NULL;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* add mtp2 links */</span>
<span style="color: #00A000">+        if (add_config_list_nodes(isup, rootnode, "mtp2_links", "mtp2_link", NULL, NULL)) {</span>
<span style="color: #00A000">+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to process mtp2_links for sng_isup config %s\n", confname);</span>
<span style="color: #00A000">+                ftdm_conf_node_destroy(rootnode);</span>
<span style="color: #00A000">+                return NULL;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* add mtp3 links */</span>
<span style="color: #00A000">+        if (add_config_list_nodes(isup, rootnode, "mtp3_links", "mtp3_link", NULL, NULL)) {</span>
<span style="color: #00A000">+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to process mtp3_links for sng_isup config %s\n", confname);</span>
<span style="color: #00A000">+                ftdm_conf_node_destroy(rootnode);</span>
<span style="color: #00A000">+                return NULL;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
        /* add mtp linksets */
<span style="color: #A00000">-        if (add_config_list_nodes(isup, rootnode, "mtp_linksets", "mtp_linkset", "mtp_links", "mtp_link")) {</span>
<span style="color: #00A000">+        if (add_config_list_nodes(isup, rootnode, "mtp_linksets", "mtp_linkset", NULL, NULL)) {</span>
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to process mtp_linksets for sng_isup config %s\n", confname);
                ftdm_conf_node_destroy(rootnode);
                return NULL;
<span style="color: #800080; font-weight: bold">@@ -2426,6 +2475,13 @@ static ftdm_conf_node_t *get_ss7_config_node(switch_xml_t cfg, const char *confn</span>
                return NULL;
        }
<span style="color: #00A000">+        /* add cc spans */</span>
<span style="color: #00A000">+        if (add_config_list_nodes(isup, rootnode, "cc_spans", "cc_span", NULL, NULL)) {</span>
<span style="color: #00A000">+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to process cc_spans for sng_isup config %s\n", confname);</span>
<span style="color: #00A000">+                ftdm_conf_node_destroy(rootnode);</span>
<span style="color: #00A000">+                return NULL;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
        switch_core_hash_insert(globals.ss7_configs, confname, rootnode);
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Added SS7 node configuration %s\n", confname);
<span style="color: #000080; font-weight: bold">diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c</span>
<span style="color: #000080; font-weight: bold">index e7378bf..42b95a1 100644</span>
<span style="color: #A00000">--- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c</span>
<span style="color: #00A000">+++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c</span>
<span style="color: #800080; font-weight: bold">@@ -44,6 +44,7 @@</span>
/* PROTOTYPES *****************************************************************/
int ft_to_sngss7_cfg_all(void);
<span style="color: #00A000">+int ftmod_ss7_relay_gen_config(void);</span>
int ftmod_ss7_mtp1_gen_config(void);
int ftmod_ss7_mtp2_gen_config(void);
int ftmod_ss7_mtp3_gen_config(void);
<span style="color: #800080; font-weight: bold">@@ -65,6 +66,8 @@ int ftmod_ss7_isup_ckt_config(int id);</span>
int ftmod_ss7_isup_isap_config(int id);
int ftmod_ss7_cc_isap_config(int id);
<span style="color: #00A000">+</span>
<span style="color: #00A000">+int ftmod_ss7_relay_chan_config(int id);</span>
/******************************************************************************/
/* FUNCTIONS ******************************************************************/
<span style="color: #800080; font-weight: bold">@@ -75,6 +78,7 @@ int ft_to_sngss7_cfg_all(void)</span>
        /* check if we have done gen_config already */
        if (!(g_ftdm_sngss7_data.gen_config)) {
<span style="color: #00A000">+                /* start of by checking if the license and sig file are valid */</span>
                if (sng_validate_license(g_ftdm_sngss7_data.cfg.license,
                                                                 g_ftdm_sngss7_data.cfg.signature,
                                                                 g_ftdm_sngss7_data.cfg.spc)) {
<span style="color: #800080; font-weight: bold">@@ -83,50 +87,148 @@ int ft_to_sngss7_cfg_all(void)</span>
                        return 1;
                }
<span style="color: #A00000">-                if (ftmod_ss7_mtp1_gen_config()) {</span>
<span style="color: #A00000">-                        SS7_CRITICAL("MTP1 General configuration FAILED!\n");</span>
<span style="color: #A00000">-                        return 1;</span>
<span style="color: #A00000">-                } else {</span>
<span style="color: #A00000">-                        SS7_INFO("MTP1 General configuration DONE\n");</span>
<span style="color: #00A000">+                /* if the procId is not 0 then we are using relay mode */</span>
<span style="color: #00A000">+                if (g_ftdm_sngss7_data.cfg.procId != 0) {</span>
<span style="color: #00A000">+                        /* set the desired procID value */</span>
<span style="color: #00A000">+                        sng_set_procId((uint16_t)g_ftdm_sngss7_data.cfg.procId);</span>
                }
<span style="color: #A00000">-                if (ftmod_ss7_mtp2_gen_config()) {</span>
<span style="color: #A00000">-                        SS7_CRITICAL("MTP2 General configuration FAILED!\n");</span>
<span style="color: #00A000">+                /* start up the stack manager */</span>
<span style="color: #00A000">+                if (sng_isup_init_sm()) {</span>
<span style="color: #00A000">+                        SS7_CRITICAL("Failed to start Stack Manager\n");</span>
                        return 1;
                } else {
<span style="color: #A00000">-                        SS7_INFO("MTP2 General configuration DONE\n");</span>
<span style="color: #00A000">+                        SS7_INFO("Started Stack Manager!\n");</span>
                }
<span style="color: #A00000">-                if (ftmod_ss7_mtp3_gen_config()) {</span>
<span style="color: #A00000">-                        SS7_CRITICAL("MTP3 General configuration FAILED!\n");</span>
<span style="color: #A00000">-                        return 1;</span>
<span style="color: #A00000">-                } else {</span>
<span style="color: #A00000">-                        SS7_INFO("MTP3 General configuration DONE\n");</span>
<span style="color: #A00000">-                }</span>
<span style="color: #00A000">+                /* check if the configuration had a Relay Channel */</span>
<span style="color: #00A000">+                if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_RY)) { </span>
<span style="color: #00A000">+                        /* start up the relay task */</span>
<span style="color: #00A000">+                        if (sng_isup_init_relay()) {</span>
<span style="color: #00A000">+                                SS7_CRITICAL("Failed to start Relay\n");</span>
<span style="color: #00A000">+                                return 1;</span>
<span style="color: #00A000">+                        } else {</span>
<span style="color: #00A000">+                                SS7_INFO("Started Relay!\n");</span>
<span style="color: #00A000">+                        }</span>
<span style="color: #A00000">-                if (ftmod_ss7_isup_gen_config()) {</span>
<span style="color: #A00000">-                        SS7_CRITICAL("ISUP General configuration FAILED!\n");</span>
<span style="color: #A00000">-                        return 1;</span>
<span style="color: #A00000">-                } else {</span>
<span style="color: #A00000">-                        SS7_INFO("ISUP General configuration DONE\n");</span>
<span style="color: #A00000">-                }</span>
<span style="color: #00A000">+                        /* run general configuration on the relay task */</span>
<span style="color: #00A000">+                        if (ftmod_ss7_relay_gen_config()) {</span>
<span style="color: #00A000">+                                SS7_CRITICAL("Relay General configuration FAILED!\n");</span>
<span style="color: #00A000">+                                return 1;</span>
<span style="color: #00A000">+                        } else {</span>
<span style="color: #00A000">+                                SS7_INFO("Relay General configuration DONE\n");</span>
<span style="color: #00A000">+                        }</span>
<span style="color: #A00000">-                if (ftmod_ss7_cc_gen_config()) {</span>
<span style="color: #A00000">-                        SS7_CRITICAL("CC General configuration FAILED!\n");</span>
<span style="color: #A00000">-                        return 1;</span>
<span style="color: #A00000">-                } else {</span>
<span style="color: #A00000">-                        SS7_INFO("CC General configuration DONE\n");</span>
<span style="color: #A00000">-                }</span>
<span style="color: #00A000">+                } /* if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_RY)) */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_CC)) {</span>
<span style="color: #00A000">+                        if (sng_isup_init_cc()) {</span>
<span style="color: #00A000">+                                SS7_CRITICAL("Failed to start Call-Control\n");</span>
<span style="color: #00A000">+                                return 1;</span>
<span style="color: #00A000">+                        } else {</span>
<span style="color: #00A000">+                                SS7_INFO("Started Call-Control!\n");</span>
<span style="color: #00A000">+                        }</span>
<span style="color: #00A000">+                        if (ftmod_ss7_cc_gen_config()) {</span>
<span style="color: #00A000">+                                SS7_CRITICAL("CC General configuration FAILED!\n");</span>
<span style="color: #00A000">+                                return 1;</span>
<span style="color: #00A000">+                        } else {</span>
<span style="color: #00A000">+                                SS7_INFO("CC General configuration DONE\n");</span>
<span style="color: #00A000">+                        }</span>
<span style="color: #00A000">+                        if (ftmod_ss7_cc_isap_config(1)) {</span>
<span style="color: #00A000">+                                SS7_CRITICAL("CC ISAP configuration FAILED!\n");</span>
<span style="color: #00A000">+                                return 1;</span>
<span style="color: #00A000">+                        } else {</span>
<span style="color: #00A000">+                                SS7_INFO("CC ISAP configuration DONE!\n");</span>
<span style="color: #00A000">+                        }</span>
<span style="color: #00A000">+                } /* if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_CC)) */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_ISUP)) {</span>
<span style="color: #00A000">+                        if (sng_isup_init_isup()) {</span>
<span style="color: #00A000">+                                SS7_CRITICAL("Failed to start ISUP\n");</span>
<span style="color: #00A000">+                                return 1;</span>
<span style="color: #00A000">+                        } else {</span>
<span style="color: #00A000">+                                SS7_INFO("Started ISUP!\n");</span>
<span style="color: #00A000">+                        }        </span>
<span style="color: #00A000">+                        if (ftmod_ss7_isup_gen_config()) {</span>
<span style="color: #00A000">+                                SS7_CRITICAL("ISUP General configuration FAILED!\n");</span>
<span style="color: #00A000">+                                return 1;</span>
<span style="color: #00A000">+                        } else {</span>
<span style="color: #00A000">+                                SS7_INFO("ISUP General configuration DONE\n");</span>
<span style="color: #00A000">+                        }</span>
<span style="color: #00A000">+                } /* if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_ISUP)) */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP3)) {</span>
<span style="color: #00A000">+                        if (sng_isup_init_mtp3()) {</span>
<span style="color: #00A000">+                                SS7_CRITICAL("Failed to start MTP3\n");</span>
<span style="color: #00A000">+                                return 1;</span>
<span style="color: #00A000">+                        } else {</span>
<span style="color: #00A000">+                                SS7_INFO("Started MTP3!\n");</span>
<span style="color: #00A000">+                        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                        if (ftmod_ss7_mtp3_gen_config()) {</span>
<span style="color: #00A000">+                                SS7_CRITICAL("MTP3 General configuration FAILED!\n");</span>
<span style="color: #00A000">+                                return 1;</span>
<span style="color: #00A000">+                        } else {</span>
<span style="color: #00A000">+                                SS7_INFO("MTP3 General configuration DONE\n");</span>
<span style="color: #00A000">+                        }</span>
<span style="color: #00A000">+                } /* if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP3)) */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP2)) {</span>
<span style="color: #00A000">+                        if (sng_isup_init_mtp2()) {</span>
<span style="color: #00A000">+                                SS7_CRITICAL("Failed to start MTP2\n");</span>
<span style="color: #00A000">+                                return 1;</span>
<span style="color: #00A000">+                        } else {</span>
<span style="color: #00A000">+                                SS7_INFO("Started MTP2!\n");</span>
<span style="color: #00A000">+                        }</span>
<span style="color: #00A000">+                        if (sng_isup_init_mtp1()) {</span>
<span style="color: #00A000">+                                SS7_CRITICAL("Failed to start MTP2\n");</span>
<span style="color: #00A000">+                                return 1;</span>
<span style="color: #00A000">+                        } else {</span>
<span style="color: #00A000">+                                SS7_INFO("Started MTP1!\n");</span>
<span style="color: #00A000">+                        }</span>
<span style="color: #00A000">+                        if (ftmod_ss7_mtp1_gen_config()) {</span>
<span style="color: #00A000">+                                SS7_CRITICAL("MTP1 General configuration FAILED!\n");</span>
<span style="color: #00A000">+                                return 1;</span>
<span style="color: #00A000">+                        } else {</span>
<span style="color: #00A000">+                                SS7_INFO("MTP1 General configuration DONE\n");</span>
<span style="color: #00A000">+                        }</span>
<span style="color: #00A000">+                        if (ftmod_ss7_mtp2_gen_config()) {</span>
<span style="color: #00A000">+                                SS7_CRITICAL("MTP2 General configuration FAILED!\n");</span>
<span style="color: #00A000">+                                return 1;</span>
<span style="color: #00A000">+                        } else {</span>
<span style="color: #00A000">+                                SS7_INFO("MTP2 General configuration DONE\n");</span>
<span style="color: #00A000">+                        }</span>
<span style="color: #00A000">+                } /* if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP2)) */</span>
                /* update the global gen_config so we don't do it again */
                g_ftdm_sngss7_data.gen_config = 1;
<span style="color: #A00000">-        }</span>
<span style="color: #00A000">+        } /* if (!(g_ftdm_sngss7_data.gen_config)) */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* go through all the relays channels and configure it */</span>
<span style="color: #00A000">+        x = 1;</span>
<span style="color: #00A000">+        while (g_ftdm_sngss7_data.cfg.relay[x].id != 0) {</span>
<span style="color: #00A000">+                /* check if this relay channel has been configured already */</span>
<span style="color: #00A000">+                if (!(g_ftdm_sngss7_data.cfg.relay[x].flags & SNGSS7_CONFIGURED)) {</span>
<span style="color: #00A000">+                        /* send the specific configuration */</span>
<span style="color: #00A000">+                        if (ftmod_ss7_relay_chan_config(x)) {</span>
<span style="color: #00A000">+                                SS7_CRITICAL("Relay Channel %d configuration FAILED!\n", x);</span>
<span style="color: #00A000">+                                return 1;</span>
<span style="color: #00A000">+                        } else {</span>
<span style="color: #00A000">+                                SS7_INFO("Relay Channel %d configuration DONE!\n", x);</span>
<span style="color: #00A000">+                        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                        /* set the SNGSS7_CONFIGURED flag */</span>
<span style="color: #00A000">+                        g_ftdm_sngss7_data.cfg.relay[x].flags |= SNGSS7_CONFIGURED;</span>
<span style="color: #00A000">+                } /* if !SNGSS7_CONFIGURED */</span>
<span style="color: #00A000">+                x++;</span>
<span style="color: #00A000">+        } /* while (g_ftdm_sngss7_data.cfg.relay[x].id != 0) */</span>
        x = 1;
<span style="color: #A00000">-        while (g_ftdm_sngss7_data.cfg.mtpLink[x].id != 0) {</span>
<span style="color: #00A000">+        while (x < (MAX_MTP_LINKS + 1)) {</span>
                /* check if this link has been configured already */
<span style="color: #A00000">-                if (!(g_ftdm_sngss7_data.cfg.mtpLink[x].flags & CONFIGURED)) {</span>
<span style="color: #00A000">+                if (!(g_ftdm_sngss7_data.cfg.mtp1Link[x].flags & SNGSS7_CONFIGURED) &&</span>
<span style="color: #00A000">+                         (g_ftdm_sngss7_data.cfg.mtp1Link[x].id != 0)) {</span>
                        /* configure mtp1 */
                        if (ftmod_ss7_mtp1_psap_config(x)) {
<span style="color: #800080; font-weight: bold">@@ -136,6 +238,18 @@ int ft_to_sngss7_cfg_all(void)</span>
                                SS7_INFO("MTP1 PSAP %d configuration DONE!\n", x);
                        }
<span style="color: #00A000">+                        /* set the SNGSS7_CONFIGURED flag */</span>
<span style="color: #00A000">+                        g_ftdm_sngss7_data.cfg.mtp1Link[x].flags |= SNGSS7_CONFIGURED;</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+                x++;</span>
<span style="color: #00A000">+        } /* while (g_ftdm_sngss7_data.cfg.mtp1Link[x].id != 0) */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        x = 1;</span>
<span style="color: #00A000">+        while (x < (MAX_MTP_LINKS + 1)) {</span>
<span style="color: #00A000">+                /* check if this link has been configured already */</span>
<span style="color: #00A000">+                if (!(g_ftdm_sngss7_data.cfg.mtp2Link[x].flags & SNGSS7_CONFIGURED) &&</span>
<span style="color: #00A000">+                         (g_ftdm_sngss7_data.cfg.mtp2Link[x].id != 0)) {</span>
<span style="color: #00A000">+</span>
                        /* configure mtp2 */
                        if (ftmod_ss7_mtp2_dlsap_config(x)) {
                                SS7_CRITICAL("MTP2 DLSAP %d configuration FAILED!\n",x);
<span style="color: #800080; font-weight: bold">@@ -144,6 +258,18 @@ int ft_to_sngss7_cfg_all(void)</span>
                                SS7_INFO("MTP2 DLSAP %d configuration DONE!\n", x);
                        }
<span style="color: #00A000">+                        /* set the SNGSS7_CONFIGURED flag */</span>
<span style="color: #00A000">+                        g_ftdm_sngss7_data.cfg.mtp2Link[x].flags |= SNGSS7_CONFIGURED;</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+                x++;</span>
<span style="color: #00A000">+        } /* while (g_ftdm_sngss7_data.cfg.mtp2Link[x].id != 0) */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        x = 1;</span>
<span style="color: #00A000">+        while (x < (MAX_MTP_LINKS + 1)) {</span>
<span style="color: #00A000">+                /* check if this link has been configured already */</span>
<span style="color: #00A000">+                if (!(g_ftdm_sngss7_data.cfg.mtp3Link[x].flags & SNGSS7_CONFIGURED) &&</span>
<span style="color: #00A000">+                         (g_ftdm_sngss7_data.cfg.mtp3Link[x].id != 0)) {</span>
<span style="color: #00A000">+</span>
                        /* configure mtp3 */
                        if (ftmod_ss7_mtp3_dlsap_config(x)) {
                                SS7_CRITICAL("MTP3 DLSAP %d configuration FAILED!\n", x);
<span style="color: #800080; font-weight: bold">@@ -152,17 +278,17 @@ int ft_to_sngss7_cfg_all(void)</span>
                                SS7_INFO("MTP3 DLSAP %d configuration DONE!\n", x);
                        }
<span style="color: #A00000">-                        /* set the CONFIGURED flag */</span>
<span style="color: #A00000">-                        g_ftdm_sngss7_data.cfg.mtpLink[x].flags |= CONFIGURED;</span>
<span style="color: #00A000">+                        /* set the SNGSS7_CONFIGURED flag */</span>
<span style="color: #00A000">+                        g_ftdm_sngss7_data.cfg.mtp3Link[x].flags |= SNGSS7_CONFIGURED;</span>
                }
                
                x++;
<span style="color: #A00000">-        } /* while (g_ftdm_sngss7_data.cfg.mtpLink[x].id != 0) */</span>
<span style="color: #00A000">+        } /* while (g_ftdm_sngss7_data.cfg.mtp3Link[x].id != 0) */</span>
        x = 1;
        while (g_ftdm_sngss7_data.cfg.nsap[x].id != 0) {
                /* check if this link has been configured already */
<span style="color: #A00000">-                if (!(g_ftdm_sngss7_data.cfg.nsap[x].flags & CONFIGURED)) {</span>
<span style="color: #00A000">+                if (!(g_ftdm_sngss7_data.cfg.nsap[x].flags & SNGSS7_CONFIGURED)) {</span>
                        if (ftmod_ss7_mtp3_nsap_config(x)) {
                                SS7_CRITICAL("MTP3 NSAP %d configuration FAILED!\n", x);
<span style="color: #800080; font-weight: bold">@@ -178,9 +304,9 @@ int ft_to_sngss7_cfg_all(void)</span>
                                SS7_INFO("ISUP NSAP %d configuration DONE!\n", x);
                        }
<span style="color: #A00000">-                        /* set the CONFIGURED flag */</span>
<span style="color: #A00000">-                        g_ftdm_sngss7_data.cfg.nsap[x].flags |= CONFIGURED;</span>
<span style="color: #A00000">-                } /* if !CONFIGURED */</span>
<span style="color: #00A000">+                        /* set the SNGSS7_CONFIGURED flag */</span>
<span style="color: #00A000">+                        g_ftdm_sngss7_data.cfg.nsap[x].flags |= SNGSS7_CONFIGURED;</span>
<span style="color: #00A000">+                } /* if !SNGSS7_CONFIGURED */</span>
                
                x++;
        } /* while (g_ftdm_sngss7_data.cfg.nsap[x].id != 0) */
<span style="color: #800080; font-weight: bold">@@ -188,7 +314,7 @@ int ft_to_sngss7_cfg_all(void)</span>
        x = 1;
        while (g_ftdm_sngss7_data.cfg.mtpLinkSet[x].id != 0) {
                /* check if this link has been configured already */
<span style="color: #A00000">-                if (!(g_ftdm_sngss7_data.cfg.mtpLinkSet[x].flags & CONFIGURED)) {</span>
<span style="color: #00A000">+                if (!(g_ftdm_sngss7_data.cfg.mtpLinkSet[x].flags & SNGSS7_CONFIGURED)) {</span>
                        if (ftmod_ss7_mtp3_linkset_config(x)) {
                                SS7_CRITICAL("MTP3 LINKSET %d configuration FAILED!\n", x);
<span style="color: #800080; font-weight: bold">@@ -197,9 +323,9 @@ int ft_to_sngss7_cfg_all(void)</span>
                                SS7_INFO("MTP3 LINKSET %d configuration DONE!\n", x);
                        }
<span style="color: #A00000">-                        /* set the CONFIGURED flag */</span>
<span style="color: #A00000">-                        g_ftdm_sngss7_data.cfg.mtpLinkSet[x].flags |= CONFIGURED;</span>
<span style="color: #A00000">-                } /* if !CONFIGURED */</span>
<span style="color: #00A000">+                        /* set the SNGSS7_CONFIGURED flag */</span>
<span style="color: #00A000">+                        g_ftdm_sngss7_data.cfg.mtpLinkSet[x].flags |= SNGSS7_CONFIGURED;</span>
<span style="color: #00A000">+                } /* if !SNGSS7_CONFIGURED */</span>
                
                x++;
        } /* while (g_ftdm_sngss7_data.cfg.mtpLinkSet[x].id != 0) */
<span style="color: #800080; font-weight: bold">@@ -207,7 +333,7 @@ int ft_to_sngss7_cfg_all(void)</span>
        x = 1;
        while ((g_ftdm_sngss7_data.cfg.mtpRoute[x].id != 0)) {
                /* check if this link has been configured already */
<span style="color: #A00000">-                if (!(g_ftdm_sngss7_data.cfg.mtpRoute[x].flags & CONFIGURED)) {</span>
<span style="color: #00A000">+                if (!(g_ftdm_sngss7_data.cfg.mtpRoute[x].flags & SNGSS7_CONFIGURED)) {</span>
                        if (ftmod_ss7_mtp3_route_config(x)) {
                                SS7_CRITICAL("MTP3 ROUTE %d configuration FAILED!\n", x);
<span style="color: #800080; font-weight: bold">@@ -216,31 +342,33 @@ int ft_to_sngss7_cfg_all(void)</span>
                                SS7_INFO("MTP3 ROUTE %d configuration DONE!\n",x);
                        }
<span style="color: #A00000">-                        /* set the CONFIGURED flag */</span>
<span style="color: #A00000">-                        g_ftdm_sngss7_data.cfg.mtpRoute[x].flags |= CONFIGURED;</span>
<span style="color: #A00000">-                } /* if !CONFIGURED */</span>
<span style="color: #00A000">+                        /* set the SNGSS7_CONFIGURED flag */</span>
<span style="color: #00A000">+                        g_ftdm_sngss7_data.cfg.mtpRoute[x].flags |= SNGSS7_CONFIGURED;</span>
<span style="color: #00A000">+                } /* if !SNGSS7_CONFIGURED */</span>
                
                x++;
        } /* while (g_ftdm_sngss7_data.cfg.mtpRoute[x].id != 0) */
<span style="color: #A00000">-        if (!(g_ftdm_sngss7_data.cfg.mtpRoute[0].flags & CONFIGURED)) {</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                if (ftmod_ss7_mtp3_route_config(0)) {</span>
<span style="color: #A00000">-                        SS7_CRITICAL("MTP3 ROUTE 0 configuration FAILED!\n");</span>
<span style="color: #A00000">-                        return 1;</span>
<span style="color: #A00000">-                } else {</span>
<span style="color: #A00000">-                        SS7_INFO("MTP3 ROUTE 0 configuration DONE!\n");</span>
<span style="color: #A00000">-                }</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                /* set the CONFIGURED flag */</span>
<span style="color: #A00000">-                g_ftdm_sngss7_data.cfg.mtpRoute[0].flags |= CONFIGURED;</span>
<span style="color: #A00000">-        } /* if !CONFIGURED */</span>
<span style="color: #00A000">+        if (g_ftdm_sngss7_data.cfg.mtpRoute[1].id != 0) {</span>
<span style="color: #00A000">+                if (!(g_ftdm_sngss7_data.cfg.mtpRoute[0].flags & SNGSS7_CONFIGURED)) {</span>
<span style="color: #00A000">+        </span>
<span style="color: #00A000">+                        if (ftmod_ss7_mtp3_route_config(0)) {</span>
<span style="color: #00A000">+                                SS7_CRITICAL("MTP3 ROUTE 0 configuration FAILED!\n");</span>
<span style="color: #00A000">+                                return 1;</span>
<span style="color: #00A000">+                        } else {</span>
<span style="color: #00A000">+                                SS7_INFO("MTP3 ROUTE 0 configuration DONE!\n");</span>
<span style="color: #00A000">+                        }</span>
<span style="color: #00A000">+        </span>
<span style="color: #00A000">+                        /* set the SNGSS7_CONFIGURED flag */</span>
<span style="color: #00A000">+                        g_ftdm_sngss7_data.cfg.mtpRoute[0].flags |= SNGSS7_CONFIGURED;</span>
<span style="color: #00A000">+                } /* if !SNGSS7_CONFIGURED */</span>
<span style="color: #00A000">+        }</span>
        x = 1;
        while (g_ftdm_sngss7_data.cfg.isap[x].id != 0) {
                /* check if this link has been configured already */
<span style="color: #A00000">-                if (!(g_ftdm_sngss7_data.cfg.isap[x].flags & CONFIGURED)) {</span>
<span style="color: #00A000">+                if (!(g_ftdm_sngss7_data.cfg.isap[x].flags & SNGSS7_CONFIGURED)) {</span>
                        
                        if (ftmod_ss7_isup_isap_config(x)) {
                                SS7_CRITICAL("ISUP ISAP %d configuration FAILED!\n", x);
<span style="color: #800080; font-weight: bold">@@ -249,57 +377,51 @@ int ft_to_sngss7_cfg_all(void)</span>
                                SS7_INFO("ISUP ISAP %d configuration DONE!\n", x);
                        }
<span style="color: #A00000">-                        if (ftmod_ss7_cc_isap_config(x)) {</span>
<span style="color: #A00000">-                                SS7_CRITICAL("CC ISAP %d configuration FAILED!\n", x);</span>
<span style="color: #A00000">-                                return 1;</span>
<span style="color: #A00000">-                        } else {</span>
<span style="color: #A00000">-                                SS7_INFO("CC ISAP %d configuration DONE!\n", x);</span>
<span style="color: #A00000">-                        }</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                        /* set the CONFIGURED flag */</span>
<span style="color: #A00000">-                        g_ftdm_sngss7_data.cfg.isap[x].flags |= CONFIGURED;</span>
<span style="color: #A00000">-                } /* if !CONFIGURED */</span>
<span style="color: #00A000">+                        /* set the SNGSS7_CONFIGURED flag */</span>
<span style="color: #00A000">+                        g_ftdm_sngss7_data.cfg.isap[x].flags |= SNGSS7_CONFIGURED;</span>
<span style="color: #00A000">+                } /* if !SNGSS7_CONFIGURED */</span>
                
                x++;
        } /* while (g_ftdm_sngss7_data.cfg.isap[x].id != 0) */
<span style="color: #A00000">-        x = 1;</span>
<span style="color: #A00000">-        while (g_ftdm_sngss7_data.cfg.isupIntf[x].id != 0) {</span>
<span style="color: #A00000">-                /* check if this link has been configured already */</span>
<span style="color: #A00000">-                if (!(g_ftdm_sngss7_data.cfg.isupIntf[x].flags & CONFIGURED)) {</span>
<span style="color: #00A000">+        if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_ISUP)) {</span>
<span style="color: #00A000">+                x = 1;</span>
<span style="color: #00A000">+                while (g_ftdm_sngss7_data.cfg.isupIntf[x].id != 0) {</span>
<span style="color: #00A000">+                        /* check if this link has been configured already */</span>
<span style="color: #00A000">+                        if (!(g_ftdm_sngss7_data.cfg.isupIntf[x].flags & SNGSS7_CONFIGURED)) {</span>
<span style="color: #00A000">+        </span>
<span style="color: #00A000">+                                if (ftmod_ss7_isup_intf_config(x)) {</span>
<span style="color: #00A000">+                                        SS7_CRITICAL("ISUP INTF %d configuration FAILED!\n", x);</span>
<span style="color: #00A000">+                                        return 1;</span>
<span style="color: #00A000">+                                } else {</span>
<span style="color: #00A000">+                                        SS7_INFO("ISUP INTF %d configuration DONE!\n", x);</span>
<span style="color: #00A000">+                                        /* set the interface to paused */</span>
<span style="color: #00A000">+                                        sngss7_set_flag(&g_ftdm_sngss7_data.cfg.isupIntf[x], SNGSS7_PAUSED);</span>
<span style="color: #00A000">+                                }</span>
<span style="color: #00A000">+        </span>
<span style="color: #00A000">+                                /* set the SNGSS7_CONFIGURED flag */</span>
<span style="color: #00A000">+                                g_ftdm_sngss7_data.cfg.isupIntf[x].flags |= SNGSS7_CONFIGURED;</span>
<span style="color: #00A000">+                        } /* if !SNGSS7_CONFIGURED */</span>
<span style="color: #00A000">+                        </span>
<span style="color: #00A000">+                        x++;</span>
<span style="color: #00A000">+                } /* while (g_ftdm_sngss7_data.cfg.isupIntf[x].id != 0) */</span>
<span style="color: #00A000">+        } /* if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_ISUP)) */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1;</span>
<span style="color: #00A000">+        while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) {</span>
<span style="color: #00A000">+                if ( g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) {</span>
<span style="color: #A00000">-                        if (ftmod_ss7_isup_intf_config(x)) {</span>
<span style="color: #A00000">-                                SS7_CRITICAL("ISUP INTF %d configuration FAILED!\n", x);</span>
<span style="color: #00A000">+                        if (ftmod_ss7_isup_ckt_config(x)) {</span>
<span style="color: #00A000">+                                SS7_CRITICAL("ISUP CKT %d configuration FAILED!\n", x);</span>
                                return 1;
                        } else {
<span style="color: #A00000">-                                SS7_INFO("ISUP INTF %d configuration DONE!\n", x);</span>
<span style="color: #A00000">-                                /* set the interface to paused */</span>
<span style="color: #A00000">-                                sngss7_set_flag(&g_ftdm_sngss7_data.cfg.isupIntf[x], SNGSS7_PAUSED);</span>
<span style="color: #00A000">+                                SS7_INFO("ISUP CKT %d configuration DONE!\n", x);</span>
                        }
<span style="color: #A00000">-                        /* set the CONFIGURED flag */</span>
<span style="color: #A00000">-                        g_ftdm_sngss7_data.cfg.isupIntf[x].flags |= CONFIGURED;</span>
<span style="color: #A00000">-                } /* if !CONFIGURED */</span>
<span style="color: #A00000">-                </span>
<span style="color: #A00000">-                x++;</span>
<span style="color: #A00000">-        } /* while (g_ftdm_sngss7_data.cfg.isupIntf[x].id != 0) */</span>
<span style="color: #00A000">+                } /* if ( g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) */</span>
<span style="color: #A00000">-        x = 1;</span>
<span style="color: #A00000">-        while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) {</span>
<span style="color: #A00000">-                /* check if this link has been configured already */</span>
<span style="color: #A00000">-                if (!(g_ftdm_sngss7_data.cfg.isupCkt[x].flags & CONFIGURED)) {</span>
<span style="color: #A00000">-                        if ( g_ftdm_sngss7_data.cfg.isupCkt[x].type == 0) {</span>
<span style="color: #A00000">-                                if (ftmod_ss7_isup_ckt_config(x)) {</span>
<span style="color: #A00000">-                                        SS7_CRITICAL("ISUP CKT %d configuration FAILED!\n", x);</span>
<span style="color: #A00000">-                                        return 1;</span>
<span style="color: #A00000">-                                } else {</span>
<span style="color: #A00000">-                                        SS7_INFO("ISUP CKT %d configuration DONE!\n", x);</span>
<span style="color: #A00000">-                                }</span>
<span style="color: #A00000">-                        }</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                        /* set the CONFIGURED flag */</span>
<span style="color: #A00000">-                        g_ftdm_sngss7_data.cfg.isupCkt[x].flags |= CONFIGURED;</span>
<span style="color: #A00000">-                } /* if !CONFIGURED */</span>
<span style="color: #00A000">+                /* set the SNGSS7_CONFIGURED flag */</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.isupCkt[x].flags |= SNGSS7_CONFIGURED;</span>
                
                x++;
        } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) */
<span style="color: #800080; font-weight: bold">@@ -308,6 +430,44 @@ int ft_to_sngss7_cfg_all(void)</span>
}
/******************************************************************************/
<span style="color: #00A000">+int ftmod_ss7_relay_gen_config(void)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        RyMngmt        cfg;        /*configuration structure*/</span>
<span style="color: #00A000">+        Pst                pst;        /*post structure*/</span>
<span style="color: #00A000">+        </span>
<span style="color: #00A000">+        /* initalize the post structure */</span>
<span style="color: #00A000">+        smPstInit(&pst);</span>
<span style="color: #00A000">+        </span>
<span style="color: #00A000">+        /* insert the destination Entity */</span>
<span style="color: #00A000">+        pst.dstEnt = ENTRY;</span>
<span style="color: #00A000">+        </span>
<span style="color: #00A000">+        /* clear the configuration structure */</span>
<span style="color: #00A000">+        memset(&cfg, 0x0, sizeof(RyMngmt));</span>
<span style="color: #00A000">+        </span>
<span style="color: #00A000">+        /* fill in some general sections of the header */</span>
<span style="color: #00A000">+        smHdrInit(&cfg.hdr);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* fill in the post structure */</span>
<span style="color: #00A000">+        smPstInit( &cfg.t.cfg.s.ryGenCfg.lmPst );</span>
<span style="color: #00A000">+        </span>
<span style="color: #00A000">+        /*fill in the specific fields of the header */</span>
<span style="color: #00A000">+        cfg.hdr.msgType                                                = TCFG;</span>
<span style="color: #00A000">+        cfg.hdr.entId.ent                                         = ENTRY;</span>
<span style="color: #00A000">+        cfg.hdr.entId.inst                                        = S_INST;</span>
<span style="color: #00A000">+        cfg.hdr.elmId.elmnt                                 = STGEN;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        cfg.t.cfg.s.ryGenCfg.lmPst.srcEnt        = ENTRY;</span>
<span style="color: #00A000">+        cfg.t.cfg.s.ryGenCfg.lmPst.dstEnt        = ENTSM;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        cfg.t.cfg.s.ryGenCfg.nmbChan                = 10;</span>
<span style="color: #00A000">+        cfg.t.cfg.s.ryGenCfg.tmrRes                        = RY_PERIOD;</span>
<span style="color: #00A000">+        cfg.t.cfg.s.ryGenCfg.usta                        = 1;</span>
<span style="color: #00A000">+        </span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return(sng_cfg_relay(&pst, &cfg));</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/******************************************************************************/</span>
int ftmod_ss7_mtp1_gen_config(void)
{
        L1Mngmt        cfg;        /*configuration structure*/
<span style="color: #800080; font-weight: bold">@@ -575,7 +735,7 @@ int ftmod_ss7_mtp1_psap_config(int id)</span>
{
        L1Mngmt                        cfg;
        Pst                                pst;
<span style="color: #A00000">-        sng_mtp_link_t        *k = &g_ftdm_sngss7_data.cfg.mtpLink[id];</span>
<span style="color: #00A000">+        sng_mtp1_link_t        *k = &g_ftdm_sngss7_data.cfg.mtp1Link[id];</span>
        
        /* initalize the post structure */
        smPstInit(&pst);
<span style="color: #800080; font-weight: bold">@@ -597,8 +757,8 @@ int ftmod_ss7_mtp1_psap_config(int id)</span>
        
        cfg.hdr.elmId.elmntInst1        = k->id;
        
<span style="color: #A00000">-        cfg.t.cfg.s.l1PSAP.span                = k->mtp1.span;</span>
<span style="color: #A00000">-        cfg.t.cfg.s.l1PSAP.chan                = k->mtp1.chan;</span>
<span style="color: #00A000">+        cfg.t.cfg.s.l1PSAP.span                = k->span;</span>
<span style="color: #00A000">+        cfg.t.cfg.s.l1PSAP.chan                = k->chan;</span>
        cfg.t.cfg.s.l1PSAP.spId                = k->id;
        return(sng_cfg_mtp1(&pst, &cfg));
<span style="color: #800080; font-weight: bold">@@ -609,7 +769,7 @@ int ftmod_ss7_mtp2_dlsap_config(int id)</span>
{
        SdMngmt        cfg;
        Pst                pst;
<span style="color: #A00000">-        sng_mtp_link_t        *k = &g_ftdm_sngss7_data.cfg.mtpLink[id];</span>
<span style="color: #00A000">+        sng_mtp2_link_t        *k = &g_ftdm_sngss7_data.cfg.mtp2Link[id];</span>
        /* initalize the post structure */
        smPstInit( &pst);
<span style="color: #800080; font-weight: bold">@@ -633,10 +793,15 @@ int ftmod_ss7_mtp2_dlsap_config(int id)</span>
        cfg.t.cfg.s.sdDLSAP.mem.region                = S_REG;                                        /* memory region */
        cfg.t.cfg.s.sdDLSAP.mem.pool                = S_POOL;                                        /* memory pool */
<span style="color: #A00000">-        cfg.t.cfg.s.sdDLSAP.swtch                        = k->mtp2.linkType;                        /* protocol type */</span>
<span style="color: #00A000">+        cfg.t.cfg.s.sdDLSAP.swtch                        = k->linkType;                        /* protocol type */</span>
        cfg.t.cfg.s.sdDLSAP.priorDl                        = PRIOR0;                                        /* priority for data link layer */
        cfg.t.cfg.s.sdDLSAP.routeDl                        = RTESPEC;                                        /* route for data link layer */
        cfg.t.cfg.s.sdDLSAP.selectorDl                = 0;                                                /* upper interface selector */
<span style="color: #00A000">+        if (k->mtp1ProcId > 0) {</span>
<span style="color: #00A000">+                cfg.t.cfg.s.sdDLSAP.dstProcId        = k->mtp1ProcId;                /* the procid of MAC/L1/MTP1 */</span>
<span style="color: #00A000">+        } else {</span>
<span style="color: #00A000">+                cfg.t.cfg.s.sdDLSAP.dstProcId        = SFndProcId();                                /* the procid of MAC/L1/MTP1 */</span>
<span style="color: #00A000">+        }</span>
        cfg.t.cfg.s.sdDLSAP.dstProcId                = SFndProcId();                                /* the procid of MAC/L1/MTP1 */
        cfg.t.cfg.s.sdDLSAP.entMac                        = ENTL1;                                        /* entity for MAC */
        cfg.t.cfg.s.sdDLSAP.instMac                        = S_INST;                                        /* instance for MAC */
<span style="color: #800080; font-weight: bold">@@ -646,22 +811,22 @@ int ftmod_ss7_mtp2_dlsap_config(int id)</span>
        cfg.t.cfg.s.sdDLSAP.memMac.region        = S_REG;                                        /* memory region and pool id for MAC */
        cfg.t.cfg.s.sdDLSAP.memMac.pool                = S_POOL;
        cfg.t.cfg.s.sdDLSAP.maxOutsFrms                = MAX_SD_OUTSTANDING;                /* maximum outstanding frames */
<span style="color: #A00000">-        cfg.t.cfg.s.sdDLSAP.errType                        = k->mtp2.errorType;</span>
<span style="color: #00A000">+        cfg.t.cfg.s.sdDLSAP.errType                        = k->errorType;</span>
        cfg.t.cfg.s.sdDLSAP.t1.enb                        = TRUE;                                                /* timer 1 - Alignment Ready Timer */
<span style="color: #A00000">-        cfg.t.cfg.s.sdDLSAP.t1.val                        = k->mtp2.t1;</span>
<span style="color: #00A000">+        cfg.t.cfg.s.sdDLSAP.t1.val                        = k->t1;</span>
        cfg.t.cfg.s.sdDLSAP.t2.enb                        = TRUE;                                                /* timer 2 - Not Aligned Timer */
<span style="color: #A00000">-        cfg.t.cfg.s.sdDLSAP.t2.val                        = k->mtp2.t2;</span>
<span style="color: #00A000">+        cfg.t.cfg.s.sdDLSAP.t2.val                        = k->t2;</span>
        cfg.t.cfg.s.sdDLSAP.t3.enb                        = TRUE;                                                /* timer 3 - Aligned Timer */
<span style="color: #A00000">-        cfg.t.cfg.s.sdDLSAP.t3.val                        = k->mtp2.t3;</span>
<span style="color: #00A000">+        cfg.t.cfg.s.sdDLSAP.t3.val                        = k->t3;</span>
        cfg.t.cfg.s.sdDLSAP.t5.enb                        = TRUE;                                                /* timer 5 - Sending SIB timer */
<span style="color: #A00000">-        cfg.t.cfg.s.sdDLSAP.t5.val                        = k->mtp2.t5;</span>
<span style="color: #00A000">+        cfg.t.cfg.s.sdDLSAP.t5.val                        = k->t5;</span>
        cfg.t.cfg.s.sdDLSAP.t6.enb                        = TRUE;                                                /* timer 6 - Remote Congestion Timer */
<span style="color: #A00000">-        cfg.t.cfg.s.sdDLSAP.t6.val                        = k->mtp2.t6;</span>
<span style="color: #00A000">+        cfg.t.cfg.s.sdDLSAP.t6.val                        = k->t6;</span>
        cfg.t.cfg.s.sdDLSAP.t7.enb                        = TRUE;                                                /* timer 7 - Excessive delay of acknowledgement timer */
<span style="color: #A00000">-        cfg.t.cfg.s.sdDLSAP.t7.val                        = k->mtp2.t7;</span>
<span style="color: #A00000">-        cfg.t.cfg.s.sdDLSAP.provEmrgcy                = k->mtp2.t4e;                                /* emergency proving period */</span>
<span style="color: #A00000">-        cfg.t.cfg.s.sdDLSAP.provNormal                = k->mtp2.t4n;                                /* normal proving period */</span>
<span style="color: #A00000">-        cfg.t.cfg.s.sdDLSAP.lssuLen                        = k->mtp2.lssuLength;                        /* one or two byte LSSU length */</span>
<span style="color: #00A000">+        cfg.t.cfg.s.sdDLSAP.t7.val                        = k->t7;</span>
<span style="color: #00A000">+        cfg.t.cfg.s.sdDLSAP.provEmrgcy                = k->t4e;                                /* emergency proving period */</span>
<span style="color: #00A000">+        cfg.t.cfg.s.sdDLSAP.provNormal                = k->t4n;                                /* normal proving period */</span>
<span style="color: #00A000">+        cfg.t.cfg.s.sdDLSAP.lssuLen                        = k->lssuLength;                        /* one or two byte LSSU length */</span>
        cfg.t.cfg.s.sdDLSAP.maxFrmLen                = MAX_SD_FRAME_LEN;                        /* max frame length for MSU */
        cfg.t.cfg.s.sdDLSAP.congDisc                = FALSE;                                        /* congestion discard TRUE or FALSE */
        cfg.t.cfg.s.sdDLSAP.sdT                                = MAX_SD_SUERM;                                /* SUERM error rate threshold */
<span style="color: #800080; font-weight: bold">@@ -670,7 +835,7 @@ int ftmod_ss7_mtp2_dlsap_config(int id)</span>
        cfg.t.cfg.s.sdDLSAP.sdN1                        = MAX_SD_MSU_RETRANS;                /* maximum number of MSUs for retransmission */
        cfg.t.cfg.s.sdDLSAP.sdN2                        = MAX_SD_OCTETS_RETRANS;        /* maximum number of MSU octets for retrans */
        cfg.t.cfg.s.sdDLSAP.sdCp                        = MAX_SD_ALIGN_ATTEMPTS;        /* maximum number of alignment attempts */
<span style="color: #A00000">-        cfg.t.cfg.s.sdDLSAP.spIdSE                        = k->mtp2.mtp1Id;                                /* service provider id */</span>
<span style="color: #00A000">+        cfg.t.cfg.s.sdDLSAP.spIdSE                        = k->mtp1Id;                                /* service provider id */</span>
        cfg.t.cfg.s.sdDLSAP.sdtFlcStartTr        = 256;                                                /* SDT interface flow control start thresh */
        cfg.t.cfg.s.sdDLSAP.sdtFlcEndTr                = 512;                                                /* SDT interface flow control end thresh */
<span style="color: #800080; font-weight: bold">@@ -707,7 +872,6 @@ int ftmod_ss7_mtp2_dlsap_config(int id)</span>
#endif /*RUG*/
        return(sng_cfg_mtp2(&pst, &cfg));
<span style="color: #A00000">-        return 0;</span>
}
/******************************************************************************/
<span style="color: #800080; font-weight: bold">@@ -715,7 +879,7 @@ int ftmod_ss7_mtp3_dlsap_config(int id)</span>
{
        Pst                                pst;
        SnMngmt                        cfg;
<span style="color: #A00000">-        sng_mtp_link_t        *k = &g_ftdm_sngss7_data.cfg.mtpLink[id];</span>
<span style="color: #00A000">+        sng_mtp3_link_t        *k = &g_ftdm_sngss7_data.cfg.mtp3Link[id];</span>
        /* initalize the post structure */
<span style="color: #800080; font-weight: bold">@@ -738,14 +902,14 @@ int ftmod_ss7_mtp3_dlsap_config(int id)</span>
        cfg.hdr.elmId.elmntInst1                         = k->id;
<span style="color: #A00000">-        cfg.t.cfg.s.snDLSAP.lnkSetId                = k->mtp3.linkSetId;        /* link set ID */</span>
<span style="color: #A00000">-        cfg.t.cfg.s.snDLSAP.opc                                = k->mtp3.spc;                        /* Originating Postatic int Code */</span>
<span style="color: #A00000">-        cfg.t.cfg.s.snDLSAP.adjDpc                        = k->mtp3.apc;                        /* Adlacent Destination Postatic int Code */</span>
<span style="color: #00A000">+        cfg.t.cfg.s.snDLSAP.lnkSetId                = k->linkSetId;                        /* link set ID */</span>
<span style="color: #00A000">+        cfg.t.cfg.s.snDLSAP.opc                                = k->spc;                                /* Originating Postatic int Code */</span>
<span style="color: #00A000">+        cfg.t.cfg.s.snDLSAP.adjDpc                        = k->apc;                                /* Adlacent Destination Postatic int Code */</span>
        cfg.t.cfg.s.snDLSAP.lnkPrior                = 0;                                        /* link priority within the link set */
        cfg.t.cfg.s.snDLSAP.msgSize                        = MAX_SN_MSG_SIZE;                /* message length */
        cfg.t.cfg.s.snDLSAP.msgPrior                = 0;                                        /* management message priority */
<span style="color: #A00000">-        cfg.t.cfg.s.snDLSAP.lnkType                        = k->mtp3.linkType;                /* link type ANSI, ITU, BICI or CHINA */</span>
<span style="color: #A00000">-        cfg.t.cfg.s.snDLSAP.upSwtch                        = k->mtp3.switchType;        /* user part switch type */</span>
<span style="color: #00A000">+        cfg.t.cfg.s.snDLSAP.lnkType                        = k->linkType;                        /* link type ANSI, ITU, BICI or CHINA */</span>
<span style="color: #00A000">+        cfg.t.cfg.s.snDLSAP.upSwtch                        = k->switchType;                /* user part switch type */</span>
        cfg.t.cfg.s.snDLSAP.maxSLTtry                = MAX_SLTM_RETRIES;                /* maximun times to retry SLTM */
        cfg.t.cfg.s.snDLSAP.p0QLen                        = 32;                                        /* size of the priority 0 Q */
        cfg.t.cfg.s.snDLSAP.p1QLen                        = 32;                                        /* size of the priority 1 Q */
<span style="color: #800080; font-weight: bold">@@ -756,7 +920,7 @@ int ftmod_ss7_mtp3_dlsap_config(int id)</span>
        cfg.t.cfg.s.snDLSAP.maxCredit                = MAX_SN_CREDIT;                /* max credit */
#endif /* SDT2 */
        cfg.t.cfg.s.snDLSAP.lnkId                        = 0;                                        /* signalling link allocation procedure identity */
<span style="color: #A00000">-        cfg.t.cfg.s.snDLSAP.lnkTstSLC                = k->mtp3.slc;                        /* link selection code for link test */</span>
<span style="color: #00A000">+        cfg.t.cfg.s.snDLSAP.lnkTstSLC                = k->slc;                                /* link selection code for link test */</span>
        cfg.t.cfg.s.snDLSAP.tstLen                        = 6;                                        /* link test pattern length */
        cfg.t.cfg.s.snDLSAP.tst[0]                        = 'K';                                        /* link test pattern */
        cfg.t.cfg.s.snDLSAP.tst[1]                        = 'O';                                        /* link test pattern */
<span style="color: #800080; font-weight: bold">@@ -764,8 +928,8 @@ int ftmod_ss7_mtp3_dlsap_config(int id)</span>
        cfg.t.cfg.s.snDLSAP.tst[3]                        = 'R';                                        /* link test pattern */
        cfg.t.cfg.s.snDLSAP.tst[4]                        = 'A';                                        /* link test pattern */
        cfg.t.cfg.s.snDLSAP.tst[5]                        = 'D';                                        /* link test pattern */
<span style="color: #A00000">-        cfg.t.cfg.s.snDLSAP.ssf                                = k->mtp3.ssf;                        /* sub service field */ </span>
<span style="color: #A00000">-        cfg.t.cfg.s.snDLSAP.dstProcId                = SFndProcId();                        /* destination processor id */</span>
<span style="color: #00A000">+        cfg.t.cfg.s.snDLSAP.ssf                                = k->ssf;                                /* sub service field */ </span>
<span style="color: #00A000">+        cfg.t.cfg.s.snDLSAP.dstProcId                = k->mtp2ProcId;                /* destination processor id */</span>
        cfg.t.cfg.s.snDLSAP.dstEnt                        = ENTSD;                                /* entity */
        cfg.t.cfg.s.snDLSAP.dstInst                        = S_INST;                                /* instance */
        cfg.t.cfg.s.snDLSAP.prior                        = PRIOR0;                                /* priority */
<span style="color: #800080; font-weight: bold">@@ -773,9 +937,9 @@ int ftmod_ss7_mtp3_dlsap_config(int id)</span>
        cfg.t.cfg.s.snDLSAP.selector                = 0;                                        /* lower layer selector */
        cfg.t.cfg.s.snDLSAP.mem.region                = S_REG;                                /* memory region id */
        cfg.t.cfg.s.snDLSAP.mem.pool                = S_POOL;                                /* memory pool id */
<span style="color: #A00000">-        cfg.t.cfg.s.snDLSAP.spId                        = k->mtp3.mtp2Id                /* service provider id */</span>
<span style="color: #00A000">+        cfg.t.cfg.s.snDLSAP.spId                        = k->mtp2Id;                        /* service provider id */</span>
<span style="color: #A00000">-        switch (k->mtp3.linkType) {</span>
<span style="color: #00A000">+        switch (k->linkType) {</span>
        /**************************************************************************/
        case (LSN_SW_ANS):
        case (LSN_SW_ANS96):
<span style="color: #800080; font-weight: bold">@@ -793,9 +957,9 @@ int ftmod_ss7_mtp3_dlsap_config(int id)</span>
                cfg.t.cfg.s.snDLSAP.dpcLen                = DPC14;                                /* dpc length 14 bits */
                break;
        /**************************************************************************/
<span style="color: #A00000">-        } /* switch (k->mtp3.linkType) */</span>
<span style="color: #00A000">+        } /* switch (k->linkType) */</span>
<span style="color: #A00000">-        switch (k->mtp3.linkType) {</span>
<span style="color: #00A000">+        switch (k->linkType) {</span>
        /**************************************************************************/
        case (LSN_SW_ANS):
        case (LSN_SW_ANS96):
<span style="color: #800080; font-weight: bold">@@ -811,51 +975,51 @@ int ftmod_ss7_mtp3_dlsap_config(int id)</span>
                cfg.t.cfg.s.snDLSAP.flushContFlag        = FALSE;                        /* flush continue handling */
                break;
        /**************************************************************************/
<span style="color: #A00000">-        } /* switch (k->mtp3.linkType) */</span>
<span style="color: #00A000">+        } /* switch (k->linkType) */</span>
        cfg.t.cfg.s.snDLSAP.tmr.t1.enb                = TRUE;                                        /* t1 - delay to avoid missequencing on changeover */
<span style="color: #A00000">-        cfg.t.cfg.s.snDLSAP.tmr.t1.val                = k->mtp3.t1;</span>
<span style="color: #00A000">+        cfg.t.cfg.s.snDLSAP.tmr.t1.val                = k->t1;</span>
        cfg.t.cfg.s.snDLSAP.tmr.t2.enb                = TRUE;                                        /* t2 - waiting for changeover ack */
<span style="color: #A00000">-        cfg.t.cfg.s.snDLSAP.tmr.t2.val                = k->mtp3.t2;</span>
<span style="color: #00A000">+        cfg.t.cfg.s.snDLSAP.tmr.t2.val                = k->t2;</span>
        cfg.t.cfg.s.snDLSAP.tmr.t3.enb                = TRUE;                                        /* t3 - delay to avoid missequencing on changeback */
<span style="color: #A00000">-        cfg.t.cfg.s.snDLSAP.tmr.t3.val                = k->mtp3.t3;</span>
<span style="color: #00A000">+        cfg.t.cfg.s.snDLSAP.tmr.t3.val                = k->t3;</span>
        cfg.t.cfg.s.snDLSAP.tmr.t4.enb                = TRUE;                                        /* t4 - waiting for first changeback ack */
<span style="color: #A00000">-        cfg.t.cfg.s.snDLSAP.tmr.t4.val                = k->mtp3.t4;</span>
<span style="color: #00A000">+        cfg.t.cfg.s.snDLSAP.tmr.t4.val                = k->t4;</span>
        cfg.t.cfg.s.snDLSAP.tmr.t5.enb                = TRUE;                                        /* t5 - waiting for second changeback ack */
<span style="color: #A00000">-        cfg.t.cfg.s.snDLSAP.tmr.t5.val                = k->mtp3.t5;</span>
<span style="color: #00A000">+        cfg.t.cfg.s.snDLSAP.tmr.t5.val                = k->t5;</span>
        cfg.t.cfg.s.snDLSAP.tmr.t7.enb                = TRUE;                                        /* t7 - waiting for link connection ack */
<span style="color: #A00000">-        cfg.t.cfg.s.snDLSAP.tmr.t7.val                = k->mtp3.t7;</span>
<span style="color: #00A000">+        cfg.t.cfg.s.snDLSAP.tmr.t7.val                = k->t7;</span>
        cfg.t.cfg.s.snDLSAP.tmr.t12.enb                = TRUE;                                        /* t12 - waiting for uninhibit ack */
<span style="color: #A00000">-        cfg.t.cfg.s.snDLSAP.tmr.t12.val                = k->mtp3.t12;</span>
<span style="color: #00A000">+        cfg.t.cfg.s.snDLSAP.tmr.t12.val                = k->t12;</span>
        cfg.t.cfg.s.snDLSAP.tmr.t13.enb                = TRUE;                                        /* t13 - waiting for forced uninhibit */
<span style="color: #A00000">-        cfg.t.cfg.s.snDLSAP.tmr.t13.val                = k->mtp3.t13;</span>
<span style="color: #00A000">+        cfg.t.cfg.s.snDLSAP.tmr.t13.val                = k->t13;</span>
        cfg.t.cfg.s.snDLSAP.tmr.t14.enb                = TRUE;                                        /* t14 - waiting for inhibition ack */
<span style="color: #A00000">-        cfg.t.cfg.s.snDLSAP.tmr.t14.val                = k->mtp3.t14;</span>
<span style="color: #00A000">+        cfg.t.cfg.s.snDLSAP.tmr.t14.val                = k->t14;</span>
        cfg.t.cfg.s.snDLSAP.tmr.t17.enb                = TRUE;                                        /* t17 - delay to avoid oscillation of initial alignment failure */
<span style="color: #A00000">-        cfg.t.cfg.s.snDLSAP.tmr.t17.val                = k->mtp3.t17;</span>
<span style="color: #00A000">+        cfg.t.cfg.s.snDLSAP.tmr.t17.val                = k->t17;</span>
        cfg.t.cfg.s.snDLSAP.tmr.t22.enb                = TRUE;                                        /* t22 - local inhibit test timer */
<span style="color: #A00000">-        cfg.t.cfg.s.snDLSAP.tmr.t22.val                = k->mtp3.t22;</span>
<span style="color: #00A000">+        cfg.t.cfg.s.snDLSAP.tmr.t22.val                = k->t22;</span>
        cfg.t.cfg.s.snDLSAP.tmr.t23.enb                = TRUE;                                        /* t23 - remote inhibit test timer */
<span style="color: #A00000">-        cfg.t.cfg.s.snDLSAP.tmr.t23.val                = k->mtp3.t23;</span>
<span style="color: #00A000">+        cfg.t.cfg.s.snDLSAP.tmr.t23.val                = k->t23;</span>
        cfg.t.cfg.s.snDLSAP.tmr.t24.enb                = TRUE;                                        /* t24 - stabilizing timer */
<span style="color: #A00000">-        cfg.t.cfg.s.snDLSAP.tmr.t24.val                = k->mtp3.t24;</span>
<span style="color: #00A000">+        cfg.t.cfg.s.snDLSAP.tmr.t24.val                = k->t24;</span>
        cfg.t.cfg.s.snDLSAP.tmr.t31.enb                = TRUE;                                        /* t31 - BSN requested timer */
<span style="color: #A00000">-        cfg.t.cfg.s.snDLSAP.tmr.t31.val                = k->mtp3.t31;</span>
<span style="color: #00A000">+        cfg.t.cfg.s.snDLSAP.tmr.t31.val                = k->t31;</span>
        cfg.t.cfg.s.snDLSAP.tmr.t32.enb                = TRUE;                                        /* t32 - SLT timer */
<span style="color: #A00000">-        cfg.t.cfg.s.snDLSAP.tmr.t32.val                = k->mtp3.t32;</span>
<span style="color: #00A000">+        cfg.t.cfg.s.snDLSAP.tmr.t32.val                = k->t32;</span>
        cfg.t.cfg.s.snDLSAP.tmr.t33.enb                = TRUE;                                        /* t33 - connecting timer */
<span style="color: #A00000">-        cfg.t.cfg.s.snDLSAP.tmr.t33.val                = k->mtp3.t33;</span>
<span style="color: #00A000">+        cfg.t.cfg.s.snDLSAP.tmr.t33.val                = k->t33;</span>
        cfg.t.cfg.s.snDLSAP.tmr.t34.enb                = TRUE;                                        /* t34 - periodic signalling link test timer */
<span style="color: #A00000">-        cfg.t.cfg.s.snDLSAP.tmr.t34.val                = k->mtp3.t34;</span>
<span style="color: #00A000">+        cfg.t.cfg.s.snDLSAP.tmr.t34.val                = k->t34;</span>
#if (SS7_ANS92 || SS7_ANS88 || SS7_ANS96 || defined(TDS_ROLL_UPGRADE_SUPPORT))
        cfg.t.cfg.s.snDLSAP.tmr.t35.enb                = TRUE;                                        /* t35 - false link congestion timer, same as t31 of ANSI'96*/
<span style="color: #A00000">-        cfg.t.cfg.s.snDLSAP.tmr.t35.val                = k->mtp3.t35;</span>
<span style="color: #00A000">+        cfg.t.cfg.s.snDLSAP.tmr.t35.val                = k->t35;</span>
        cfg.t.cfg.s.snDLSAP.tmr.t36.enb                = TRUE;                                        /* t36 - false link congestion timer, same as t33 of ANSI'96*/
<span style="color: #A00000">-        cfg.t.cfg.s.snDLSAP.tmr.t36.val                = k->mtp3.t36;        </span>
<span style="color: #00A000">+        cfg.t.cfg.s.snDLSAP.tmr.t36.val                = k->t36;        </span>
        cfg.t.cfg.s.snDLSAP.tmr.t37.enb                = TRUE;                                        /* t37 - false link congestion timer, same as t34 of ANSI'96*/
<span style="color: #A00000">-        cfg.t.cfg.s.snDLSAP.tmr.t37.val                = k->mtp3.t37;</span>
<span style="color: #00A000">+        cfg.t.cfg.s.snDLSAP.tmr.t37.val                = k->t37;</span>
        cfg.t.cfg.s.snDLSAP.tmr.tCraft.enb        = TRUE;                                        /* link referral craft timer - T19 in ANSI */
<span style="color: #A00000">-        cfg.t.cfg.s.snDLSAP.tmr.tCraft.val        = k->mtp3.tcraft;</span>
<span style="color: #00A000">+        cfg.t.cfg.s.snDLSAP.tmr.tCraft.val        = k->tcraft;</span>
#endif
#ifdef SDT2
        cfg.t.cfg.s.snDLSAP.tmr.tFlc.enb        = TRUE;                                        /* flow control timer */
<span style="color: #800080; font-weight: bold">@@ -1217,6 +1381,11 @@ int ftmod_ss7_isup_ckt_config(int id)</span>
        /* insert the destination Entity */
        pst.dstEnt = ENTSI;
<span style="color: #00A000">+        /* check the for the correct ProcId and make sure it goes to the right system */</span>
<span style="color: #00A000">+        if (g_ftdm_sngss7_data.cfg.procId != 1) {</span>
<span style="color: #00A000">+                pst.dstProcId = 1;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
        /*clear the configuration structure*/
        memset(&cfg, 0x0, sizeof(SiMngmt));
<span style="color: #800080; font-weight: bold">@@ -1417,11 +1586,11 @@ int ftmod_ss7_isup_isap_config(int id)</span>
}
/******************************************************************************/
<span style="color: #A00000">-int ftmod_ss7_cc_isap_config(int id)</span>
<span style="color: #00A000">+int ftmod_ss7_cc_isap_config(int dstProcId)</span>
{
        CcMngmt         cfg;
        Pst                 pst;
<span style="color: #A00000">-        sng_isap_t        *k = &g_ftdm_sngss7_data.cfg.isap[id];</span>
<span style="color: #00A000">+</span>
        /* initalize the post structure */
        smPstInit(&pst);
<span style="color: #800080; font-weight: bold">@@ -1441,11 +1610,11 @@ int ftmod_ss7_cc_isap_config(int id)</span>
        cfg.hdr.entId.inst                                        = S_INST;
        cfg.hdr.elmId.elmnt                                        = STISAP;
<span style="color: #A00000">-        cfg.hdr.elmId.elmntInst1                         = k->id;</span>
<span style="color: #00A000">+        cfg.hdr.elmId.elmntInst1                         = 1;</span>
<span style="color: #A00000">-        cfg.t.cfg.s.ccISAP.suId                                 = k->suId;</span>
<span style="color: #A00000">-        cfg.t.cfg.s.ccISAP.spId                                 = k->spId;</span>
<span style="color: #A00000">-        cfg.t.cfg.s.ccISAP.pst.dstProcId        = SFndProcId();</span>
<span style="color: #00A000">+        cfg.t.cfg.s.ccISAP.suId                                 = 1;</span>
<span style="color: #00A000">+        cfg.t.cfg.s.ccISAP.spId                                 = 1;</span>
<span style="color: #00A000">+        cfg.t.cfg.s.ccISAP.pst.dstProcId        = dstProcId;</span>
        cfg.t.cfg.s.ccISAP.pst.dstEnt                = ENTSI;
        cfg.t.cfg.s.ccISAP.pst.dstInst                = S_INST;
        cfg.t.cfg.s.ccISAP.pst.srcProcId        = SFndProcId();
<span style="color: #800080; font-weight: bold">@@ -1461,6 +1630,70 @@ int ftmod_ss7_cc_isap_config(int id)</span>
}
/******************************************************************************/
<span style="color: #00A000">+int ftmod_ss7_relay_chan_config(int id)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        RyMngmt        cfg;        /*configuration structure*/</span>
<span style="color: #00A000">+        Pst                pst;        /*post structure*/</span>
<span style="color: #00A000">+        sng_relay_t                *k = &g_ftdm_sngss7_data.cfg.relay[id];</span>
<span style="color: #00A000">+        </span>
<span style="color: #00A000">+        /* initalize the post structure */</span>
<span style="color: #00A000">+        smPstInit(&pst);</span>
<span style="color: #00A000">+        </span>
<span style="color: #00A000">+        /* insert the destination Entity */</span>
<span style="color: #00A000">+        pst.dstEnt = ENTRY;</span>
<span style="color: #00A000">+        </span>
<span style="color: #00A000">+        /* clear the configuration structure */</span>
<span style="color: #00A000">+        memset(&cfg, 0x0, sizeof(RyMngmt));</span>
<span style="color: #00A000">+        </span>
<span style="color: #00A000">+        /* fill in some general sections of the header */</span>
<span style="color: #00A000">+        smHdrInit(&cfg.hdr);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /*fill in the specific fields of the header */</span>
<span style="color: #00A000">+        cfg.hdr.msgType                                                        = TCFG;</span>
<span style="color: #00A000">+        cfg.hdr.entId.ent                                                 = ENTRY;</span>
<span style="color: #00A000">+        cfg.hdr.entId.inst                                                = S_INST;</span>
<span style="color: #00A000">+        cfg.hdr.elmId.elmnt                                         = STCHCFG;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        cfg.hdr.elmId.elmntInst1                                 = k->id;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        cfg.t.cfg.s.ryChanCfg.id                                = k->id;                                        /* channel id */</span>
<span style="color: #00A000">+        cfg.t.cfg.s.ryChanCfg.type                                = k->type;                                        /* channel type */</span>
<span style="color: #00A000">+/*        cfg.t.cfg.s.ryChanCfg.msInd                                =;*/                                                /* master/slave indicator */</span>
<span style="color: #00A000">+        if (k->type == LRY_CT_TCP_LISTEN) {</span>
<span style="color: #00A000">+                cfg.t.cfg.s.ryChanCfg.low                        = 0;                                                /* low proc id for channel */</span>
<span style="color: #00A000">+                cfg.t.cfg.s.ryChanCfg.high                        = 0;                                                /* high proc id for channel */</span>
<span style="color: #00A000">+        } else {</span>
<span style="color: #00A000">+                cfg.t.cfg.s.ryChanCfg.low                        = k->procId;                                /* low proc id for channel */</span>
<span style="color: #00A000">+                cfg.t.cfg.s.ryChanCfg.high                        = k->procId;                                /* high proc id for channel */</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        cfg.t.cfg.s.ryChanCfg.nmbScanQ                        = MAX_RELAY_NMBSCAN;                /* number of times to scan the queue */</span>
<span style="color: #00A000">+        cfg.t.cfg.s.ryChanCfg.flags                                = LRY_FLG_INTR;                                /* flags */</span>
<span style="color: #00A000">+        cfg.t.cfg.s.ryChanCfg.congThrsh                        = MAX_RELAY_CONGTHRSH;                /* congestion threshold */</span>
<span style="color: #00A000">+        cfg.t.cfg.s.ryChanCfg.dropThrsh                        = 0;                                                /* drop threshold */</span>
<span style="color: #00A000">+        cfg.t.cfg.s.ryChanCfg.contThrsh                        = MAX_RELAY_CONGTHRSH + 1;        /* continue threshold */</span>
<span style="color: #00A000">+        cfg.t.cfg.s.ryChanCfg.kaTxTmr.enb                = 1;                                                /* keep alive transmit timer config */</span>
<span style="color: #00A000">+        cfg.t.cfg.s.ryChanCfg.kaTxTmr.val                = RY_TX_KP_ALIVE_TMR;</span>
<span style="color: #00A000">+        cfg.t.cfg.s.ryChanCfg.kaRxTmr.enb                = 1;                                                /* keep alive receive timer config */</span>
<span style="color: #00A000">+        cfg.t.cfg.s.ryChanCfg.kaRxTmr.val                = RY_RX_KP_ALIVE_TMR;</span>
<span style="color: #00A000">+        cfg.t.cfg.s.ryChanCfg.btTmr.enb                        = 1;                                                /* boot timer */</span>
<span style="color: #00A000">+        cfg.t.cfg.s.ryChanCfg.btTmr.val                        = RY_BT_TMR;</span>
<span style="color: #00A000">+        cfg.t.cfg.s.ryChanCfg.region                        = S_REG;                                        /* Relay region */</span>
<span style="color: #00A000">+        cfg.t.cfg.s.ryChanCfg.pool                                = S_POOL;                                        /* Relay pool */</span>
<span style="color: #00A000">+#if (RY_ENBUDPSOCK || RY_ENBTCPSOCK) </span>
<span style="color: #00A000">+        cfg.t.cfg.s.ryChanCfg.listenPortNo                = k->port;                                        /* Listen Port of Rx Relay Channel*/</span>
<span style="color: #00A000">+        strncpy(cfg.t.cfg.s.ryChanCfg.transmittoHostName, k->hostname, (size_t)RY_REMHOSTNAME_SIZE);</span>
<span style="color: #00A000">+        cfg.t.cfg.s.ryChanCfg.transmittoPortNo        = k->port;                                        /* TransmitTo PortId for Tx Relay Channel */</span>
<span style="color: #00A000">+        cfg.t.cfg.s.ryChanCfg.targetProcId                = k->procId;                                /* procId of the node present in the other end of this channel */</span>
<span style="color: #00A000">+# ifdef LRY1</span>
<span style="color: #00A000">+        cfg.t.cfg.s.ryChanCfg.sockParam                        =; /* Socket Parameters */</span>
<span style="color: #00A000">+# endif /* LRY1 */</span>
<span style="color: #00A000">+# ifdef LRYV2</span>
<span style="color: #00A000">+        cfg.t.cfg.s.ryChanCfg.selfHostName[RY_REMHOSTNAME_SIZE];</span>
<span style="color: #00A000">+# endif /* LRY2 */</span>
<span style="color: #00A000">+#endif /* RY_ENBUDPSOCK || RY_ENBTCPSOCK */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return(sng_cfg_relay(&pst, &cfg));</span>
<span style="color: #00A000">+}</span>
/******************************************************************************/
/* For Emacs:
<span style="color: #000080; font-weight: bold">diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c</span>
<span style="color: #000080; font-weight: bold">index dc2d24f..4ab4359 100644</span>
<span style="color: #A00000">--- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c</span>
<span style="color: #00A000">+++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c</span>
<span style="color: #800080; font-weight: bold">@@ -46,6 +46,8 @@ ftdm_status_t ftdm_sngss7_handle_cli_cmd(ftdm_stream_handle_t *stream, const cha</span>
static ftdm_status_t handle_print_usuage(ftdm_stream_handle_t *stream);
<span style="color: #00A000">+static ftdm_status_t handle_show_procId(ftdm_stream_handle_t *stream);</span>
<span style="color: #00A000">+</span>
static ftdm_status_t handle_set_function_trace(ftdm_stream_handle_t *stream, int on, int level);
static ftdm_status_t handle_set_message_trace(ftdm_stream_handle_t *stream, int on, int level);
static ftdm_status_t handle_set_inhibit(ftdm_stream_handle_t *stream, char *name);
<span style="color: #800080; font-weight: bold">@@ -67,6 +69,8 @@ static ftdm_status_t handle_tx_ubl(ftdm_stream_handle_t *stream, int span, int c</span>
static ftdm_status_t handle_tx_cgb(ftdm_stream_handle_t *stream, int span, int chan, int range, int verbose);
static ftdm_status_t handle_tx_cgu(ftdm_stream_handle_t *stream, int span, int chan, int range, int verbose);
<span style="color: #00A000">+static ftdm_status_t handle_bind_link(ftdm_stream_handle_t *stream, char *name);</span>
<span style="color: #00A000">+static ftdm_status_t handle_unbind_link(ftdm_stream_handle_t *stream, char *name);</span>
static ftdm_status_t handle_activate_link(ftdm_stream_handle_t *stream, char *name);
static ftdm_status_t handle_deactivate_link(ftdm_stream_handle_t *stream, char *name);
<span style="color: #800080; font-weight: bold">@@ -76,9 +80,12 @@ static ftdm_status_t handle_deactivate_linkset(ftdm_stream_handle_t *stream, cha</span>
static ftdm_status_t handle_tx_lpo(ftdm_stream_handle_t *stream, char *name);
static ftdm_status_t handle_tx_lpr(ftdm_stream_handle_t *stream, char *name);
<span style="color: #A00000">-static ftdm_status_t handle_status_link(ftdm_stream_handle_t *stream, char *name);</span>
<span style="color: #00A000">+static ftdm_status_t handle_status_mtp3link(ftdm_stream_handle_t *stream, char *name);</span>
<span style="color: #00A000">+static ftdm_status_t handle_status_mtp2link(ftdm_stream_handle_t *stream, char *name);</span>
static ftdm_status_t handle_status_linkset(ftdm_stream_handle_t *stream, char *name);
<span style="color: #00A000">+static ftdm_status_t handle_status_relay(ftdm_stream_handle_t *stream, char *name);</span>
<span style="color: #00A000">+</span>
static ftdm_status_t extract_span_chan(char *argv[10], int pos, int *span, int *chan);
static ftdm_status_t check_arg_count(int args, int min);
/******************************************************************************/
<span style="color: #800080; font-weight: bold">@@ -111,18 +118,29 @@ ftdm_status_t ftdm_sngss7_handle_cli_cmd(ftdm_stream_handle_t *stream, const cha</span>
                if (!strcasecmp(argv[c], "status")) {
                /**********************************************************************/
<span style="color: #00A000">+                        if (check_arg_count(argc, 3)) goto handle_cli_error_argc;</span>
                        c++;
<span style="color: #A00000">-                        if (!strcasecmp(argv[c], "link")) {</span>
<span style="color: #00A000">+                        if (!strcasecmp(argv[c], "mtp3")) {</span>
<span style="color: #00A000">+                        /******************************************************************/</span>
<span style="color: #00A000">+                                c++;</span>
<span style="color: #00A000">+                                handle_status_mtp3link(stream, argv[c]);</span>
<span style="color: #00A000">+                        /******************************************************************/</span>
<span style="color: #00A000">+                        } else if (!strcasecmp(argv[c], "mtp2")) {</span>
                        /******************************************************************/
                                c++;
<span style="color: #A00000">-                                handle_status_link(stream, argv[c]);</span>
<span style="color: #00A000">+                                handle_status_mtp2link(stream, argv[c]);</span>
                        /******************************************************************/
                        } else if (!strcasecmp(argv[c], "linkset")) {
                        /******************************************************************/
                                c++;
                                handle_status_linkset(stream, argv[c]);
                        /******************************************************************/
<span style="color: #00A000">+                        } else if (!strcasecmp(argv[c], "relay")) {</span>
<span style="color: #00A000">+                        /******************************************************************/</span>
<span style="color: #00A000">+                                c++;</span>
<span style="color: #00A000">+                                handle_status_relay(stream, argv[c]);</span>
<span style="color: #00A000">+                        /******************************************************************/</span>
                        } else if (!strcasecmp(argv[c], "span")) {
                        /******************************************************************/
                                if (check_arg_count(argc, 6)) goto handle_cli_error_argc;
<span style="color: #800080; font-weight: bold">@@ -256,6 +274,10 @@ ftdm_status_t ftdm_sngss7_handle_cli_cmd(ftdm_stream_handle_t *stream, const cha</span>
                                                                                        sts.rx_frm, sts.rx_err, sts.rx_fisu, sts.rx_lssu, sts.rx_msu);
*/
                /**********************************************************************/
<span style="color: #00A000">+                } else if (!strcasecmp(argv[c], "procid")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        handle_show_procId(stream);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
                } else {
                /**********************************************************************/
                        stream->write_function(stream, "Unknown \"show\" command\n");
<span style="color: #800080; font-weight: bold">@@ -534,6 +556,44 @@ ftdm_status_t ftdm_sngss7_handle_cli_cmd(ftdm_stream_handle_t *stream, const cha</span>
                /**********************************************************************/
                }
        /**************************************************************************/
<span style="color: #00A000">+        } else if (!strcasecmp(argv[c], "bind")) {</span>
<span style="color: #00A000">+        /**************************************************************************/</span>
<span style="color: #00A000">+                if (check_arg_count(argc, 2)) goto handle_cli_error_argc;</span>
<span style="color: #00A000">+                c++;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                if (!strcasecmp(argv[c], "link")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        if (check_arg_count(argc, 3)) goto handle_cli_error_argc;</span>
<span style="color: #00A000">+                        c++;</span>
<span style="color: #00A000">+                        </span>
<span style="color: #00A000">+                        handle_bind_link(stream, argv[c]);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        stream->write_function(stream, "Unknown \"bind\" command\n");</span>
<span style="color: #00A000">+                        goto handle_cli_error;</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+        /**************************************************************************/</span>
<span style="color: #00A000">+        } else if (!strcasecmp(argv[c], "unbind")) {</span>
<span style="color: #00A000">+        /**************************************************************************/</span>
<span style="color: #00A000">+                if (check_arg_count(argc, 2)) goto handle_cli_error_argc;</span>
<span style="color: #00A000">+                c++;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                if (!strcasecmp(argv[c], "link")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        if (check_arg_count(argc, 3)) goto handle_cli_error_argc;</span>
<span style="color: #00A000">+                        c++;</span>
<span style="color: #00A000">+                        </span>
<span style="color: #00A000">+                        handle_unbind_link(stream, argv[c]);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        stream->write_function(stream, "Unknown \"bind\" command\n");</span>
<span style="color: #00A000">+                        goto handle_cli_error;</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+        /**************************************************************************/</span>
        } else if (!strcasecmp(argv[c], "activate")) {
        /**************************************************************************/
                if (check_arg_count(argc, 2)) goto handle_cli_error_argc;
<span style="color: #800080; font-weight: bold">@@ -650,6 +710,16 @@ static ftdm_status_t handle_print_usuage(ftdm_stream_handle_t *stream)</span>
}
/******************************************************************************/
<span style="color: #00A000">+static ftdm_status_t handle_show_procId(ftdm_stream_handle_t *stream)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        int        procId = sng_get_procId();</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        stream->write_function(stream, "Local ProcId = %d\n", procId);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return FTDM_SUCCESS;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/******************************************************************************/</span>
static ftdm_status_t handle_set_function_trace(ftdm_stream_handle_t *stream, int on, int level)
{
        stream->write_function(stream, "ftmod_sangoma_ss7 Function Trace was %s, level = %d\n",
<span style="color: #800080; font-weight: bold">@@ -693,7 +763,7 @@ static ftdm_status_t handle_show_free(ftdm_stream_handle_t *stream, int span, in</span>
        int                                 lspan;
        int                                 lchan;
<span style="color: #A00000">-        x=1;</span>
<span style="color: #00A000">+        x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1;</span>
        free = 0;
        while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) {
                if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) {
<span style="color: #800080; font-weight: bold">@@ -756,7 +826,7 @@ static ftdm_status_t handle_show_inuse(ftdm_stream_handle_t *stream, int span, i</span>
        int                                 lspan;
        int                                 lchan;
<span style="color: #A00000">-        x=1;</span>
<span style="color: #00A000">+        x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1;</span>
        in_use = 0;
        while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) {
                if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) {
<span style="color: #800080; font-weight: bold">@@ -826,7 +896,7 @@ static ftdm_status_t handle_show_inreset(ftdm_stream_handle_t *stream, int span,</span>
        int                                 lspan;
        int                                 lchan;
<span style="color: #A00000">-        x=1;</span>
<span style="color: #00A000">+        x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1;</span>
        in_reset = 0;
        while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) {
                if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) {
<span style="color: #800080; font-weight: bold">@@ -848,10 +918,10 @@ static ftdm_status_t handle_show_inreset(ftdm_stream_handle_t *stream, int span,</span>
                        }
                        if ((ftdmchan->physical_span_id == lspan) && (ftdmchan->physical_chan_id == lchan)) {
<span style="color: #A00000">-                                if ((sngss7_test_flag(ss7_info, FLAG_RESET_RX)) ||</span>
<span style="color: #A00000">-                                        (sngss7_test_flag(ss7_info, FLAG_RESET_TX)) ||</span>
<span style="color: #A00000">-                                        (sngss7_test_flag(ss7_info, FLAG_GRP_RESET_RX)) ||</span>
<span style="color: #A00000">-                                        (sngss7_test_flag(ss7_info, FLAG_GRP_RESET_TX))) {</span>
<span style="color: #00A000">+                                if ((sngss7_test_ckt_flag(ss7_info, FLAG_RESET_RX)) ||</span>
<span style="color: #00A000">+                                        (sngss7_test_ckt_flag(ss7_info, FLAG_RESET_TX)) ||</span>
<span style="color: #00A000">+                                        (sngss7_test_ckt_flag(ss7_info, FLAG_GRP_RESET_RX)) ||</span>
<span style="color: #00A000">+                                        (sngss7_test_ckt_flag(ss7_info, FLAG_GRP_RESET_TX))) {</span>
                                        
                                        if (verbose) {
                                                stream->write_function(stream, "span=%2d|chan=%2d|cic=%4d|in_reset=Y\n",
<span style="color: #800080; font-weight: bold">@@ -862,7 +932,7 @@ static ftdm_status_t handle_show_inreset(ftdm_stream_handle_t *stream, int span,</span>
                
                                        /*increment the count of circuits in reset */
                                        in_reset++;
<span style="color: #A00000">-                                } /* if ((sngss7_test_flag(ss7_info, FLAG_RESET_RX) ... */</span>
<span style="color: #00A000">+                                } /* if ((sngss7_test_ckt_flag(ss7_info, FLAG_RESET_RX) ... */</span>
                        } /* if ( span and chan) */
                } /* if ( cic != 0) */
<span style="color: #800080; font-weight: bold">@@ -885,7 +955,7 @@ static ftdm_status_t handle_show_flags(ftdm_stream_handle_t *stream, int span, i</span>
        int                                 lspan;
        int                                 lchan;
<span style="color: #A00000">-        x=1;</span>
<span style="color: #00A000">+        x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1;</span>
        while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) {
                if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) {
                        ss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj;
<span style="color: #800080; font-weight: bold">@@ -913,7 +983,7 @@ static ftdm_status_t handle_show_flags(ftdm_stream_handle_t *stream, int span, i</span>
        
                                for (bit = 0; bit < 33; bit++) {
                                        stream->write_function(stream, "|");
<span style="color: #A00000">-                                        if (ss7_info->flags & ( 0x1 << bit)) {</span>
<span style="color: #00A000">+                                        if (ss7_info->ckt_flags & ( 0x1 << bit)) {</span>
                                                stream->write_function(stream, "%2d=1", bit);
                                        } else {
                                                stream->write_function(stream, "%2d=0", bit);
<span style="color: #800080; font-weight: bold">@@ -941,7 +1011,7 @@ static ftdm_status_t handle_show_blocks(ftdm_stream_handle_t *stream, int span,</span>
        int                                 lspan;
        int                                 lchan;
<span style="color: #A00000">-        x=1;</span>
<span style="color: #00A000">+        x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1;</span>
        while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) {
                if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) {
                        ss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj;
<span style="color: #800080; font-weight: bold">@@ -967,37 +1037,37 @@ static ftdm_status_t handle_show_blocks(ftdm_stream_handle_t *stream, int span,</span>
                                                        ftdmchan->physical_chan_id,
                                                        ss7_info->circuit->cic);
<span style="color: #A00000">-                                if((sngss7_test_flag(ss7_info, FLAG_CKT_MN_BLOCK_TX)) || (sngss7_test_flag(ss7_info, FLAG_GRP_MN_BLOCK_TX))) {</span>
<span style="color: #00A000">+                                if((sngss7_test_ckt_flag(ss7_info, FLAG_CKT_MN_BLOCK_TX)) || (sngss7_test_ckt_flag(ss7_info, FLAG_GRP_MN_BLOCK_TX))) {</span>
                                        stream->write_function(stream, "l_mn=Y|");
                                }else {
                                        stream->write_function(stream, "l_mn=N|");
                                }
<span style="color: #A00000">-                                if((sngss7_test_flag(ss7_info, FLAG_CKT_MN_BLOCK_RX)) || (sngss7_test_flag(ss7_info, FLAG_GRP_MN_BLOCK_RX))) {</span>
<span style="color: #00A000">+                                if((sngss7_test_ckt_flag(ss7_info, FLAG_CKT_MN_BLOCK_RX)) || (sngss7_test_ckt_flag(ss7_info, FLAG_GRP_MN_BLOCK_RX))) {</span>
                                        stream->write_function(stream, "r_mn=Y|");
                                }else {
                                        stream->write_function(stream, "r_mn=N|");
                                }
<span style="color: #A00000">-                                if(sngss7_test_flag(ss7_info, FLAG_GRP_HW_BLOCK_TX)) {</span>
<span style="color: #00A000">+                                if(sngss7_test_ckt_flag(ss7_info, FLAG_GRP_HW_BLOCK_TX)) {</span>
                                        stream->write_function(stream, "l_hw=Y|");
                                }else {
                                        stream->write_function(stream, "l_hw=N|");
                                }
<span style="color: #A00000">-                                if(sngss7_test_flag(ss7_info, FLAG_GRP_HW_BLOCK_RX)) {</span>
<span style="color: #00A000">+                                if(sngss7_test_ckt_flag(ss7_info, FLAG_GRP_HW_BLOCK_RX)) {</span>
                                        stream->write_function(stream, "r_hw=Y|");
                                }else {
                                        stream->write_function(stream, "r_hw=N|");
                                }
<span style="color: #A00000">-                                if(sngss7_test_flag(ss7_info, FLAG_CKT_LC_BLOCK_RX)) {</span>
<span style="color: #00A000">+                                if(sngss7_test_ckt_flag(ss7_info, FLAG_CKT_LC_BLOCK_RX)) {</span>
                                        stream->write_function(stream, "l_mngmt=Y|");
                                }else {
                                        stream->write_function(stream, "l_mngmt=N|");
                                }
<span style="color: #A00000">-                                if(sngss7_test_flag(ss7_info, FLAG_CKT_UCIC_BLOCK)) {</span>
<span style="color: #00A000">+                                if(sngss7_test_ckt_flag(ss7_info, FLAG_CKT_UCIC_BLOCK)) {</span>
                                        stream->write_function(stream, "l_ucic=Y|");
                                }else {
                                        stream->write_function(stream, "l_ucic=N|");
<span style="color: #800080; font-weight: bold">@@ -1026,7 +1096,7 @@ static ftdm_status_t handle_show_status(ftdm_stream_handle_t *stream, int span,</span>
        ftdm_signaling_status_t                sigstatus = FTDM_SIG_STATE_DOWN;
        sng_isup_ckt_t                                *ckt;
<span style="color: #A00000">-        x=1;</span>
<span style="color: #00A000">+        x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1;</span>
        while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) {
                        /* extract the circuit to make it easier to work with */
                        ckt = &g_ftdm_sngss7_data.cfg.isupCkt[x];
<span style="color: #800080; font-weight: bold">@@ -1071,43 +1141,37 @@ static ftdm_status_t handle_show_status(ftdm_stream_handle_t *stream, int span,</span>
                                                                                                        ftdm_signaling_status2str(sigstatus),
                                                                                                        ftdm_channel_state2str(ftdmchan->state));
        
<span style="color: #A00000">-                                        if((sngss7_test_flag(ss7_info, FLAG_CKT_MN_BLOCK_TX)) || (sngss7_test_flag(ss7_info, FLAG_GRP_MN_BLOCK_TX))) {</span>
<span style="color: #00A000">+                                        if((sngss7_test_ckt_flag(ss7_info, FLAG_CKT_MN_BLOCK_TX)) || (sngss7_test_ckt_flag(ss7_info, FLAG_GRP_MN_BLOCK_TX))) {</span>
                                                stream->write_function(stream, "l_mn=Y|");
                                        }else {
                                                stream->write_function(stream, "l_mn=N|");
                                        }
        
<span style="color: #A00000">-                                        if((sngss7_test_flag(ss7_info, FLAG_CKT_MN_BLOCK_RX)) || (sngss7_test_flag(ss7_info, FLAG_GRP_MN_BLOCK_RX))) {</span>
<span style="color: #00A000">+                                        if((sngss7_test_ckt_flag(ss7_info, FLAG_CKT_MN_BLOCK_RX)) || (sngss7_test_ckt_flag(ss7_info, FLAG_GRP_MN_BLOCK_RX))) {</span>
                                                stream->write_function(stream, "r_mn=Y|");
                                        }else {
                                                stream->write_function(stream, "r_mn=N|");
                                        }
        
<span style="color: #A00000">-                                        if(sngss7_test_flag(ss7_info, FLAG_GRP_HW_BLOCK_TX)) {</span>
<span style="color: #00A000">+                                        if(sngss7_test_ckt_flag(ss7_info, FLAG_GRP_HW_BLOCK_TX)) {</span>
                                                stream->write_function(stream, "l_hw=Y|");
                                        }else {
                                                stream->write_function(stream, "l_hw=N|");
                                        }
        
<span style="color: #A00000">-                                        if(sngss7_test_flag(ss7_info, FLAG_GRP_HW_BLOCK_RX)) {</span>
<span style="color: #00A000">+                                        if(sngss7_test_ckt_flag(ss7_info, FLAG_GRP_HW_BLOCK_RX)) {</span>
                                                stream->write_function(stream, "r_hw=Y|");
                                        }else {
                                                stream->write_function(stream, "r_hw=N|");
                                        }
<span style="color: #A00000">-        </span>
<span style="color: #A00000">-                                        if(sngss7_test_flag(ss7_info, FLAG_CKT_LC_BLOCK_RX)) {</span>
<span style="color: #A00000">-                                                stream->write_function(stream, "l_mngmt=Y|");</span>
<span style="color: #A00000">-                                        }else {</span>
<span style="color: #A00000">-                                                stream->write_function(stream, "l_mngmt=N|");</span>
<span style="color: #A00000">-                                        }</span>
<span style="color: #A00000">-        </span>
<span style="color: #A00000">-                                        if(sngss7_test_flag(ss7_info, FLAG_CKT_UCIC_BLOCK)) {</span>
<span style="color: #A00000">-                                                stream->write_function(stream, "l_ucic=Y|");</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                                        if(sngss7_test_ckt_flag(ss7_info, FLAG_RELAY_DOWN)) {</span>
<span style="color: #00A000">+                                                stream->write_function(stream, "relay=Y|");</span>
                                        }else {
<span style="color: #A00000">-                                                stream->write_function(stream, "l_ucic=N|");</span>
<span style="color: #A00000">-                                        }                                </span>
<span style="color: #00A000">+                                                stream->write_function(stream, "relay=N|");</span>
<span style="color: #00A000">+                                        }                </span>
        
<span style="color: #A00000">-                                        stream->write_function(stream, "flags=0x%X",ss7_info->flags);</span>
<span style="color: #00A000">+                                        stream->write_function(stream, "flags=0x%X",ss7_info->ckt_flags);</span>
        
                                        stream->write_function(stream, "\n");
                                } /* if ( hole, sig, voice) */
<span style="color: #800080; font-weight: bold">@@ -1127,7 +1191,7 @@ static ftdm_status_t handle_tx_blo(ftdm_stream_handle_t *stream, int span, int c</span>
        int                                 lspan;
        int                                 lchan;
<span style="color: #A00000">-        x=1;</span>
<span style="color: #00A000">+        x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1;</span>
        while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) {
                if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) {
                        ss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj;
<span style="color: #800080; font-weight: bold">@@ -1162,7 +1226,7 @@ static ftdm_status_t handle_tx_blo(ftdm_stream_handle_t *stream, int span, int c</span>
                                        continue;
                                } else {
                                        /* throw the ckt block flag */
<span style="color: #A00000">-                                        sngss7_set_flag(ss7_info, FLAG_CKT_MN_BLOCK_TX);</span>
<span style="color: #00A000">+                                        sngss7_set_ckt_flag(ss7_info, FLAG_CKT_MN_BLOCK_TX);</span>
                                        /* set the channel to suspended state */
                                        ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
<span style="color: #800080; font-weight: bold">@@ -1193,7 +1257,7 @@ static ftdm_status_t handle_tx_ubl(ftdm_stream_handle_t *stream, int span, int c</span>
        int                                 lspan;
        int                                 lchan;
<span style="color: #A00000">-        x=1;</span>
<span style="color: #00A000">+        x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1;</span>
        while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) {
                if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) {
                        ss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj;
<span style="color: #800080; font-weight: bold">@@ -1228,10 +1292,10 @@ static ftdm_status_t handle_tx_ubl(ftdm_stream_handle_t *stream, int span, int c</span>
                                        continue;
                                } else {
                                        /* throw the ckt block flag */
<span style="color: #A00000">-                                        sngss7_set_flag(ss7_info, FLAG_CKT_MN_UNBLK_TX);</span>
<span style="color: #00A000">+                                        sngss7_set_ckt_flag(ss7_info, FLAG_CKT_MN_UNBLK_TX);</span>
                                        /* clear the block flag */
<span style="color: #A00000">-                                        sngss7_clear_flag(ss7_info, FLAG_CKT_MN_BLOCK_TX);</span>
<span style="color: #00A000">+                                        sngss7_clear_ckt_flag(ss7_info, FLAG_CKT_MN_BLOCK_TX);</span>
                                        /* set the channel to suspended state */
                                        ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
<span style="color: #800080; font-weight: bold">@@ -1254,18 +1318,18 @@ static ftdm_status_t handle_tx_ubl(ftdm_stream_handle_t *stream, int span, int c</span>
}
/******************************************************************************/
<span style="color: #A00000">-static ftdm_status_t handle_status_link(ftdm_stream_handle_t *stream, char *name)</span>
<span style="color: #00A000">+static ftdm_status_t handle_status_mtp3link(ftdm_stream_handle_t *stream, char *name)</span>
{
        int                 x = 0;
        SnMngmt                sta;
        
        /* find the link request by it's name */
        x = 1;
<span style="color: #A00000">-        while(g_ftdm_sngss7_data.cfg.mtpLink[x].id != 0) {</span>
<span style="color: #A00000">-                if (!strcasecmp(g_ftdm_sngss7_data.cfg.mtpLink[x].name, name)) {</span>
<span style="color: #00A000">+        while(g_ftdm_sngss7_data.cfg.mtp3Link[x].id != 0) {</span>
<span style="color: #00A000">+                if (!strcasecmp(g_ftdm_sngss7_data.cfg.mtp3Link[x].name, name)) {</span>
                        /* send the status request */
<span style="color: #A00000">-                        if (ftmod_ss7_mtplink_sta(x, &sta)) {</span>
<span style="color: #00A000">+                        if (ftmod_ss7_mtp3link_sta(x, &sta)) {</span>
                                stream->write_function(stream, "Failed to read link=%s status\n", name);
                                return FTDM_FAIL;
                        }
<span style="color: #800080; font-weight: bold">@@ -1273,9 +1337,9 @@ static ftdm_status_t handle_status_link(ftdm_stream_handle_t *stream, char *name</span>
                        /* print the results */
                        stream->write_function(stream, "%s|span=%d|chan=%d|sap=%d|state=%s|l_blk=%s|r_blk=%s|l_inhbt=%s|r_inhbt=%s\n",
                                                name,
<span style="color: #A00000">-                                                g_ftdm_sngss7_data.cfg.mtpLink[x].mtp1.span,</span>
<span style="color: #A00000">-                                                g_ftdm_sngss7_data.cfg.mtpLink[x].mtp1.chan,</span>
<span style="color: #A00000">-                                                g_ftdm_sngss7_data.cfg.mtpLink[x].id,</span>
<span style="color: #00A000">+                                                g_ftdm_sngss7_data.cfg.mtp1Link[x].span,</span>
<span style="color: #00A000">+                                                g_ftdm_sngss7_data.cfg.mtp1Link[x].chan,</span>
<span style="color: #00A000">+                                                g_ftdm_sngss7_data.cfg.mtp3Link[x].id,</span>
                                                DECODE_LSN_LINK_STATUS(sta.t.ssta.s.snDLSAP.state),
                                                (sta.t.ssta.s.snDLSAP.locBlkd) ? "Y":"N",
                                                (sta.t.ssta.s.snDLSAP.remBlkd) ? "Y":"N",
<span style="color: #800080; font-weight: bold">@@ -1296,6 +1360,50 @@ success:</span>
}
/******************************************************************************/
<span style="color: #00A000">+static ftdm_status_t handle_status_mtp2link(ftdm_stream_handle_t *stream, char *name)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        int                 x = 0;</span>
<span style="color: #00A000">+        SdMngmt                sta;</span>
<span style="color: #00A000">+        </span>
<span style="color: #00A000">+        /* find the link request by it's name */</span>
<span style="color: #00A000">+        x = 1;</span>
<span style="color: #00A000">+        while(g_ftdm_sngss7_data.cfg.mtp2Link[x].id != 0) {</span>
<span style="color: #00A000">+                if (!strcasecmp(g_ftdm_sngss7_data.cfg.mtp2Link[x].name, name)) {</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                        /* send the status request */</span>
<span style="color: #00A000">+                        if (ftmod_ss7_mtp2link_sta(x, &sta)) {</span>
<span style="color: #00A000">+                                stream->write_function(stream, "Failed to read link=%s status\n", name);</span>
<span style="color: #00A000">+                                return FTDM_FAIL;</span>
<span style="color: #00A000">+                        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                        /* print the results */</span>
<span style="color: #00A000">+                        stream->write_function(stream, "%s|span=%d|chan=%d|sap=%d|state=%s|outsFrm=%d|drpdFrm=%d|lclStatus=%s|rmtStatus=%s|fsn=%d|bsn=%d\n",</span>
<span style="color: #00A000">+                                                name,</span>
<span style="color: #00A000">+                                                g_ftdm_sngss7_data.cfg.mtp1Link[x].span,</span>
<span style="color: #00A000">+                                                g_ftdm_sngss7_data.cfg.mtp1Link[x].chan,</span>
<span style="color: #00A000">+                                                g_ftdm_sngss7_data.cfg.mtp2Link[x].id,</span>
<span style="color: #00A000">+                                                DECODE_LSD_LINK_STATUS(sta.t.ssta.s.sdDLSAP.hlSt),</span>
<span style="color: #00A000">+                                                sta.t.ssta.s.sdDLSAP.psOutsFrm,</span>
<span style="color: #00A000">+                                                sta.t.ssta.s.sdDLSAP.cntMaDrop,</span>
<span style="color: #00A000">+                                                (sta.t.ssta.s.sdDLSAP.lclBsy) ? "Y":"N",</span>
<span style="color: #00A000">+                                                (sta.t.ssta.s.sdDLSAP.remBsy) ? "Y":"N",</span>
<span style="color: #00A000">+                                                sta.t.ssta.s.sdDLSAP.fsn,</span>
<span style="color: #00A000">+                                                sta.t.ssta.s.sdDLSAP.bsn);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                        goto success;</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+                </span>
<span style="color: #00A000">+                /* move to the next link */</span>
<span style="color: #00A000">+                x++;</span>
<span style="color: #00A000">+        } /* while (id != 0) */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        stream->write_function(stream, "Failed to find link=\"%s\"\n", name);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+success:</span>
<span style="color: #00A000">+        return FTDM_SUCCESS;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/******************************************************************************/</span>
static ftdm_status_t handle_status_linkset(ftdm_stream_handle_t *stream, char *name)
{
        int                 x = 0;
<span style="color: #800080; font-weight: bold">@@ -1338,17 +1446,17 @@ static ftdm_status_t handle_set_inhibit(ftdm_stream_handle_t *stream, char *name</span>
        /* find the link request by it's name */
        x = 1;
<span style="color: #A00000">-        while(g_ftdm_sngss7_data.cfg.mtpLink[x].id != 0) {</span>
<span style="color: #A00000">-                if (!strcasecmp(g_ftdm_sngss7_data.cfg.mtpLink[x].name, name)) {</span>
<span style="color: #00A000">+        while(g_ftdm_sngss7_data.cfg.mtp3Link[x].id != 0) {</span>
<span style="color: #00A000">+                if (!strcasecmp(g_ftdm_sngss7_data.cfg.mtp3Link[x].name, name)) {</span>
                        /* send the inhibit request */
<span style="color: #A00000">-                        if (ftmod_ss7_inhibit_mtplink(x)) {</span>
<span style="color: #00A000">+                        if (ftmod_ss7_inhibit_mtp3link(x)) {</span>
                                stream->write_function(stream, "Failed to inhibit link=%s\n", name);
                                return FTDM_FAIL;
                        }
                        /* print the new status of the link */
<span style="color: #A00000">-                        handle_status_link(stream, &name[0]);</span>
<span style="color: #00A000">+                        handle_status_mtp3link(stream, &name[0]);</span>
                        goto success;
                }
<span style="color: #800080; font-weight: bold">@@ -1370,17 +1478,17 @@ static ftdm_status_t handle_set_uninhibit(ftdm_stream_handle_t *stream, char *na</span>
        /* find the link request by it's name */
        x = 1;
<span style="color: #A00000">-        while(g_ftdm_sngss7_data.cfg.mtpLink[x].id != 0) {</span>
<span style="color: #A00000">-                if (!strcasecmp(g_ftdm_sngss7_data.cfg.mtpLink[x].name, name)) {</span>
<span style="color: #00A000">+        while(g_ftdm_sngss7_data.cfg.mtp3Link[x].id != 0) {</span>
<span style="color: #00A000">+                if (!strcasecmp(g_ftdm_sngss7_data.cfg.mtp3Link[x].name, name)) {</span>
                        /* send the uninhibit request */
<span style="color: #A00000">-                        if (ftmod_ss7_uninhibit_mtplink(x)) {</span>
<span style="color: #00A000">+                        if (ftmod_ss7_uninhibit_mtp3link(x)) {</span>
                                stream->write_function(stream, "Failed to uninhibit link=%s\n", name);
                                return FTDM_FAIL;
                        }
                        /* print the new status of the link */
<span style="color: #A00000">-                        handle_status_link(stream, &name[0]);</span>
<span style="color: #00A000">+                        handle_status_mtp3link(stream, &name[0]);</span>
                        goto success;
                }
<span style="color: #800080; font-weight: bold">@@ -1404,7 +1512,7 @@ static ftdm_status_t handle_tx_rsc(ftdm_stream_handle_t *stream, int span, int c</span>
        int                                         lspan;
        int                                         lchan;
<span style="color: #A00000">-        x=1;</span>
<span style="color: #00A000">+        x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1;</span>
        while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) {
                if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) {
                        sngss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj;
<span style="color: #800080; font-weight: bold">@@ -1429,7 +1537,7 @@ static ftdm_status_t handle_tx_rsc(ftdm_stream_handle_t *stream, int span, int c</span>
                                ftdm_mutex_lock(ftdmchan->mutex);
                                /* throw the reset flag */
<span style="color: #A00000">-                                sngss7_set_flag(sngss7_info, FLAG_RESET_TX);</span>
<span style="color: #00A000">+                                sngss7_set_ckt_flag(sngss7_info, FLAG_RESET_TX);</span>
                                switch (ftdmchan->state) {
                                /**************************************************************************/
<span style="color: #800080; font-weight: bold">@@ -1476,7 +1584,7 @@ static ftdm_status_t handle_tx_grs(ftdm_stream_handle_t *stream, int span, int c</span>
                return FTDM_SUCCESS;
        }
<span style="color: #A00000">-        x=1;</span>
<span style="color: #00A000">+        x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1;</span>
        while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) {
                if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) {
<span style="color: #800080; font-weight: bold">@@ -1500,9 +1608,9 @@ static ftdm_status_t handle_tx_grs(ftdm_stream_handle_t *stream, int span, int c</span>
                                        continue;
                                } else {
                                        /* throw the grp reset flag */
<span style="color: #A00000">-                                        sngss7_set_flag(sngss7_info, FLAG_GRP_RESET_TX);</span>
<span style="color: #00A000">+                                        sngss7_set_ckt_flag(sngss7_info, FLAG_GRP_RESET_TX);</span>
                                        if (ftdmchan->physical_chan_id == chan) {
<span style="color: #A00000">-                                                sngss7_set_flag(sngss7_info, FLAG_GRP_RESET_BASE);</span>
<span style="color: #00A000">+                                                sngss7_set_ckt_flag(sngss7_info, FLAG_GRP_RESET_BASE);</span>
                                                sngss7_span->tx_grs.circuit = sngss7_info->circuit->id;
                                                sngss7_span->tx_grs.range = range-1;
                                        }
<span style="color: #800080; font-weight: bold">@@ -1523,7 +1631,7 @@ static ftdm_status_t handle_tx_grs(ftdm_stream_handle_t *stream, int span, int c</span>
                x++;
        } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x]id != 0) */
        
<span style="color: #A00000">-        x=1;</span>
<span style="color: #00A000">+        x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1;</span>
        while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) {
                if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) {
<span style="color: #800080; font-weight: bold">@@ -1565,7 +1673,7 @@ static ftdm_status_t handle_tx_cgb(ftdm_stream_handle_t *stream, int span, int c</span>
                return FTDM_SUCCESS;
        }
<span style="color: #A00000">-        x=1;</span>
<span style="color: #00A000">+        x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1;</span>
        while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) {
                if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) {
<span style="color: #800080; font-weight: bold">@@ -1582,7 +1690,7 @@ static ftdm_status_t handle_tx_cgb(ftdm_stream_handle_t *stream, int span, int c</span>
                                ftdm_mutex_lock(ftdmchan->mutex);
                                /* throw the grp maint. block flag */
<span style="color: #A00000">-                                sngss7_set_flag(sngss7_info, FLAG_GRP_MN_BLOCK_TX);</span>
<span style="color: #00A000">+                                sngss7_set_ckt_flag(sngss7_info, FLAG_GRP_MN_BLOCK_TX);</span>
                                /* bring the sig status down */
                                sigev.chan_id = ftdmchan->chan_id;
<span style="color: #800080; font-weight: bold">@@ -1622,7 +1730,7 @@ static ftdm_status_t handle_tx_cgb(ftdm_stream_handle_t *stream, int span, int c</span>
        /* send the circuit group block */
        ft_to_sngss7_cgb(main_chan);
<span style="color: #A00000">-        x=1;</span>
<span style="color: #00A000">+        x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1;</span>
        while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) {
                if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) {
<span style="color: #800080; font-weight: bold">@@ -1665,7 +1773,7 @@ static ftdm_status_t handle_tx_cgu(ftdm_stream_handle_t *stream, int span, int c</span>
                return FTDM_SUCCESS;
        }
<span style="color: #A00000">-        x=1;</span>
<span style="color: #00A000">+        x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1;</span>
        while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) {
                if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) {
<span style="color: #800080; font-weight: bold">@@ -1682,7 +1790,7 @@ static ftdm_status_t handle_tx_cgu(ftdm_stream_handle_t *stream, int span, int c</span>
                                ftdm_mutex_lock(ftdmchan->mutex);
                                /* throw the grp maint. block flag */
<span style="color: #A00000">-                                sngss7_clear_flag(sngss7_info, FLAG_GRP_MN_BLOCK_TX);</span>
<span style="color: #00A000">+                                sngss7_clear_ckt_flag(sngss7_info, FLAG_GRP_MN_BLOCK_TX);</span>
                                /* bring the sig status up */
                                sigev.chan_id = ftdmchan->chan_id;
<span style="color: #800080; font-weight: bold">@@ -1722,7 +1830,7 @@ static ftdm_status_t handle_tx_cgu(ftdm_stream_handle_t *stream, int span, int c</span>
        /* send the circuit group block */
        ft_to_sngss7_cgu(main_chan);
<span style="color: #A00000">-        x=1;</span>
<span style="color: #00A000">+        x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1;</span>
        while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) {
                if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) {
<span style="color: #800080; font-weight: bold">@@ -1746,23 +1854,85 @@ static ftdm_status_t handle_tx_cgu(ftdm_stream_handle_t *stream, int span, int c</span>
}
/******************************************************************************/
<span style="color: #00A000">+static ftdm_status_t handle_bind_link(ftdm_stream_handle_t *stream, char *name)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        int                x = 0;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* find the link request by it's name */</span>
<span style="color: #00A000">+        x = 1;</span>
<span style="color: #00A000">+        while(g_ftdm_sngss7_data.cfg.mtp3Link[x].id != 0) {</span>
<span style="color: #00A000">+                if (!strcasecmp(g_ftdm_sngss7_data.cfg.mtp3Link[x].name, name)) {</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                        /* send the uninhibit request */</span>
<span style="color: #00A000">+                        if (ftmod_ss7_bind_mtp3link(g_ftdm_sngss7_data.cfg.mtp3Link[x].mtp2Id)) {</span>
<span style="color: #00A000">+                                stream->write_function(stream, "Failed to bind link=%s\n", name);</span>
<span style="color: #00A000">+                                return FTDM_FAIL;</span>
<span style="color: #00A000">+                        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                        /* print the new status of the link */</span>
<span style="color: #00A000">+                        handle_status_mtp3link(stream, &name[0]);</span>
<span style="color: #00A000">+                        goto success;</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+ </span>
<span style="color: #00A000">+                /* move to the next link */</span>
<span style="color: #00A000">+                x++;</span>
<span style="color: #00A000">+        } /* while (id != 0) */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        stream->write_function(stream, "Could not find link=%s\n", name);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+success:</span>
<span style="color: #00A000">+        return FTDM_SUCCESS;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/******************************************************************************/</span>
<span style="color: #00A000">+static ftdm_status_t handle_unbind_link(ftdm_stream_handle_t *stream, char *name)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        int                x = 0;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* find the link request by it's name */</span>
<span style="color: #00A000">+        x = 1;</span>
<span style="color: #00A000">+        while(g_ftdm_sngss7_data.cfg.mtp3Link[x].id != 0) {</span>
<span style="color: #00A000">+                if (!strcasecmp(g_ftdm_sngss7_data.cfg.mtp3Link[x].name, name)) {</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                        /* send the uninhibit request */</span>
<span style="color: #00A000">+                        if (ftmod_ss7_unbind_mtp3link(g_ftdm_sngss7_data.cfg.mtp3Link[x].mtp2Id)) {</span>
<span style="color: #00A000">+                                stream->write_function(stream, "Failed to bind link=%s\n", name);</span>
<span style="color: #00A000">+                                return FTDM_FAIL;</span>
<span style="color: #00A000">+                        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                        /* print the new status of the link */</span>
<span style="color: #00A000">+                        handle_status_mtp3link(stream, &name[0]);</span>
<span style="color: #00A000">+                        goto success;</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+ </span>
<span style="color: #00A000">+                /* move to the next link */</span>
<span style="color: #00A000">+                x++;</span>
<span style="color: #00A000">+        } /* while (id != 0) */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        stream->write_function(stream, "Could not find link=%s\n", name);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+success:</span>
<span style="color: #00A000">+        return FTDM_SUCCESS;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/******************************************************************************/</span>
static ftdm_status_t handle_activate_link(ftdm_stream_handle_t *stream, char *name)
{
        int                x = 0;
        /* find the link request by it's name */
        x = 1;
<span style="color: #A00000">-        while(g_ftdm_sngss7_data.cfg.mtpLink[x].id != 0) {</span>
<span style="color: #A00000">-                if (!strcasecmp(g_ftdm_sngss7_data.cfg.mtpLink[x].name, name)) {</span>
<span style="color: #00A000">+        while(g_ftdm_sngss7_data.cfg.mtp3Link[x].id != 0) {</span>
<span style="color: #00A000">+                if (!strcasecmp(g_ftdm_sngss7_data.cfg.mtp3Link[x].name, name)) {</span>
                        /* send the uninhibit request */
<span style="color: #A00000">-                        if (ftmod_ss7_activate_mtplink(x)) {</span>
<span style="color: #00A000">+                        if (ftmod_ss7_activate_mtp3link(x)) {</span>
                                stream->write_function(stream, "Failed to activate link=%s\n", name);
                                return FTDM_FAIL;
                        }
                        /* print the new status of the link */
<span style="color: #A00000">-                        handle_status_link(stream, &name[0]);</span>
<span style="color: #00A000">+                        handle_status_mtp3link(stream, &name[0]);</span>
                        goto success;
                }
<span style="color: #800080; font-weight: bold">@@ -1783,17 +1953,17 @@ static ftdm_status_t handle_deactivate_link(ftdm_stream_handle_t *stream, char *</span>
        /* find the link request by it's name */
        x = 1;
<span style="color: #A00000">-        while(g_ftdm_sngss7_data.cfg.mtpLink[x].id != 0) {</span>
<span style="color: #A00000">-                if (!strcasecmp(g_ftdm_sngss7_data.cfg.mtpLink[x].name, name)) {</span>
<span style="color: #00A000">+        while(g_ftdm_sngss7_data.cfg.mtp3Link[x].id != 0) {</span>
<span style="color: #00A000">+                if (!strcasecmp(g_ftdm_sngss7_data.cfg.mtp3Link[x].name, name)) {</span>
                        /* send the deactivate request */
<span style="color: #A00000">-                        if (ftmod_ss7_deactivate2_mtplink(x)) {</span>
<span style="color: #00A000">+                        if (ftmod_ss7_deactivate2_mtp3link(x)) {</span>
                                stream->write_function(stream, "Failed to deactivate link=%s\n", name);
                                return FTDM_FAIL;
                        }
                        /* print the new status of the link */
<span style="color: #A00000">-                        handle_status_link(stream, &name[0]);</span>
<span style="color: #00A000">+                        handle_status_mtp3link(stream, &name[0]);</span>
                        goto success;
                }
<span style="color: #800080; font-weight: bold">@@ -1877,17 +2047,17 @@ static ftdm_status_t handle_tx_lpo(ftdm_stream_handle_t *stream, char *name)</span>
        /* find the link request by it's name */
        x = 1;
<span style="color: #A00000">-        while(g_ftdm_sngss7_data.cfg.mtpLink[x].id != 0) {</span>
<span style="color: #A00000">-                if (!strcasecmp(g_ftdm_sngss7_data.cfg.mtpLink[x].name, name)) {</span>
<span style="color: #00A000">+        while(g_ftdm_sngss7_data.cfg.mtp3Link[x].id != 0) {</span>
<span style="color: #00A000">+                if (!strcasecmp(g_ftdm_sngss7_data.cfg.mtp3Link[x].name, name)) {</span>
                        /* send the uninhibit request */
<span style="color: #A00000">-                        if (ftmod_ss7_lpo_mtplink(x)) {</span>
<span style="color: #00A000">+                        if (ftmod_ss7_lpo_mtp3link(x)) {</span>
                                stream->write_function(stream, "Failed set LPO link=%s\n", name);
                                return FTDM_FAIL;
                        }
                        /* print the new status of the link */
<span style="color: #A00000">-                        handle_status_link(stream, &name[0]);</span>
<span style="color: #00A000">+                        handle_status_mtp3link(stream, &name[0]);</span>
                        goto success;
                }
<span style="color: #800080; font-weight: bold">@@ -1908,17 +2078,17 @@ static ftdm_status_t handle_tx_lpr(ftdm_stream_handle_t *stream, char *name)</span>
        /* find the link request by it's name */
        x = 1;
<span style="color: #A00000">-        while(g_ftdm_sngss7_data.cfg.mtpLink[x].id != 0) {</span>
<span style="color: #A00000">-                if (!strcasecmp(g_ftdm_sngss7_data.cfg.mtpLink[x].name, name)) {</span>
<span style="color: #00A000">+        while(g_ftdm_sngss7_data.cfg.mtp3Link[x].id != 0) {</span>
<span style="color: #00A000">+                if (!strcasecmp(g_ftdm_sngss7_data.cfg.mtp3Link[x].name, name)) {</span>
                        /* send the uninhibit request */
<span style="color: #A00000">-                        if (ftmod_ss7_lpr_mtplink(x)) {</span>
<span style="color: #00A000">+                        if (ftmod_ss7_lpr_mtp3link(x)) {</span>
                                stream->write_function(stream, "Failed set LPR link=%s\n", name);
                                return FTDM_FAIL;
                        }
                        /* print the new status of the link */
<span style="color: #A00000">-                        handle_status_link(stream, &name[0]);</span>
<span style="color: #00A000">+                        handle_status_mtp3link(stream, &name[0]);</span>
                        goto success;
                }
<span style="color: #800080; font-weight: bold">@@ -1933,6 +2103,47 @@ success:</span>
}
/******************************************************************************/
<span style="color: #00A000">+static ftdm_status_t handle_status_relay(ftdm_stream_handle_t *stream, char *name)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        RyMngmt        sta;</span>
<span style="color: #00A000">+        int                x = 0;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        memset(&sta, 0x0, sizeof(sta));</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* find the channel request by it's name */</span>
<span style="color: #00A000">+        x = 1;</span>
<span style="color: #00A000">+        while(g_ftdm_sngss7_data.cfg.relay[x].id != 0) {</span>
<span style="color: #00A000">+                if (!strcasecmp(g_ftdm_sngss7_data.cfg.relay[x].name, name)) {</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                        if (ftmod_ss7_relay_status(g_ftdm_sngss7_data.cfg.relay[x].id, &sta)) {</span>
<span style="color: #00A000">+                                stream->write_function(stream, "Failed to read relay =%s status\n", name);</span>
<span style="color: #00A000">+                                return FTDM_FAIL;</span>
<span style="color: #00A000">+                        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                        /* print the results */</span>
<span style="color: #00A000">+                        stream->write_function(stream, "%s|sap=%d|type=%d|port=%d|hostname=%s|procId=%d|status=%s\n",</span>
<span style="color: #00A000">+                                                name,</span>
<span style="color: #00A000">+                                                g_ftdm_sngss7_data.cfg.relay[x].id,        </span>
<span style="color: #00A000">+                                                g_ftdm_sngss7_data.cfg.relay[x].type,</span>
<span style="color: #00A000">+                                                g_ftdm_sngss7_data.cfg.relay[x].port,</span>
<span style="color: #00A000">+                                                g_ftdm_sngss7_data.cfg.relay[x].hostname,</span>
<span style="color: #00A000">+                                                g_ftdm_sngss7_data.cfg.relay[x].procId,</span>
<span style="color: #00A000">+                                                DECODE_LRY_CHAN_STATUS(sta.t.ssta.rySta.cStatus));</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                        goto success;</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+                </span>
<span style="color: #00A000">+                /* move to the next link */</span>
<span style="color: #00A000">+                x++;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        } /* g_ftdm_sngss7_data.cfg.relay[x].id */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+success:</span>
<span style="color: #00A000">+        return FTDM_SUCCESS;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/******************************************************************************/</span>
static ftdm_status_t extract_span_chan(char *argv[10], int pos, int *span, int *chan)
{
<span style="color: #000080; font-weight: bold">diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cntrl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cntrl.c</span>
<span style="color: #000080; font-weight: bold">index 87733dd..c1b18e5 100644</span>
<span style="color: #A00000">--- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cntrl.c</span>
<span style="color: #00A000">+++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cntrl.c</span>
<span style="color: #800080; font-weight: bold">@@ -48,19 +48,31 @@ static int ftmod_ss7_enable_isap(int suId);</span>
static int ftmod_ss7_enable_nsap(int suId);
static int ftmod_ss7_enable_mtpLinkSet(int lnkSetId);
<span style="color: #A00000">-int ftmod_ss7_inhibit_mtplink(uint32_t id);</span>
<span style="color: #A00000">-int ftmod_ss7_uninhibit_mtplink(uint32_t id);</span>
<span style="color: #00A000">+int ftmod_ss7_inhibit_mtp3link(uint32_t id);</span>
<span style="color: #00A000">+int ftmod_ss7_uninhibit_mtp3link(uint32_t id);</span>
<span style="color: #A00000">-int ftmod_ss7_activate_mtplink(uint32_t id);</span>
<span style="color: #A00000">-int ftmod_ss7_deactivate_mtplink(uint32_t id);</span>
<span style="color: #A00000">-int ftmod_ss7_deactivate2_mtplink(uint32_t id);</span>
<span style="color: #00A000">+int ftmod_ss7_bind_mtp3link(uint32_t id);</span>
<span style="color: #00A000">+int ftmod_ss7_unbind_mtp3link(uint32_t id);</span>
<span style="color: #00A000">+int ftmod_ss7_activate_mtp3link(uint32_t id);</span>
<span style="color: #00A000">+int ftmod_ss7_deactivate_mtp3link(uint32_t id);</span>
<span style="color: #00A000">+int ftmod_ss7_deactivate2_mtp3link(uint32_t id);</span>
int ftmod_ss7_activate_mtplinkSet(uint32_t id);
int ftmod_ss7_deactivate_mtplinkSet(uint32_t id);
int ftmod_ss7_deactivate2_mtplinkSet(uint32_t id);
<span style="color: #A00000">-int ftmod_ss7_lpo_mtplink(uint32_t id);</span>
<span style="color: #A00000">-int ftmod_ss7_lpr_mtplink(uint32_t id);</span>
<span style="color: #00A000">+int ftmod_ss7_lpo_mtp3link(uint32_t id);</span>
<span style="color: #00A000">+int ftmod_ss7_lpr_mtp3link(uint32_t id);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+int ftmod_ss7_shutdown_isup(void);</span>
<span style="color: #00A000">+int ftmod_ss7_shutdown_mtp3(void);</span>
<span style="color: #00A000">+int ftmod_ss7_shutdown_mtp2(void);</span>
<span style="color: #00A000">+int ftmod_ss7_shutdown_relay(void);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+int ftmod_ss7_disable_grp_mtp3Link(uint32_t procId);</span>
<span style="color: #00A000">+int ftmod_ss7_enable_grp_mtp3Link(uint32_t procId);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+int ftmod_ss7_disable_grp_mtp2Link(uint32_t procId);</span>
/******************************************************************************/
/* FUNCTIONS ******************************************************************/
<span style="color: #800080; font-weight: bold">@@ -71,7 +83,7 @@ int ft_to_sngss7_activate_all(void)</span>
        x = 1;
        while (g_ftdm_sngss7_data.cfg.isap[x].id != 0) {
                /* check if this link has already been actived */
<span style="color: #A00000">-                if (!(g_ftdm_sngss7_data.cfg.isap[x].flags & ACTIVE)) {</span>
<span style="color: #00A000">+                if (!(g_ftdm_sngss7_data.cfg.isap[x].flags & SNGSS7_ACTIVE)) {</span>
                        if (ftmod_ss7_enable_isap(x)) {        
                                SS7_CRITICAL("ISAP %d Enable: NOT OK\n", x);
<span style="color: #800080; font-weight: bold">@@ -80,9 +92,9 @@ int ft_to_sngss7_activate_all(void)</span>
                                SS7_INFO("ISAP %d Enable: OK\n", x);
                        }
<span style="color: #A00000">-                        /* set the ACTIVE flag */</span>
<span style="color: #A00000">-                        g_ftdm_sngss7_data.cfg.isap[x].flags |= ACTIVE;</span>
<span style="color: #A00000">-                } /* if !ACTIVE */</span>
<span style="color: #00A000">+                        /* set the SNGSS7_ACTIVE flag */</span>
<span style="color: #00A000">+                        g_ftdm_sngss7_data.cfg.isap[x].flags |= SNGSS7_ACTIVE;</span>
<span style="color: #00A000">+                } /* if !SNGSS7_ACTIVE */</span>
                
                x++;
        } /* while (g_ftdm_sngss7_data.cfg.isap[x].id != 0) */
<span style="color: #800080; font-weight: bold">@@ -90,7 +102,7 @@ int ft_to_sngss7_activate_all(void)</span>
        x = 1;
        while (g_ftdm_sngss7_data.cfg.nsap[x].id != 0) {
                /* check if this link has already been actived */
<span style="color: #A00000">-                if (!(g_ftdm_sngss7_data.cfg.nsap[x].flags & ACTIVE)) {</span>
<span style="color: #00A000">+                if (!(g_ftdm_sngss7_data.cfg.nsap[x].flags & SNGSS7_ACTIVE)) {</span>
                        if (ftmod_ss7_enable_nsap(x)) {        
                                SS7_CRITICAL("NSAP %d Enable: NOT OK\n", x);
<span style="color: #800080; font-weight: bold">@@ -99,31 +111,33 @@ int ft_to_sngss7_activate_all(void)</span>
                                SS7_INFO("NSAP %d Enable: OK\n", x);
                        }
<span style="color: #A00000">-                        /* set the ACTIVE flag */</span>
<span style="color: #A00000">-                        g_ftdm_sngss7_data.cfg.nsap[x].flags |= ACTIVE;</span>
<span style="color: #A00000">-                } /* if !ACTIVE */</span>
<span style="color: #00A000">+                        /* set the SNGSS7_ACTIVE flag */</span>
<span style="color: #00A000">+                        g_ftdm_sngss7_data.cfg.nsap[x].flags |= SNGSS7_ACTIVE;</span>
<span style="color: #00A000">+                } /* if !SNGSS7_ACTIVE */</span>
                
                x++;
        } /* while (g_ftdm_sngss7_data.cfg.nsap[x].id != 0) */
<span style="color: #A00000">-        x = 1;</span>
<span style="color: #A00000">-        while (g_ftdm_sngss7_data.cfg.mtpLinkSet[x].id != 0) {</span>
<span style="color: #A00000">-                /* check if this link has already been actived */</span>
<span style="color: #A00000">-                if (!(g_ftdm_sngss7_data.cfg.mtpLinkSet[x].flags & ACTIVE)) {</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                        if (ftmod_ss7_enable_mtpLinkSet(x)) {        </span>
<span style="color: #A00000">-                                SS7_CRITICAL("LinkSet \"%s\" Enable: NOT OK\n", g_ftdm_sngss7_data.cfg.mtpLinkSet[x].name);</span>
<span style="color: #A00000">-                                return 1;</span>
<span style="color: #A00000">-                        } else {</span>
<span style="color: #A00000">-                                SS7_INFO("LinkSet \"%s\" Enable: OK\n", g_ftdm_sngss7_data.cfg.mtpLinkSet[x].name);</span>
<span style="color: #A00000">-                        }</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                        /* set the ACTIVE flag */</span>
<span style="color: #A00000">-                        g_ftdm_sngss7_data.cfg.mtpLinkSet[x].flags |= ACTIVE;</span>
<span style="color: #A00000">-                } /* if !ACTIVE */</span>
<span style="color: #A00000">-                </span>
<span style="color: #A00000">-                x++;</span>
<span style="color: #A00000">-        } /* while (g_ftdm_sngss7_data.cfg.mtpLinkSet[x].id != 0) */</span>
<span style="color: #00A000">+        if (g_ftdm_sngss7_data.cfg.mtpRoute[1].id != 0) {</span>
<span style="color: #00A000">+                x = 1;</span>
<span style="color: #00A000">+                while (g_ftdm_sngss7_data.cfg.mtpLinkSet[x].id != 0) {</span>
<span style="color: #00A000">+                        /* check if this link has already been actived */</span>
<span style="color: #00A000">+                        if (!(g_ftdm_sngss7_data.cfg.mtpLinkSet[x].flags & SNGSS7_ACTIVE)) {</span>
<span style="color: #00A000">+        </span>
<span style="color: #00A000">+                                if (ftmod_ss7_enable_mtpLinkSet(x)) {        </span>
<span style="color: #00A000">+                                        SS7_CRITICAL("LinkSet \"%s\" Enable: NOT OK\n", g_ftdm_sngss7_data.cfg.mtpLinkSet[x].name);</span>
<span style="color: #00A000">+                                        return 1;</span>
<span style="color: #00A000">+                                } else {</span>
<span style="color: #00A000">+                                        SS7_INFO("LinkSet \"%s\" Enable: OK\n", g_ftdm_sngss7_data.cfg.mtpLinkSet[x].name);</span>
<span style="color: #00A000">+                                }</span>
<span style="color: #00A000">+        </span>
<span style="color: #00A000">+                                /* set the SNGSS7_ACTIVE flag */</span>
<span style="color: #00A000">+                                g_ftdm_sngss7_data.cfg.mtpLinkSet[x].flags |= SNGSS7_ACTIVE;</span>
<span style="color: #00A000">+                        } /* if !SNGSS7_ACTIVE */</span>
<span style="color: #00A000">+                        </span>
<span style="color: #00A000">+                        x++;</span>
<span style="color: #00A000">+                } /* while (g_ftdm_sngss7_data.cfg.mtpLinkSet[x].id != 0) */</span>
<span style="color: #00A000">+        }</span>
        return 0;
}
<span style="color: #800080; font-weight: bold">@@ -223,7 +237,7 @@ static int ftmod_ss7_enable_mtpLinkSet(int lnkSetId)</span>
}
/******************************************************************************/
<span style="color: #A00000">-int ftmod_ss7_inhibit_mtplink(uint32_t id)</span>
<span style="color: #00A000">+int ftmod_ss7_inhibit_mtp3link(uint32_t id)</span>
{
        SnMngmt cntrl;
        Pst pst;
<span style="color: #800080; font-weight: bold">@@ -253,7 +267,7 @@ int ftmod_ss7_inhibit_mtplink(uint32_t id)</span>
}
/******************************************************************************/
<span style="color: #A00000">-int ftmod_ss7_uninhibit_mtplink(uint32_t id)</span>
<span style="color: #00A000">+int ftmod_ss7_uninhibit_mtp3link(uint32_t id)</span>
{
        SnMngmt cntrl;
        Pst pst;
<span style="color: #800080; font-weight: bold">@@ -283,7 +297,67 @@ int ftmod_ss7_uninhibit_mtplink(uint32_t id)</span>
}
/******************************************************************************/
<span style="color: #A00000">-int ftmod_ss7_activate_mtplink(uint32_t id)</span>
<span style="color: #00A000">+int ftmod_ss7_bind_mtp3link(uint32_t id)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        SnMngmt cntrl;</span>
<span style="color: #00A000">+        Pst pst;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* initalize the post structure */</span>
<span style="color: #00A000">+        smPstInit(&pst);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* insert the destination Entity */</span>
<span style="color: #00A000">+        pst.dstEnt = ENTSN;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* initalize the control structure */</span>
<span style="color: #00A000">+        memset(&cntrl, 0x0, sizeof(SnMngmt));</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* initalize the control header */</span>
<span style="color: #00A000">+        smHdrInit(&cntrl.hdr);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        cntrl.hdr.msgType                        = TCNTRL;        /* this is a control request */</span>
<span style="color: #00A000">+        cntrl.hdr.entId.ent                        = ENTSN;</span>
<span style="color: #00A000">+        cntrl.hdr.entId.inst                = S_INST;</span>
<span style="color: #00A000">+        cntrl.hdr.elmId.elmnt                = STDLSAP;</span>
<span style="color: #00A000">+        cntrl.hdr.elmId.elmntInst1        = g_ftdm_sngss7_data.cfg.mtp3Link[id].id;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        cntrl.t.cntrl.action                = ABND;                /* Activate */</span>
<span style="color: #00A000">+        cntrl.t.cntrl.subAction                = SAELMNT;        /* specificed element */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return (sng_cntrl_mtp3(&pst, &cntrl));</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/******************************************************************************/</span>
<span style="color: #00A000">+int ftmod_ss7_unbind_mtp3link(uint32_t id)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        SnMngmt cntrl;</span>
<span style="color: #00A000">+        Pst pst;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* initalize the post structure */</span>
<span style="color: #00A000">+        smPstInit(&pst);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* insert the destination Entity */</span>
<span style="color: #00A000">+        pst.dstEnt = ENTSN;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* initalize the control structure */</span>
<span style="color: #00A000">+        memset(&cntrl, 0x0, sizeof(SnMngmt));</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* initalize the control header */</span>
<span style="color: #00A000">+        smHdrInit(&cntrl.hdr);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        cntrl.hdr.msgType                        = TCNTRL;        /* this is a control request */</span>
<span style="color: #00A000">+        cntrl.hdr.entId.ent                        = ENTSN;</span>
<span style="color: #00A000">+        cntrl.hdr.entId.inst                = S_INST;</span>
<span style="color: #00A000">+        cntrl.hdr.elmId.elmnt                = STDLSAP;</span>
<span style="color: #00A000">+        cntrl.hdr.elmId.elmntInst1        = g_ftdm_sngss7_data.cfg.mtp3Link[id].id;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        cntrl.t.cntrl.action                = AUBND_DIS;                /* unbind and disable */</span>
<span style="color: #00A000">+        cntrl.t.cntrl.subAction                = SAELMNT;                        /* specificed element */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return (sng_cntrl_mtp3(&pst, &cntrl));</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/******************************************************************************/</span>
<span style="color: #00A000">+int ftmod_ss7_activate_mtp3link(uint32_t id)</span>
{
        SnMngmt cntrl;
        Pst pst;
<span style="color: #800080; font-weight: bold">@@ -304,7 +378,7 @@ int ftmod_ss7_activate_mtplink(uint32_t id)</span>
        cntrl.hdr.entId.ent                        = ENTSN;
        cntrl.hdr.entId.inst                = S_INST;
        cntrl.hdr.elmId.elmnt                = STDLSAP;
<span style="color: #A00000">-        cntrl.hdr.elmId.elmntInst1        = g_ftdm_sngss7_data.cfg.mtpLink[id].id;</span>
<span style="color: #00A000">+        cntrl.hdr.elmId.elmntInst1        = g_ftdm_sngss7_data.cfg.mtp3Link[id].id;</span>
        cntrl.t.cntrl.action                = AENA;                /* Activate */
        cntrl.t.cntrl.subAction                = SAELMNT;        /* specificed element */
<span style="color: #800080; font-weight: bold">@@ -313,7 +387,7 @@ int ftmod_ss7_activate_mtplink(uint32_t id)</span>
}
/******************************************************************************/
<span style="color: #A00000">-int ftmod_ss7_deactivate_mtplink(uint32_t id)</span>
<span style="color: #00A000">+int ftmod_ss7_deactivate_mtp3link(uint32_t id)</span>
{
        SnMngmt cntrl;
        Pst pst;
<span style="color: #800080; font-weight: bold">@@ -334,7 +408,7 @@ int ftmod_ss7_deactivate_mtplink(uint32_t id)</span>
        cntrl.hdr.entId.ent                        = ENTSN;
        cntrl.hdr.entId.inst                = S_INST;
        cntrl.hdr.elmId.elmnt                = STDLSAP;
<span style="color: #A00000">-        cntrl.hdr.elmId.elmntInst1        = g_ftdm_sngss7_data.cfg.mtpLink[id].id;</span>
<span style="color: #00A000">+        cntrl.hdr.elmId.elmntInst1        = g_ftdm_sngss7_data.cfg.mtp3Link[id].id;</span>
        cntrl.t.cntrl.action                = ADISIMM;        /* Deactivate */
        cntrl.t.cntrl.subAction                = SAELMNT;        /* specificed element */
<span style="color: #800080; font-weight: bold">@@ -343,7 +417,7 @@ int ftmod_ss7_deactivate_mtplink(uint32_t id)</span>
}
/******************************************************************************/
<span style="color: #A00000">-int ftmod_ss7_deactivate2_mtplink(uint32_t id)</span>
<span style="color: #00A000">+int ftmod_ss7_deactivate2_mtp3link(uint32_t id)</span>
{
        SnMngmt cntrl;
        Pst pst;
<span style="color: #800080; font-weight: bold">@@ -364,7 +438,7 @@ int ftmod_ss7_deactivate2_mtplink(uint32_t id)</span>
        cntrl.hdr.entId.ent                        = ENTSN;
        cntrl.hdr.entId.inst                = S_INST;
        cntrl.hdr.elmId.elmnt                = STDLSAP;
<span style="color: #A00000">-        cntrl.hdr.elmId.elmntInst1        = g_ftdm_sngss7_data.cfg.mtpLink[id].id;</span>
<span style="color: #00A000">+        cntrl.hdr.elmId.elmntInst1        = g_ftdm_sngss7_data.cfg.mtp3Link[id].id;</span>
        cntrl.t.cntrl.action                = ADISIMM_L2;        /* Deactivate...layer 2 only */
        cntrl.t.cntrl.subAction                = SAELMNT;                /* specificed element */
<span style="color: #800080; font-weight: bold">@@ -463,7 +537,7 @@ int ftmod_ss7_deactivate2_mtplinkSet(uint32_t id)</span>
}
/******************************************************************************/
<span style="color: #A00000">-int ftmod_ss7_lpo_mtplink(uint32_t id)</span>
<span style="color: #00A000">+int ftmod_ss7_lpo_mtp3link(uint32_t id)</span>
{
        SnMngmt cntrl;
        Pst pst;
<span style="color: #800080; font-weight: bold">@@ -484,7 +558,7 @@ int ftmod_ss7_lpo_mtplink(uint32_t id)</span>
        cntrl.hdr.entId.ent                        = ENTSN;
        cntrl.hdr.entId.inst                = S_INST;
        cntrl.hdr.elmId.elmnt                = STDLSAP;
<span style="color: #A00000">-        cntrl.hdr.elmId.elmntInst1        = g_ftdm_sngss7_data.cfg.mtpLink[id].id;</span>
<span style="color: #00A000">+        cntrl.hdr.elmId.elmntInst1        = g_ftdm_sngss7_data.cfg.mtp3Link[id].id;</span>
        cntrl.t.cntrl.action                = ACTION_LPO;        /* Activate */
        cntrl.t.cntrl.subAction                = SAELMNT;                        /* specificed element */
<span style="color: #800080; font-weight: bold">@@ -493,7 +567,7 @@ int ftmod_ss7_lpo_mtplink(uint32_t id)</span>
}
/******************************************************************************/
<span style="color: #A00000">-int ftmod_ss7_lpr_mtplink(uint32_t id)</span>
<span style="color: #00A000">+int ftmod_ss7_lpr_mtp3link(uint32_t id)</span>
{
        SnMngmt cntrl;
        Pst pst;
<span style="color: #800080; font-weight: bold">@@ -514,7 +588,7 @@ int ftmod_ss7_lpr_mtplink(uint32_t id)</span>
        cntrl.hdr.entId.ent                        = ENTSN;
        cntrl.hdr.entId.inst                = S_INST;
        cntrl.hdr.elmId.elmnt                = STDLSAP;
<span style="color: #A00000">-        cntrl.hdr.elmId.elmntInst1        = g_ftdm_sngss7_data.cfg.mtpLink[id].id;</span>
<span style="color: #00A000">+        cntrl.hdr.elmId.elmntInst1        = g_ftdm_sngss7_data.cfg.mtp3Link[id].id;</span>
        cntrl.t.cntrl.action                = ACTION_LPR;        /* Activate */
        cntrl.t.cntrl.subAction                = SAELMNT;                        /* specificed element */
<span style="color: #800080; font-weight: bold">@@ -523,6 +597,216 @@ int ftmod_ss7_lpr_mtplink(uint32_t id)</span>
}
/******************************************************************************/
<span style="color: #00A000">+int ftmod_ss7_shutdown_isup(void)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        SiMngmt cntrl;</span>
<span style="color: #00A000">+        Pst pst;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* initalize the post structure */</span>
<span style="color: #00A000">+        smPstInit(&pst);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* insert the destination Entity */</span>
<span style="color: #00A000">+        pst.dstEnt = ENTSI;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* initalize the control structure */</span>
<span style="color: #00A000">+        memset(&cntrl, 0x0, sizeof(SiMngmt));</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* initalize the control header */</span>
<span style="color: #00A000">+        smHdrInit(&cntrl.hdr);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        cntrl.hdr.msgType                        = TCNTRL;         /* this is a control request */</span>
<span style="color: #00A000">+        cntrl.hdr.entId.ent                        = ENTSI;</span>
<span style="color: #00A000">+        cntrl.hdr.entId.inst                = S_INST;</span>
<span style="color: #00A000">+        cntrl.hdr.elmId.elmnt                = STGEN;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        cntrl.t.cntrl.action                = ASHUTDOWN;        /* shutdown */</span>
<span style="color: #00A000">+        cntrl.t.cntrl.subAction                = SAELMNT;                /* specificed element */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return (sng_cntrl_isup(&pst, &cntrl));</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/******************************************************************************/</span>
<span style="color: #00A000">+int ftmod_ss7_shutdown_mtp3(void)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        SnMngmt cntrl;</span>
<span style="color: #00A000">+        Pst pst;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* initalize the post structure */</span>
<span style="color: #00A000">+        smPstInit(&pst);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* insert the destination Entity */</span>
<span style="color: #00A000">+        pst.dstEnt = ENTSN;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* initalize the control structure */</span>
<span style="color: #00A000">+        memset(&cntrl, 0x0, sizeof(SnMngmt));</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* initalize the control header */</span>
<span style="color: #00A000">+        smHdrInit(&cntrl.hdr);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        cntrl.hdr.msgType                        = TCNTRL;        /* this is a control request */</span>
<span style="color: #00A000">+        cntrl.hdr.entId.ent                        = ENTSN;</span>
<span style="color: #00A000">+        cntrl.hdr.entId.inst                = S_INST;</span>
<span style="color: #00A000">+        cntrl.hdr.elmId.elmnt                = STGEN;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        cntrl.t.cntrl.action                = ASHUTDOWN;        /* Activate */</span>
<span style="color: #00A000">+        cntrl.t.cntrl.subAction                = SAELMNT;                        /* specificed element */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return (sng_cntrl_mtp3(&pst, &cntrl));</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/******************************************************************************/</span>
<span style="color: #00A000">+int ftmod_ss7_shutdown_mtp2(void)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        SdMngmt cntrl;</span>
<span style="color: #00A000">+        Pst pst;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* initalize the post structure */</span>
<span style="color: #00A000">+        smPstInit(&pst);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* insert the destination Entity */</span>
<span style="color: #00A000">+        pst.dstEnt = ENTSD;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* initalize the control structure */</span>
<span style="color: #00A000">+        memset(&cntrl, 0x0, sizeof(SdMngmt));</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* initalize the control header */</span>
<span style="color: #00A000">+        smHdrInit(&cntrl.hdr);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        cntrl.hdr.msgType                        = TCNTRL;        /* this is a control request */</span>
<span style="color: #00A000">+        cntrl.hdr.entId.ent                        = ENTSD;</span>
<span style="color: #00A000">+        cntrl.hdr.entId.inst                = S_INST;</span>
<span style="color: #00A000">+        cntrl.hdr.elmId.elmnt                = STGEN;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        cntrl.t.cntrl.action                = ASHUTDOWN;        /* Activate */</span>
<span style="color: #00A000">+        cntrl.t.cntrl.subAction                = SAELMNT;                        /* specificed element */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return (sng_cntrl_mtp2(&pst, &cntrl));</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/******************************************************************************/</span>
<span style="color: #00A000">+int ftmod_ss7_shutdown_relay(void)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        RyMngmt cntrl;</span>
<span style="color: #00A000">+        Pst pst;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* initalize the post structure */</span>
<span style="color: #00A000">+        smPstInit(&pst);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* insert the destination Entity */</span>
<span style="color: #00A000">+        pst.dstEnt = ENTRY;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* initalize the control structure */</span>
<span style="color: #00A000">+        memset(&cntrl, 0x0, sizeof(RyMngmt));</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* initalize the control header */</span>
<span style="color: #00A000">+        smHdrInit(&cntrl.hdr);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        cntrl.hdr.msgType                        = TCNTRL;        /* this is a control request */</span>
<span style="color: #00A000">+        cntrl.hdr.entId.ent                        = ENTRY;</span>
<span style="color: #00A000">+        cntrl.hdr.entId.inst                = S_INST;</span>
<span style="color: #00A000">+        cntrl.hdr.elmId.elmnt                = STGEN;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        cntrl.t.cntrl.action                = ASHUTDOWN;        /* Activate */</span>
<span style="color: #00A000">+        cntrl.t.cntrl.subAction                = SAELMNT;                        /* specificed element */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return (sng_cntrl_relay(&pst, &cntrl));</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/******************************************************************************/</span>
<span style="color: #00A000">+int ftmod_ss7_disable_grp_mtp3Link(uint32_t procId)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        SnMngmt cntrl;</span>
<span style="color: #00A000">+        Pst pst;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* initalize the post structure */</span>
<span style="color: #00A000">+        smPstInit(&pst);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* insert the destination Entity */</span>
<span style="color: #00A000">+        pst.dstEnt = ENTSN;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* initalize the control structure */</span>
<span style="color: #00A000">+        memset(&cntrl, 0x0, sizeof(SnMngmt));</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* initalize the control header */</span>
<span style="color: #00A000">+        smHdrInit(&cntrl.hdr);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        cntrl.hdr.msgType                        = TCNTRL;                        /* this is a control request */</span>
<span style="color: #00A000">+        cntrl.hdr.entId.ent                        = ENTSN;</span>
<span style="color: #00A000">+        cntrl.hdr.entId.inst                = S_INST;</span>
<span style="color: #00A000">+        cntrl.hdr.elmId.elmnt                = STGRDLSAP;                /* group DLSAP */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        cntrl.t.cntrl.ctlType.groupKey.dstProcId = procId;        /* all SAPS to this ProcId */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        cntrl.t.cntrl.action                = AUBND_DIS;                /* disable and unbind */</span>
<span style="color: #00A000">+        cntrl.t.cntrl.subAction                = SAGR_DSTPROCID;                        /* specificed element */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return (sng_cntrl_mtp3(&pst, &cntrl));</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/******************************************************************************/</span>
<span style="color: #00A000">+int ftmod_ss7_enable_grp_mtp3Link(uint32_t procId)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        SnMngmt cntrl;</span>
<span style="color: #00A000">+        Pst pst;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* initalize the post structure */</span>
<span style="color: #00A000">+        smPstInit(&pst);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* insert the destination Entity */</span>
<span style="color: #00A000">+        pst.dstEnt = ENTSN;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* initalize the control structure */</span>
<span style="color: #00A000">+        memset(&cntrl, 0x0, sizeof(SnMngmt));</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* initalize the control header */</span>
<span style="color: #00A000">+        smHdrInit(&cntrl.hdr);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        cntrl.hdr.msgType                        = TCNTRL;                        /* this is a control request */</span>
<span style="color: #00A000">+        cntrl.hdr.entId.ent                        = ENTSN;</span>
<span style="color: #00A000">+        cntrl.hdr.entId.inst                = S_INST;</span>
<span style="color: #00A000">+        cntrl.hdr.elmId.elmnt                = STGRDLSAP;                /* group DLSAP */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        cntrl.t.cntrl.ctlType.groupKey.dstProcId = procId;        /* all SAPS to this ProcId */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        cntrl.t.cntrl.action                = ABND_ENA;                        /* bind and enable */</span>
<span style="color: #00A000">+        cntrl.t.cntrl.subAction                = SAGR_DSTPROCID;                        /* specificed element */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return (sng_cntrl_mtp3(&pst, &cntrl));</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/******************************************************************************/</span>
<span style="color: #00A000">+int ftmod_ss7_disable_grp_mtp2Link(uint32_t procId)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        SdMngmt cntrl;</span>
<span style="color: #00A000">+        Pst pst;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* initalize the post structure */</span>
<span style="color: #00A000">+        smPstInit(&pst);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* insert the destination Entity */</span>
<span style="color: #00A000">+        pst.dstEnt = ENTSD;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* initalize the control structure */</span>
<span style="color: #00A000">+        memset(&cntrl, 0x0, sizeof(cntrl));</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* initalize the control header */</span>
<span style="color: #00A000">+        smHdrInit(&cntrl.hdr);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        cntrl.hdr.msgType                        = TCNTRL;                        /* this is a control request */</span>
<span style="color: #00A000">+        cntrl.hdr.entId.ent                        = ENTSD;</span>
<span style="color: #00A000">+        cntrl.hdr.entId.inst                = S_INST;</span>
<span style="color: #00A000">+        cntrl.hdr.elmId.elmnt                = STGRNSAP;                        /* group NSAP */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        cntrl.t.cntrl.par.dstProcId = procId;                        /* all SAPS to this ProcId */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        cntrl.t.cntrl.action                = AUBND_DIS;                /* disable and unbind */</span>
<span style="color: #00A000">+        cntrl.t.cntrl.subAction                = SAGR_DSTPROCID;                        /* specificed element */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return (sng_cntrl_mtp2(&pst, &cntrl));</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+}</span>
/******************************************************************************/
/* For Emacs:
<span style="color: #000080; font-weight: bold">diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c</span>
<span style="color: #000080; font-weight: bold">index dcfb7f7..3a6fca7 100644</span>
<span style="color: #A00000">--- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c</span>
<span style="color: #00A000">+++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c</span>
<span style="color: #800080; font-weight: bold">@@ -99,21 +99,21 @@ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ</span>
        /* lock the channel */
        ftdm_mutex_lock(ftdmchan->mutex);
<span style="color: #A00000">-        if (sngss7_test_flag(sngss7_info, FLAG_GLARE)) {</span>
<span style="color: #00A000">+        if (sngss7_test_ckt_flag(sngss7_info, FLAG_GLARE)) {</span>
                SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx IAM (glare)\n", sngss7_info->circuit->cic);
        } else {
                SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx IAM\n", sngss7_info->circuit->cic);
        }
        /* check if the circuit has a remote block */
<span style="color: #A00000">-        if ((sngss7_test_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX)) ||</span>
<span style="color: #A00000">-                (sngss7_test_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX)) ||</span>
<span style="color: #A00000">-                (sngss7_test_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX))) {</span>
<span style="color: #00A000">+        if ((sngss7_test_ckt_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX)) ||</span>
<span style="color: #00A000">+                (sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX)) ||</span>
<span style="color: #00A000">+                (sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX))) {</span>
                /* as per Q.764, 2.8.2.3 xiv ... remove the block from this channel */
<span style="color: #A00000">-                sngss7_clear_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX);</span>
<span style="color: #A00000">-                sngss7_clear_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX);</span>
<span style="color: #A00000">-                sngss7_clear_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX);</span>
<span style="color: #00A000">+                sngss7_clear_ckt_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX);</span>
<span style="color: #00A000">+                sngss7_clear_ckt_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX);</span>
<span style="color: #00A000">+                sngss7_clear_ckt_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX);</span>
                /* KONRAD FIX ME : check in case there is a ckt and grp block */
        }
<span style="color: #800080; font-weight: bold">@@ -134,7 +134,7 @@ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ</span>
                                                ftdmchan->physical_chan_id);
                         /* set the flag to indicate this hangup is started from the local side */
<span style="color: #A00000">-                        sngss7_set_flag(sngss7_info, FLAG_LOCAL_REL);</span>
<span style="color: #00A000">+                        sngss7_set_ckt_flag(sngss7_info, FLAG_LOCAL_REL);</span>
                        ftdmchan->caller_data.hangup_cause = 41;
<span style="color: #800080; font-weight: bold">@@ -253,26 +253,26 @@ handle_glare:</span>
                sngss7_info->glare.circuit = circuit;
                memcpy(&sngss7_info->glare.iam, siConEvnt, sizeof(*siConEvnt));
<span style="color: #A00000">-                if (!(sngss7_test_flag(sngss7_info, FLAG_GLARE))) {</span>
<span style="color: #00A000">+                if (!(sngss7_test_ckt_flag(sngss7_info, FLAG_GLARE))) {</span>
                        /* glare, throw the flag */
<span style="color: #A00000">-                        sngss7_set_flag(sngss7_info, FLAG_GLARE);</span>
<span style="color: #00A000">+                        sngss7_set_ckt_flag(sngss7_info, FLAG_GLARE);</span>
                
                        /* setup the hangup cause */
                        ftdmchan->caller_data.hangup_cause = 34;        /* Circuit Congrestion */
                
                        /* this is a remote hangup request */
<span style="color: #A00000">-                        sngss7_set_flag(sngss7_info, FLAG_REMOTE_REL);</span>
<span style="color: #00A000">+                        sngss7_set_ckt_flag(sngss7_info, FLAG_REMOTE_REL);</span>
                
                        /* move the state of the channel to Terminating to end the call */
                        ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING);
<span style="color: #A00000">-                } /* if (!(sngss7_test_flag(sngss7_info, FLAG_GLARE))) */</span>
<span style="color: #00A000">+                } /* if (!(sngss7_test_ckt_flag(sngss7_info, FLAG_GLARE))) */</span>
                break;
        /**************************************************************************/
        default:        /* should not have gotten an IAM while in this state */
                SS7_ERROR_CHAN(ftdmchan, "Got IAM on channel in invalid state(%s)...reset!\n", ftdm_channel_state2str (ftdmchan->state));
                /* reset the cic */
<span style="color: #A00000">-                sngss7_set_flag(sngss7_info, FLAG_RESET_TX);</span>
<span style="color: #00A000">+                sngss7_set_ckt_flag(sngss7_info, FLAG_RESET_TX);</span>
                /* move the state of the channel to RESTART to force a reset */
                ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
<span style="color: #800080; font-weight: bold">@@ -341,7 +341,7 @@ ftdm_status_t handle_con_sta(uint32_t suInstId, uint32_t spInstId, uint32_t circ</span>
                                                                        ftdm_channel_state2str (ftdmchan->state));
                        /* reset the cic */
<span style="color: #A00000">-                        sngss7_set_flag(sngss7_info, FLAG_RESET_TX);</span>
<span style="color: #00A000">+                        sngss7_set_ckt_flag(sngss7_info, FLAG_RESET_TX);</span>
                        /* go to RESTART */
                        ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
<span style="color: #800080; font-weight: bold">@@ -545,7 +545,7 @@ ftdm_status_t handle_con_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circ</span>
                SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx ANM/CON\n", sngss7_info->circuit->cic);
                /* throw the TX reset flag */
<span style="color: #A00000">-                sngss7_set_flag(sngss7_info, FLAG_GRP_RESET_TX);</span>
<span style="color: #00A000">+                sngss7_set_ckt_flag(sngss7_info, FLAG_GRP_RESET_TX);</span>
                /* go to RESTART */
                ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
<span style="color: #800080; font-weight: bold">@@ -597,7 +597,7 @@ ftdm_status_t handle_rel_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ</span>
                }
                /* this is a remote hangup request */
<span style="color: #A00000">-                sngss7_set_flag(sngss7_info, FLAG_REMOTE_REL);</span>
<span style="color: #00A000">+                sngss7_set_ckt_flag(sngss7_info, FLAG_REMOTE_REL);</span>
ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_LOOP, NULL);
                /* move the state of the channel to CANCEL to end the call */
                ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING);
<span style="color: #800080; font-weight: bold">@@ -618,7 +618,7 @@ ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_LOOP, NULL);</span>
                }
                /* this is a remote hangup request */
<span style="color: #A00000">-                sngss7_set_flag(sngss7_info, FLAG_REMOTE_REL);</span>
<span style="color: #00A000">+                sngss7_set_ckt_flag(sngss7_info, FLAG_REMOTE_REL);</span>
                /* move the state of the channel to TERMINATING to end the call */
                ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING);
<span style="color: #800080; font-weight: bold">@@ -631,7 +631,7 @@ ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_LOOP, NULL);</span>
                ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_LOOP, NULL);
                /* since we need to acknowledge the hang up set the flag for remote release */
<span style="color: #A00000">-                sngss7_set_flag(sngss7_info, FLAG_REMOTE_REL);</span>
<span style="color: #00A000">+                sngss7_set_ckt_flag(sngss7_info, FLAG_REMOTE_REL);</span>
                /* go to hangup complete to send the RLC */
                ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE);
<span style="color: #800080; font-weight: bold">@@ -645,7 +645,7 @@ ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_LOOP, NULL);</span>
        default:
                /* throw the reset flag */
<span style="color: #A00000">-                sngss7_set_flag(sngss7_info, FLAG_RESET_RX);</span>
<span style="color: #00A000">+                sngss7_set_ckt_flag(sngss7_info, FLAG_RESET_RX);</span>
                /* set the state to RESTART */
                ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
<span style="color: #800080; font-weight: bold">@@ -1134,13 +1134,13 @@ ftdm_status_t handle_reattempt(uint32_t suInstId, uint32_t spInstId, uint32_t ci</span>
        /* lock the channel */
        ftdm_mutex_lock(ftdmchan->mutex);
<span style="color: #A00000">-        if (sngss7_test_flag(sngss7_info, FLAG_GLARE)) {</span>
<span style="color: #00A000">+        if (sngss7_test_ckt_flag(sngss7_info, FLAG_GLARE)) {</span>
                /* the glare flag is already up so it was caught ... do nothing */
                SS7_DEBUG_CHAN(ftdmchan, "Glare flag is already up...nothing to do!%s\n", " ");
        } else {
                SS7_DEBUG_CHAN(ftdmchan, "Glare flag is not up yet...indicating glare from reattempt!%s\n", " ");
                /* glare, throw the flag */
<span style="color: #A00000">-                sngss7_set_flag(sngss7_info, FLAG_GLARE);</span>
<span style="color: #00A000">+                sngss7_set_ckt_flag(sngss7_info, FLAG_GLARE);</span>
                /* clear any existing glare data from the channel */
                memset(&sngss7_info->glare, 0x0, sizeof(sngss7_glare_data_t));
<span style="color: #800080; font-weight: bold">@@ -1149,7 +1149,7 @@ ftdm_status_t handle_reattempt(uint32_t suInstId, uint32_t spInstId, uint32_t ci</span>
                ftdmchan->caller_data.hangup_cause = 34;        /* Circuit Congrestion */
                /* this is a remote hangup request */
<span style="color: #A00000">-                sngss7_set_flag(sngss7_info, FLAG_REMOTE_REL);</span>
<span style="color: #00A000">+                sngss7_set_ckt_flag(sngss7_info, FLAG_REMOTE_REL);</span>
                /* move the state of the channel to Terminating to end the call */
                ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING);
<span style="color: #800080; font-weight: bold">@@ -1179,7 +1179,7 @@ ftdm_status_t handle_pause(uint32_t suInstId, uint32_t spInstId, uint32_t circui</span>
        sngss7_set_flag(&g_ftdm_sngss7_data.cfg.isupIntf[infId], SNGSS7_PAUSED);
        
        /* go through all the circuits now and find any other circuits on this infId */
<span style="color: #A00000">-        i = 1;</span>
<span style="color: #00A000">+        i = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1;</span>
        while (g_ftdm_sngss7_data.cfg.isupCkt[i].id != 0) {
                
                /* check that the infId matches and that this is not a siglink */
<span style="color: #800080; font-weight: bold">@@ -1200,7 +1200,7 @@ ftdm_status_t handle_pause(uint32_t suInstId, uint32_t spInstId, uint32_t circui</span>
                        if (ftdm_test_flag(ftdmchan->span, FTDM_SPAN_IN_THREAD)) {
                                SS7_DEBUG_CHAN(ftdmchan, "Rx PAUSE%s\n", "");
                                /* set the pause flag on the channel */
<span style="color: #A00000">-                                sngss7_set_flag(sngss7_info, FLAG_INFID_PAUSED);</span>
<span style="color: #00A000">+                                sngss7_set_ckt_flag(sngss7_info, FLAG_INFID_PAUSED);</span>
                        }
        
                        /* unlock the channel again before we exit */
<span style="color: #800080; font-weight: bold">@@ -1234,7 +1234,7 @@ ftdm_status_t handle_resume(uint32_t suInstId, uint32_t spInstId, uint32_t circu</span>
        sngss7_clear_flag(&g_ftdm_sngss7_data.cfg.isupIntf[infId], SNGSS7_PAUSED);
        /* go through all the circuits now and find any other circuits on this infId */
<span style="color: #A00000">-        i = 1;</span>
<span style="color: #00A000">+        i = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1;</span>
        while (g_ftdm_sngss7_data.cfg.isupCkt[i].id != 0) {
                /* check that the infId matches and that this is not a siglink */
<span style="color: #800080; font-weight: bold">@@ -1252,14 +1252,14 @@ ftdm_status_t handle_resume(uint32_t suInstId, uint32_t spInstId, uint32_t circu</span>
                        ftdm_mutex_lock(ftdmchan->mutex);
                        /* only resume if we are paused */
<span style="color: #A00000">-                        if (sngss7_test_flag(sngss7_info, FLAG_INFID_PAUSED)) {</span>
<span style="color: #00A000">+                        if (sngss7_test_ckt_flag(sngss7_info, FLAG_INFID_PAUSED)) {</span>
                                SS7_DEBUG_CHAN(ftdmchan, "Rx RESUME%s\n", "");
                                /* set the resume flag on the channel */
<span style="color: #A00000">-                                sngss7_set_flag(sngss7_info, FLAG_INFID_RESUME);</span>
<span style="color: #00A000">+                                sngss7_set_ckt_flag(sngss7_info, FLAG_INFID_RESUME);</span>
                                /* clear the paused flag */
<span style="color: #A00000">-                                sngss7_clear_flag(sngss7_info, FLAG_INFID_PAUSED);</span>
<span style="color: #00A000">+                                sngss7_clear_ckt_flag(sngss7_info, FLAG_INFID_PAUSED);</span>
                        }
                        
                        /* unlock the channel again before we exit */
<span style="color: #800080; font-weight: bold">@@ -1421,12 +1421,12 @@ ftdm_status_t handle_blo_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ</span>
        ftdm_mutex_lock(ftdmchan->mutex);
        /* check if the circuit is already blocked or not */
<span style="color: #A00000">-        if (sngss7_test_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX)) {</span>
<span style="color: #00A000">+        if (sngss7_test_ckt_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX)) {</span>
                SS7_WARN("Received BLO on circuit that is already blocked!\n");
        }
        /* throw the ckt block flag */
<span style="color: #A00000">-        sngss7_set_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX);</span>
<span style="color: #00A000">+        sngss7_set_ckt_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX);</span>
        /* set the channel to suspended state */
        ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
<span style="color: #800080; font-weight: bold">@@ -1484,15 +1484,15 @@ ftdm_status_t handle_ubl_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ</span>
        ftdm_mutex_lock(ftdmchan->mutex);
        /* check if the channel is blocked */
<span style="color: #A00000">-        if (!(sngss7_test_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX))) {</span>
<span style="color: #00A000">+        if (!(sngss7_test_ckt_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX))) {</span>
                SS7_WARN("Received UBL on circuit that is not blocked!\n");
        }
        /* throw the unblock flag */
<span style="color: #A00000">-        sngss7_set_flag(sngss7_info, FLAG_CKT_MN_UNBLK_RX);</span>
<span style="color: #00A000">+        sngss7_set_ckt_flag(sngss7_info, FLAG_CKT_MN_UNBLK_RX);</span>
        /* clear the block flag */
<span style="color: #A00000">-        sngss7_clear_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX);</span>
<span style="color: #00A000">+        sngss7_clear_ckt_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX);</span>
        /* set the channel to suspended state */
        ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
<span style="color: #800080; font-weight: bold">@@ -1550,7 +1550,7 @@ ftdm_status_t handle_rsc_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ</span>
        ftdm_mutex_lock(ftdmchan->mutex);
        /* throw the reset flag */
<span style="color: #A00000">-        sngss7_set_flag(sngss7_info, FLAG_RESET_RX);</span>
<span style="color: #00A000">+        sngss7_set_ckt_flag(sngss7_info, FLAG_RESET_RX);</span>
        switch (ftdmchan->state) {
        /**************************************************************************/
<span style="color: #800080; font-weight: bold">@@ -1595,7 +1595,7 @@ ftdm_status_t handle_local_rsc_req(uint32_t suInstId, uint32_t spInstId, uint32_</span>
        ftdm_mutex_lock(ftdmchan->mutex);
        /* throw the reset flag */
<span style="color: #A00000">-        sngss7_set_flag(sngss7_info, FLAG_RESET_RX);</span>
<span style="color: #00A000">+        sngss7_set_ckt_flag(sngss7_info, FLAG_RESET_RX);</span>
        switch (ftdmchan->state) {
        /**************************************************************************/
<span style="color: #800080; font-weight: bold">@@ -1643,9 +1643,9 @@ ftdm_status_t handle_rsc_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circ</span>
        /**********************************************************************/
        case FTDM_CHANNEL_STATE_RESTART:
                
<span style="color: #A00000">-                if ( sngss7_test_flag(sngss7_info, FLAG_RESET_TX) ) {</span>
<span style="color: #00A000">+                if ( sngss7_test_ckt_flag(sngss7_info, FLAG_RESET_TX) ) {</span>
                        /* throw the FLAG_RESET_TX_RSP to indicate we have acknowledgement from the remote side */
<span style="color: #A00000">-                        sngss7_set_flag(sngss7_info, FLAG_RESET_TX_RSP);</span>
<span style="color: #00A000">+                        sngss7_set_ckt_flag(sngss7_info, FLAG_RESET_TX_RSP);</span>
                        /* go to DOWN */
                        ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN);
<span style="color: #800080; font-weight: bold">@@ -1667,7 +1667,7 @@ ftdm_status_t handle_rsc_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circ</span>
        case FTDM_CHANNEL_STATE_HANGUP_COMPLETE:
                
                /* throw the FLAG_RESET_TX_RSP to indicate we have acknowledgement from the remote side */
<span style="color: #A00000">-                sngss7_set_flag(sngss7_info, FLAG_RESET_TX_RSP);</span>
<span style="color: #00A000">+                sngss7_set_ckt_flag(sngss7_info, FLAG_RESET_TX_RSP);</span>
                /* go to DOWN */
                /*ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN);*/
<span style="color: #800080; font-weight: bold">@@ -1795,12 +1795,12 @@ ftdm_status_t handle_local_blk(uint32_t suInstId, uint32_t spInstId, uint32_t ci</span>
        ftdm_mutex_lock(ftdmchan->mutex);
        /* check if the circuit is already blocked or not */
<span style="color: #A00000">-        if (sngss7_test_flag(sngss7_info, FLAG_CKT_LC_BLOCK_RX)) {</span>
<span style="color: #00A000">+        if (sngss7_test_ckt_flag(sngss7_info, FLAG_CKT_LC_BLOCK_RX)) {</span>
                SS7_WARN("Received local BLO on circuit that is already blocked!\n");
        }
        /* throw the ckt block flag */
<span style="color: #A00000">-        sngss7_set_flag(sngss7_info, FLAG_CKT_LC_BLOCK_RX);</span>
<span style="color: #00A000">+        sngss7_set_ckt_flag(sngss7_info, FLAG_CKT_LC_BLOCK_RX);</span>
        /* set the channel to suspended state */
        ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
<span style="color: #800080; font-weight: bold">@@ -1831,12 +1831,12 @@ ftdm_status_t handle_local_ubl(uint32_t suInstId, uint32_t spInstId, uint32_t ci</span>
        ftdm_mutex_lock(ftdmchan->mutex);
        /* check if the circuit is already blocked or not */
<span style="color: #A00000">-        if (sngss7_test_flag(sngss7_info, FLAG_CKT_LC_UNBLK_RX)) {</span>
<span style="color: #00A000">+        if (sngss7_test_ckt_flag(sngss7_info, FLAG_CKT_LC_UNBLK_RX)) {</span>
                SS7_WARN("Received local UBL on circuit that is already unblocked!\n");
        }
        /* throw the ckt block flag */
<span style="color: #A00000">-        sngss7_set_flag(sngss7_info, FLAG_CKT_LC_UNBLK_RX);</span>
<span style="color: #00A000">+        sngss7_set_ckt_flag(sngss7_info, FLAG_CKT_LC_UNBLK_RX);</span>
        /* set the channel to suspended state */
        ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
<span style="color: #800080; font-weight: bold">@@ -1878,7 +1878,7 @@ ftdm_status_t handle_ucic(uint32_t suInstId, uint32_t spInstId, uint32_t circuit</span>
        ftdm_mutex_lock(ftdmchan->mutex);
        /* throw the ckt block flag */
<span style="color: #A00000">-        sngss7_set_flag(sngss7_info, FLAG_CKT_UCIC_BLOCK);</span>
<span style="color: #00A000">+        sngss7_set_ckt_flag(sngss7_info, FLAG_CKT_UCIC_BLOCK);</span>
        /* set the channel to suspended state */
        ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
<span style="color: #800080; font-weight: bold">@@ -1982,11 +1982,11 @@ ftdm_status_t handle_cgb_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ</span>
                        switch (blockType) {
                        /**********************************************************************/
                        case 0:        /* maintenance oriented */
<span style="color: #A00000">-                                sngss7_set_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX);</span>
<span style="color: #00A000">+                                sngss7_set_ckt_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX);</span>
                                break;
                        /**********************************************************************/
                        case 1: /* hardware failure oriented */
<span style="color: #A00000">-                                sngss7_set_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX);</span>
<span style="color: #00A000">+                                sngss7_set_ckt_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX);</span>
                                break;
                        /**********************************************************************/
                        case 2: /* reserved for national use */
<span style="color: #800080; font-weight: bold">@@ -2113,11 +2113,11 @@ ftdm_status_t handle_cgu_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ</span>
                        switch (blockType) {
                        /**********************************************************************/
                        case 0:        /* maintenance oriented */
<span style="color: #A00000">-                                sngss7_clear_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX);</span>
<span style="color: #00A000">+                                sngss7_clear_ckt_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX);</span>
                                break;
                        /**********************************************************************/
                        case 1: /* hardware failure oriented */
<span style="color: #A00000">-                                sngss7_clear_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX);</span>
<span style="color: #00A000">+                                sngss7_clear_ckt_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX);</span>
                                break;
                        /**********************************************************************/
                        case 2: /* reserved for national use */
<span style="color: #000080; font-weight: bold">diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_in.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_in.c</span>
<span style="color: #000080; font-weight: bold">index 72bd1c3..76984b9 100644</span>
<span style="color: #A00000">--- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_in.c</span>
<span style="color: #00A000">+++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_in.c</span>
<span style="color: #800080; font-weight: bold">@@ -409,13 +409,80 @@ void sngss7_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint</span>
        sngss7_chan_data_t        *sngss7_info = NULL;
        ftdm_channel_t                *ftdmchan = NULL;
        sngss7_event_data_t        *sngss7_event = NULL;
<span style="color: #A00000">-</span>
<span style="color: #A00000">-        /* get the ftdmchan and ss7_chan_data from the circuit */</span>
<span style="color: #A00000">-        if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) {</span>
<span style="color: #A00000">-                SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit);</span>
<span style="color: #A00000">-                SS7_FUNC_TRACE_EXIT(__FUNCTION__);</span>
<span style="color: #A00000">-                return;</span>
<span style="color: #A00000">-        }</span>
<span style="color: #00A000">+        uint32_t                        intfId;</span>
<span style="color: #00A000">+        int                                 x;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* check if the eventType is a pause/resume */</span>
<span style="color: #00A000">+        switch (evntType) {</span>
<span style="color: #00A000">+        /**************************************************************************/</span>
<span style="color: #00A000">+        case (SIT_STA_PAUSEIND):</span>
<span style="color: #00A000">+        case (SIT_STA_RESUMEIND):</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                /* the circuit for this type of event may not exist on the local system</span>
<span style="color: #00A000">+                 * so first check if the circuit is local</span>
<span style="color: #00A000">+                 */</span>
<span style="color: #00A000">+                if ((circuit >= (g_ftdm_sngss7_data.cfg.procId * 1000)) &&</span>
<span style="color: #00A000">+                        (circuit < ((g_ftdm_sngss7_data.cfg.procId +1) * 1000))) {</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                        /* the circuit is on the local system, handle normally */</span>
<span style="color: #00A000">+                        goto sta_ind_local;</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                /* the circuit is not local, so find a local circuit with the same intfId</span>
<span style="color: #00A000">+                 * by finding the orginial circuit in our array first, finding the intfId </span>
<span style="color: #00A000">+                 * from there, then go through the local circuits to see if we find a </span>
<span style="color: #00A000">+                 * match and use that circuit instead</span>
<span style="color: #00A000">+                 */</span>
<span style="color: #00A000">+                intfId = g_ftdm_sngss7_data.cfg.isupCkt[circuit].infId;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1;</span>
<span style="color: #00A000">+                while ((g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) &&</span>
<span style="color: #00A000">+                         (g_ftdm_sngss7_data.cfg.isupCkt[x].id < ((g_ftdm_sngss7_data.cfg.procId +1) * 1000))) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        /* confirm this is a voice channel and not a gap/sig (no ftdmchan there) */</span>
<span style="color: #00A000">+                        if (g_ftdm_sngss7_data.cfg.isupCkt[x].type != VOICE) goto move_along;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                        /* compare the intfIds */</span>
<span style="color: #00A000">+                        if (g_ftdm_sngss7_data.cfg.isupCkt[x].infId == intfId) {</span>
<span style="color: #00A000">+                                /* we have a match, setup the pointers to the correct values */</span>
<span style="color: #00A000">+                                circuit = x;</span>
<span style="color: #00A000">+                                </span>
<span style="color: #00A000">+                                if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) {</span>
<span style="color: #00A000">+                                        SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit);</span>
<span style="color: #00A000">+                                        SS7_FUNC_TRACE_EXIT(__FUNCTION__);</span>
<span style="color: #00A000">+                                        return;</span>
<span style="color: #00A000">+                                }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                                /* bounce out of the loop */</span>
<span style="color: #00A000">+                                break;</span>
<span style="color: #00A000">+                        } /* if (g_ftdm_sngss7_data.cfg.isupCkt[x].intfId == intfId) */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+move_along:</span>
<span style="color: #00A000">+                        /* move along ... nothing to see here */</span>
<span style="color: #00A000">+                        x++;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                /* check if we found any circuits that are on the intfId, drop the message</span>
<span style="color: #00A000">+                 * if none are found</span>
<span style="color: #00A000">+                 */</span>
<span style="color: #00A000">+                if (ftdmchan == NULL) goto sta_ind_end;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                break;</span>
<span style="color: #00A000">+        /**************************************************************************/</span>
<span style="color: #00A000">+        default:</span>
<span style="color: #00A000">+sta_ind_local:</span>
<span style="color: #00A000">+                /* get the ftdmchan and ss7_chan_data from the circuit */</span>
<span style="color: #00A000">+                if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) {</span>
<span style="color: #00A000">+                        SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit);</span>
<span style="color: #00A000">+                        SS7_FUNC_TRACE_EXIT(__FUNCTION__);</span>
<span style="color: #00A000">+                        return;</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+                </span>
<span style="color: #00A000">+                break;</span>
<span style="color: #00A000">+        /**************************************************************************/</span>
<span style="color: #00A000">+        } /* switch (evntType) */</span>
        /* initalize the sngss7_event */
        sngss7_event = ftdm_malloc(sizeof(*sngss7_event));
<span style="color: #800080; font-weight: bold">@@ -440,6 +507,7 @@ void sngss7_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint</span>
        /* enqueue this event */
        ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->signal_data)->event_queue, sngss7_event);
<span style="color: #00A000">+sta_ind_end:</span>
        SS7_FUNC_TRACE_EXIT(__FUNCTION__);
}
<span style="color: #000080; font-weight: bold">diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c</span>
<span style="color: #000080; font-weight: bold">index 3f507d6..1dfcab4 100644</span>
<span style="color: #A00000">--- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c</span>
<span style="color: #00A000">+++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c</span>
<span style="color: #800080; font-weight: bold">@@ -48,6 +48,8 @@ void handle_sng_mtp2_alarm(Pst *pst, SdMngmt *sta);</span>
void handle_sng_mtp3_alarm(Pst *pst, SnMngmt *sta);
void handle_sng_isup_alarm(Pst *pst, SiMngmt *sta);
void handle_sng_cc_alarm(Pst *pst, CcMngmt *sta);
<span style="color: #00A000">+void handle_sng_relay_alarm(Pst *pst, RyMngmt *sta);</span>
<span style="color: #00A000">+</span>
/******************************************************************************/
/* FUNCTIONS ******************************************************************/
<span style="color: #800080; font-weight: bold">@@ -132,17 +134,17 @@ void handle_sng_mtp2_alarm(Pst *pst, SdMngmt *sta)</span>
                        /* find the name for the sap in question */
                        x = 1;
<span style="color: #A00000">-                        while (g_ftdm_sngss7_data.cfg.mtpLink[x].id != 0) {</span>
<span style="color: #A00000">-                                if (g_ftdm_sngss7_data.cfg.mtpLink[x].id == sta->t.usta.evntParm[0]) {</span>
<span style="color: #00A000">+                        while (g_ftdm_sngss7_data.cfg.mtp2Link[x].id != 0) {</span>
<span style="color: #00A000">+                                if (g_ftdm_sngss7_data.cfg.mtp2Link[x].id == sta->t.usta.evntParm[0]) {</span>
                                        break;
                                }
                                x++;
                        }
<span style="color: #A00000">-                        if (g_ftdm_sngss7_data.cfg.mtpLink[x].id == 0) {</span>
<span style="color: #00A000">+                        if (g_ftdm_sngss7_data.cfg.mtp2Link[x].id == 0) {</span>
                                sprintf(buf, "[SAPID:%d]", sta->t.usta.evntParm[0]);
                        } else {
<span style="color: #A00000">-                                sprintf(buf, "[%s]", g_ftdm_sngss7_data.cfg.mtpLink[x].name);</span>
<span style="color: #00A000">+                                sprintf(buf, "[%s]", g_ftdm_sngss7_data.cfg.mtp2Link[x].name);</span>
                        }
                                        
<span style="color: #800080; font-weight: bold">@@ -173,17 +175,17 @@ void handle_sng_mtp2_alarm(Pst *pst, SdMngmt *sta)</span>
                        
                        /* find the name for the sap in question */
                        x = 1;
<span style="color: #A00000">-                        while (g_ftdm_sngss7_data.cfg.mtpLink[x].id != 0) {</span>
<span style="color: #A00000">-                                if (g_ftdm_sngss7_data.cfg.mtpLink[x].id == sta->t.usta.evntParm[0]) {</span>
<span style="color: #00A000">+                        while (g_ftdm_sngss7_data.cfg.mtp2Link[x].id != 0) {</span>
<span style="color: #00A000">+                                if (g_ftdm_sngss7_data.cfg.mtp2Link[x].id == sta->t.usta.evntParm[0]) {</span>
                                        break;
                                }
                                x++;
                        }
<span style="color: #A00000">-                        if (g_ftdm_sngss7_data.cfg.mtpLink[x].id == 0) {</span>
<span style="color: #00A000">+                        if (g_ftdm_sngss7_data.cfg.mtp2Link[x].id == 0) {</span>
                                sprintf(buf, "[SAPID:%d]", sta->t.usta.evntParm[0]);
                        } else {
<span style="color: #A00000">-                                sprintf(buf, "[%s]", g_ftdm_sngss7_data.cfg.mtpLink[x].name);</span>
<span style="color: #00A000">+                                sprintf(buf, "[%s]", g_ftdm_sngss7_data.cfg.mtp2Link[x].name);</span>
                        }
                        ftdm_log(FTDM_LOG_ERROR,"[MTP2]%s %s : %s\n",
<span style="color: #800080; font-weight: bold">@@ -196,17 +198,17 @@ void handle_sng_mtp2_alarm(Pst *pst, SdMngmt *sta)</span>
                        
                        /* find the name for the sap in question */
                        x = 1;
<span style="color: #A00000">-                        while (g_ftdm_sngss7_data.cfg.mtpLink[x].id != 0) {</span>
<span style="color: #A00000">-                                if (g_ftdm_sngss7_data.cfg.mtpLink[x].id == sta->t.usta.evntParm[0]) {</span>
<span style="color: #00A000">+                        while (g_ftdm_sngss7_data.cfg.mtp2Link[x].id != 0) {</span>
<span style="color: #00A000">+                                if (g_ftdm_sngss7_data.cfg.mtp2Link[x].id == sta->t.usta.evntParm[0]) {</span>
                                        break;
                                }
                                x++;
                        }
<span style="color: #A00000">-                        if (g_ftdm_sngss7_data.cfg.mtpLink[x].id == 0) {</span>
<span style="color: #00A000">+                        if (g_ftdm_sngss7_data.cfg.mtp2Link[x].id == 0) {</span>
                                sprintf(buf, "[SAPID:%d]", sta->t.usta.evntParm[0]);
                        } else {
<span style="color: #A00000">-                                sprintf(buf, "[%s]", g_ftdm_sngss7_data.cfg.mtpLink[x].name);</span>
<span style="color: #00A000">+                                sprintf(buf, "[%s]", g_ftdm_sngss7_data.cfg.mtp2Link[x].name);</span>
                        }
                        ftdm_log(FTDM_LOG_ERROR,"[MTP2]%s %s : %s\n",
<span style="color: #800080; font-weight: bold">@@ -220,17 +222,17 @@ void handle_sng_mtp2_alarm(Pst *pst, SdMngmt *sta)</span>
                        /* find the name for the sap in question */
                        x = 1;
<span style="color: #A00000">-                        while (g_ftdm_sngss7_data.cfg.mtpLink[x].id != 0) {</span>
<span style="color: #A00000">-                                if (g_ftdm_sngss7_data.cfg.mtpLink[x].id == sta->t.usta.evntParm[0]) {</span>
<span style="color: #00A000">+                        while (g_ftdm_sngss7_data.cfg.mtp2Link[x].id != 0) {</span>
<span style="color: #00A000">+                                if (g_ftdm_sngss7_data.cfg.mtp2Link[x].id == sta->t.usta.evntParm[0]) {</span>
                                        break;
                                }
                                x++;
                        }
<span style="color: #A00000">-                        if (g_ftdm_sngss7_data.cfg.mtpLink[x].id == 0) {</span>
<span style="color: #00A000">+                        if (g_ftdm_sngss7_data.cfg.mtp2Link[x].id == 0) {</span>
                                sprintf(buf, "[SAPID:%d]", sta->t.usta.evntParm[0]);
                        } else {
<span style="color: #A00000">-                                sprintf(buf, "[%s]", g_ftdm_sngss7_data.cfg.mtpLink[x].name);</span>
<span style="color: #00A000">+                                sprintf(buf, "[%s]", g_ftdm_sngss7_data.cfg.mtp2Link[x].name);</span>
                        }
                        ftdm_log(FTDM_LOG_ERROR,"[MTP2]%s %s : RTB Queue Len(%d)|Oldest BSN(%d)|Tx Queue Len(%d)|Outstanding Frames(%d)\n",
<span style="color: #800080; font-weight: bold">@@ -246,17 +248,17 @@ void handle_sng_mtp2_alarm(Pst *pst, SdMngmt *sta)</span>
                        /* find the name for the sap in question */
                        x = 1;
<span style="color: #A00000">-                        while (g_ftdm_sngss7_data.cfg.mtpLink[x].id != 0) {</span>
<span style="color: #A00000">-                                if (g_ftdm_sngss7_data.cfg.mtpLink[x].id == sta->t.usta.evntParm[0]) {</span>
<span style="color: #00A000">+                        while (g_ftdm_sngss7_data.cfg.mtp2Link[x].id != 0) {</span>
<span style="color: #00A000">+                                if (g_ftdm_sngss7_data.cfg.mtp2Link[x].id == sta->t.usta.evntParm[0]) {</span>
                                        break;
                                }
                                x++;
                        }
<span style="color: #A00000">-                        if (g_ftdm_sngss7_data.cfg.mtpLink[x].id == 0) {</span>
<span style="color: #00A000">+                        if (g_ftdm_sngss7_data.cfg.mtp2Link[x].id == 0) {</span>
                                sprintf(buf, "[SAPID:%d]", sta->t.usta.evntParm[0]);
                        } else {
<span style="color: #A00000">-                                sprintf(buf, "[%s]", g_ftdm_sngss7_data.cfg.mtpLink[x].name);</span>
<span style="color: #00A000">+                                sprintf(buf, "[%s]", g_ftdm_sngss7_data.cfg.mtp2Link[x].name);</span>
                        }
                        ftdm_log(FTDM_LOG_ERROR,"[MTP2]%s %s : RTB Queue Len(%d)\n",
<span style="color: #800080; font-weight: bold">@@ -269,17 +271,17 @@ void handle_sng_mtp2_alarm(Pst *pst, SdMngmt *sta)</span>
                        /* find the name for the sap in question */
                        x = 1;
<span style="color: #A00000">-                        while (g_ftdm_sngss7_data.cfg.mtpLink[x].id != 0) {</span>
<span style="color: #A00000">-                                if (g_ftdm_sngss7_data.cfg.mtpLink[x].id == sta->t.usta.evntParm[0]) {</span>
<span style="color: #00A000">+                        while (g_ftdm_sngss7_data.cfg.mtp2Link[x].id != 0) {</span>
<span style="color: #00A000">+                                if (g_ftdm_sngss7_data.cfg.mtp2Link[x].id == sta->t.usta.evntParm[0]) {</span>
                                        break;
                                }
                                x++;
                        }
<span style="color: #A00000">-                        if (g_ftdm_sngss7_data.cfg.mtpLink[x].id == 0) {</span>
<span style="color: #00A000">+                        if (g_ftdm_sngss7_data.cfg.mtp2Link[x].id == 0) {</span>
                                sprintf(buf, "[SAPID:%d]", sta->t.usta.evntParm[0]);
                        } else {
<span style="color: #A00000">-                                sprintf(buf, "[%s]", g_ftdm_sngss7_data.cfg.mtpLink[x].name);</span>
<span style="color: #00A000">+                                sprintf(buf, "[%s]", g_ftdm_sngss7_data.cfg.mtp2Link[x].name);</span>
                        }
                        ftdm_log(FTDM_LOG_ERROR,"[MTP2]%s %s : %d\n",
<span style="color: #800080; font-weight: bold">@@ -290,9 +292,11 @@ void handle_sng_mtp2_alarm(Pst *pst, SdMngmt *sta)</span>
                /**********************************************************************/
                case (LCM_EVENT_UI_INV_EVT):
                case (LCM_EVENT_LI_INV_EVT):
<span style="color: #A00000">-                        ftdm_log(FTDM_LOG_ERROR,"[MTP2] %s : %s : Primitive (%d)\n",</span>
<span style="color: #00A000">+                        ftdm_log(FTDM_LOG_ERROR,"[MTP2] %s(%d) : %s(%d) : Primitive (%d)\n",</span>
                                                                                DECODE_LSD_EVENT(sta->t.usta.alarm.event),
<span style="color: #00A000">+                                                                                sta->t.usta.alarm.event,</span>
                                                                                DECODE_LCM_CAUSE(sta->t.usta.alarm.cause),
<span style="color: #00A000">+                                                                                sta->t.usta.alarm.cause,</span>
                                                                                sta->t.usta.evntParm[0]);
                        break;
                /**********************************************************************/
<span style="color: #800080; font-weight: bold">@@ -362,22 +366,23 @@ void handle_sng_mtp3_alarm(Pst *pst, SnMngmt *sta)</span>
                        /* find the name for the sap in question */
                        x = 1;
<span style="color: #A00000">-                        while (g_ftdm_sngss7_data.cfg.mtpLink[x].id != 0) {</span>
<span style="color: #A00000">-                                if (g_ftdm_sngss7_data.cfg.mtpLink[x].id == sta->hdr.elmId.elmntInst1) {</span>
<span style="color: #00A000">+                        while (g_ftdm_sngss7_data.cfg.mtp3Link[x].id != 0) {</span>
<span style="color: #00A000">+                                if (g_ftdm_sngss7_data.cfg.mtp3Link[x].id == sta->hdr.elmId.elmntInst1) {</span>
                                        break;
                                }
                                x++;
                        }
<span style="color: #A00000">-                        if (g_ftdm_sngss7_data.cfg.mtpLink[x].id == 0) {</span>
<span style="color: #00A000">+                        if (g_ftdm_sngss7_data.cfg.mtp3Link[x].id == 0) {</span>
                                sprintf(buf, "[SAPID:%d]", sta->hdr.elmId.elmntInst1);
                        } else {
<span style="color: #A00000">-                                sprintf(buf, "[%s]", g_ftdm_sngss7_data.cfg.mtpLink[x].name);</span>
<span style="color: #00A000">+                                sprintf(buf, "[%s]", g_ftdm_sngss7_data.cfg.mtp3Link[x].name);</span>
                        }
                switch (sta->t.usta.alarm.event) {
                /**********************************************************************/
                case (LSN_EVENT_INV_OPC_OTHER_END):
<span style="color: #00A000">+                        </span>
                        ftdm_log(FTDM_LOG_ERROR,"[MTP3]%s %s : %s : OPC(0x%X%X%X%X)\n",
                                                                                buf,
                                                                                DECODE_LSN_EVENT(sta->t.usta.alarm.event),
<span style="color: #800080; font-weight: bold">@@ -460,7 +465,7 @@ void handle_sng_mtp3_alarm(Pst *pst, SnMngmt *sta)</span>
                        break;
                /**********************************************************************/
                default:
<span style="color: #A00000">-                        ftdm_log(FTDM_LOG_ERROR,"[MTP3][DPC:0x%d%d%d%d] %s : %s\n",</span>
<span style="color: #00A000">+                        ftdm_log(FTDM_LOG_ERROR,"[MTP3][DPC:0x%X%X%X%X] %s : %s\n",</span>
                                                                                sta->t.usta.evntParm[0],
                                                                                sta->t.usta.evntParm[1],
                                                                                sta->t.usta.evntParm[2],
<span style="color: #800080; font-weight: bold">@@ -744,7 +749,63 @@ void handle_sng_cc_alarm(Pst *pst, CcMngmt *sta)</span>
        return;
} /* handle_cc_alarm */
<span style="color: #00A000">+</span>
/******************************************************************************/
<span style="color: #00A000">+void handle_sng_relay_alarm(Pst *pst, RyMngmt *sta)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        switch (sta->hdr.elmId.elmnt) {</span>
<span style="color: #00A000">+        /**************************************************************************/</span>
<span style="color: #00A000">+        case (LRY_USTA_ERR): /* ERROR */</span>
<span style="color: #00A000">+                ftdm_log(FTDM_LOG_ERROR,"[RELAY] Error: tx procId %d: err procId %d: channel %d: seq %s: reason %s\n",</span>
<span style="color: #00A000">+                                                                                                sta->t.usta.s.ryErrUsta.sendPid,</span>
<span style="color: #00A000">+                                                                                                sta->t.usta.s.ryErrUsta.errPid,</span>
<span style="color: #00A000">+                                                                                                sta->t.usta.s.ryErrUsta.id,</span>
<span style="color: #00A000">+                                                                                                DECODE_LRY_SEQ(sta->t.usta.s.ryErrUsta.sequence),</span>
<span style="color: #00A000">+                                                                                                DECODE_LRY_REASON(sta->t.usta.s.ryErrUsta.reason));</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                /* process the event */</span>
<span style="color: #00A000">+                handle_relay_disconnect_on_error(sta);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                break;</span>
<span style="color: #00A000">+        /**************************************************************************/</span>
<span style="color: #00A000">+        case (LRY_USTA_CNG): /* Congestion */</span>
<span style="color: #00A000">+                ftdm_log(FTDM_LOG_ERROR,"[RELAY] Congestion: tx procId %d: rem procId %d: channel %d: %s\n",</span>
<span style="color: #00A000">+                                                                                                sta->t.usta.s.ryCongUsta.sendPid,</span>
<span style="color: #00A000">+                                                                                                sta->t.usta.s.ryCongUsta.remPid,</span>
<span style="color: #00A000">+                                                                                                sta->t.usta.s.ryCongUsta.id,</span>
<span style="color: #00A000">+                                                                                                DECODE_LRY_CONG_FLAGS(sta->t.usta.s.ryCongUsta.flags));</span>
<span style="color: #00A000">+                break;</span>
<span style="color: #00A000">+        /**************************************************************************/</span>
<span style="color: #00A000">+        case (LRY_USTA_UP): /* channel up */</span>
<span style="color: #00A000">+                ftdm_log(FTDM_LOG_ERROR,"[RELAY] Channel UP: tx procId %d: channel %d\n",</span>
<span style="color: #00A000">+                                                                                                sta->t.usta.s.ryUpUsta.sendPid,</span>
<span style="color: #00A000">+                                                                                                sta->t.usta.s.ryUpUsta.id);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                /* process the event */</span>
<span style="color: #00A000">+                handle_relay_connect(sta);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                break;</span>
<span style="color: #00A000">+        /**************************************************************************/</span>
<span style="color: #00A000">+        case (LRY_USTA_DN): /* channel down */</span>
<span style="color: #00A000">+                ftdm_log(FTDM_LOG_ERROR,"[RELAY] Channel DOWN: tx procId %d: channel %d\n",</span>
<span style="color: #00A000">+                                                                                                sta->t.usta.s.ryUpUsta.sendPid,</span>
<span style="color: #00A000">+                                                                                                sta->t.usta.s.ryUpUsta.id);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                /* process the event */</span>
<span style="color: #00A000">+                handle_relay_disconnect_on_down(sta);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                break;</span>
<span style="color: #00A000">+        /**************************************************************************/</span>
<span style="color: #00A000">+        default:</span>
<span style="color: #00A000">+                ftdm_log(FTDM_LOG_ERROR,"Unknown Relay Alram\n");</span>
<span style="color: #00A000">+                break;</span>
<span style="color: #00A000">+        /**************************************************************************/</span>
<span style="color: #00A000">+        } /* switch (sta->hdr.elmId.elmnt) */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return;</span>
<span style="color: #00A000">+}</span>
/******************************************************************************/
/* For Emacs:
<span style="color: #000080; font-weight: bold">diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c</span>
<span style="color: #000080; font-weight: bold">index 9016771..c971179 100644</span>
<span style="color: #A00000">--- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c</span>
<span style="color: #00A000">+++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c</span>
<span style="color: #800080; font-weight: bold">@@ -543,7 +543,7 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)</span>
                                        ftdmchan->caller_data.hangup_cause = 41;
                
                                        /* set the flag to indicate this hangup is started from the local side */
<span style="color: #A00000">-                                        sngss7_set_flag (sngss7_info, FLAG_LOCAL_REL);</span>
<span style="color: #00A000">+                                        sngss7_set_ckt_flag (sngss7_info, FLAG_LOCAL_REL);</span>
                
                                        /* end the call */
                                        ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_CANCEL);
<span style="color: #800080; font-weight: bold">@@ -673,7 +673,7 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)</span>
                }
                /* set the flag to indicate this hangup is started from the remote side */
<span style="color: #A00000">-                sngss7_set_flag (sngss7_info, FLAG_REMOTE_REL);</span>
<span style="color: #00A000">+                sngss7_set_ckt_flag (sngss7_info, FLAG_REMOTE_REL);</span>
                /*this state is set when the line is hanging up */
                sigev.event_id = FTDM_SIGEVENT_STOP;
<span style="color: #800080; font-weight: bold">@@ -689,15 +689,15 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)</span>
                }
                /* check for remote hangup flag */
<span style="color: #A00000">-                if (sngss7_test_flag (sngss7_info, FLAG_REMOTE_REL)) {</span>
<span style="color: #00A000">+                if (sngss7_test_ckt_flag (sngss7_info, FLAG_REMOTE_REL)) {</span>
                        /* remote release ...do nothing here */
                        SS7_DEBUG_CHAN(ftdmchan,"Hanging up remotely requested call!%s\n", "");
<span style="color: #A00000">-                } else if (sngss7_test_flag (sngss7_info, FLAG_GLARE)) {</span>
<span style="color: #00A000">+                } else if (sngss7_test_ckt_flag (sngss7_info, FLAG_GLARE)) {</span>
                        /* release due to glare */
                        SS7_DEBUG_CHAN(ftdmchan,"Hanging up requested call do to glare%s\n", "");
                } else         {
                        /* set the flag to indicate this hangup is started from the local side */
<span style="color: #A00000">-                        sngss7_set_flag (sngss7_info, FLAG_LOCAL_REL);</span>
<span style="color: #00A000">+                        sngss7_set_ckt_flag (sngss7_info, FLAG_LOCAL_REL);</span>
                        /*this state is set when FS is hanging up...so tell the stack */
                        ft_to_sngss7_rel (ftdmchan);
<span style="color: #800080; font-weight: bold">@@ -718,16 +718,16 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)</span>
                        break;
                }
<span style="color: #A00000">-                if (sngss7_test_flag (sngss7_info, FLAG_REMOTE_REL)) {</span>
<span style="color: #00A000">+                if (sngss7_test_ckt_flag (sngss7_info, FLAG_REMOTE_REL)) {</span>
                        /* check if this hangup is from a tx RSC */
<span style="color: #A00000">-                        if (sngss7_test_flag (sngss7_info, FLAG_RESET_TX)) {</span>
<span style="color: #00A000">+                        if (sngss7_test_ckt_flag (sngss7_info, FLAG_RESET_TX)) {</span>
                                /* go to RESTART State until RSCa is received */
                                ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_RESTART);
                        } else {
                                /* if the hangup is from a rx RSC, rx GRS, or glare don't sent RLC */
<span style="color: #A00000">-                                if (!(sngss7_test_flag(sngss7_info, FLAG_RESET_RX)) &&</span>
<span style="color: #A00000">-                                        !(sngss7_test_flag(sngss7_info, FLAG_GRP_RESET_RX)) &&</span>
<span style="color: #A00000">-                                        !(sngss7_test_flag(sngss7_info, FLAG_GLARE))) {</span>
<span style="color: #00A000">+                                if (!(sngss7_test_ckt_flag(sngss7_info, FLAG_RESET_RX)) &&</span>
<span style="color: #00A000">+                                        !(sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_RESET_RX)) &&</span>
<span style="color: #00A000">+                                        !(sngss7_test_ckt_flag(sngss7_info, FLAG_GLARE))) {</span>
                                        /* send out the release complete */
                                        ft_to_sngss7_rlc (ftdmchan);
<span style="color: #800080; font-weight: bold">@@ -738,17 +738,17 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)</span>
                        }
                        SS7_DEBUG_CHAN(ftdmchan,"Completing remotely requested hangup!%s\n", "");
<span style="color: #A00000">-                } else if (sngss7_test_flag (sngss7_info, FLAG_LOCAL_REL)) {</span>
<span style="color: #00A000">+                } else if (sngss7_test_ckt_flag (sngss7_info, FLAG_LOCAL_REL)) {</span>
                        /* if this hang up is do to a rx RESET we need to sit here till the RSP arrives */
<span style="color: #A00000">-                        if (sngss7_test_flag (sngss7_info, FLAG_RESET_TX_RSP)) {</span>
<span style="color: #00A000">+                        if (sngss7_test_ckt_flag (sngss7_info, FLAG_RESET_TX_RSP)) {</span>
                                /* go to the down state as we have already received RSC-RLC */
                                ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_DOWN);
                        }
                        /* if it's a local release the user sends us to down */
                        SS7_DEBUG_CHAN(ftdmchan,"Completing locally requested hangup!%s\n", "");
<span style="color: #A00000">-                } else if (sngss7_test_flag (sngss7_info, FLAG_GLARE)) {</span>
<span style="color: #00A000">+                } else if (sngss7_test_ckt_flag (sngss7_info, FLAG_GLARE)) {</span>
                        SS7_DEBUG_CHAN(ftdmchan,"Completing requested hangup due to glare!%s\n", "");
                        ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_DOWN);
<span style="color: #800080; font-weight: bold">@@ -767,18 +767,18 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)</span>
                }
                /* check if there is a reset response that needs to be sent */
<span style="color: #A00000">-                if (sngss7_test_flag (sngss7_info, FLAG_RESET_RX)) {</span>
<span style="color: #00A000">+                if (sngss7_test_ckt_flag (sngss7_info, FLAG_RESET_RX)) {</span>
                        /* send a RSC-RLC */
                        ft_to_sngss7_rsca (ftdmchan);
                        /* clear the reset flag */
                        clear_rx_rsc_flags(sngss7_info);
<span style="color: #A00000">-                } /* if (sngss7_test_flag (sngss7_info, FLAG_RESET_RX)) */</span>
<span style="color: #00A000">+                } /* if (sngss7_test_ckt_flag (sngss7_info, FLAG_RESET_RX)) */</span>
                /* check if there was a GRS that needs a GRA */
<span style="color: #A00000">-                if ((sngss7_test_flag(sngss7_info, FLAG_GRP_RESET_RX)) &&</span>
<span style="color: #A00000">-                        (sngss7_test_flag(sngss7_info, FLAG_GRP_RESET_RX_DN)) &&</span>
<span style="color: #A00000">-                        (sngss7_test_flag(sngss7_info, FLAG_GRP_RESET_RX_CMPLT))) {</span>
<span style="color: #00A000">+                if ((sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_RESET_RX)) &&</span>
<span style="color: #00A000">+                        (sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_RESET_RX_DN)) &&</span>
<span style="color: #00A000">+                        (sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_RESET_RX_CMPLT))) {</span>
                        /* check if this is the base circuit and send out the GRA
                         * we insure that this is the last circuit to have the state change queued
<span style="color: #800080; font-weight: bold">@@ -794,40 +794,40 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)</span>
                        /* clear the grp reset flag */
                        clear_rx_grs_flags(sngss7_info);
<span style="color: #A00000">-                }/* if ( sngss7_test_flag ( sngss7_info, FLAG_GRP_RESET_RX ) ) */</span>
<span style="color: #00A000">+                }/* if ( sngss7_test_ckt_flag ( sngss7_info, FLAG_GRP_RESET_RX ) ) */</span>
                /* check if we got the reset response */
<span style="color: #A00000">-                if (sngss7_test_flag(sngss7_info, FLAG_RESET_TX_RSP)) {</span>
<span style="color: #00A000">+                if (sngss7_test_ckt_flag(sngss7_info, FLAG_RESET_TX_RSP)) {</span>
                        /* clear the reset flag */
                        clear_tx_rsc_flags(sngss7_info);
<span style="color: #A00000">-                } /* if (sngss7_test_flag(sngss7_info, FLAG_RESET_TX_RSP)) */</span>
<span style="color: #00A000">+                } /* if (sngss7_test_ckt_flag(sngss7_info, FLAG_RESET_TX_RSP)) */</span>
<span style="color: #A00000">-                if (sngss7_test_flag(sngss7_info, FLAG_GRP_RESET_TX_RSP)) {</span>
<span style="color: #00A000">+                if (sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_RESET_TX_RSP)) {</span>
                        /* clear the reset flag */
                        clear_tx_grs_flags(sngss7_info);
                        
                        /* clean out the spans GRA structure */
                        clear_rx_gra_data(sngss7_info);
<span style="color: #A00000">-                } /* if (sngss7_test_flag(sngss7_info, FLAG_GRP_RESET_TX_RSP)) */</span>
<span style="color: #00A000">+                } /* if (sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_RESET_TX_RSP)) */</span>
                /* check if we came from reset (aka we just processed a reset) */
                if ((ftdmchan->last_state == FTDM_CHANNEL_STATE_RESTART) ||
                        (ftdmchan->last_state == FTDM_CHANNEL_STATE_SUSPENDED)) {
                        /* check if reset flags are up indicating there is more processing to do yet */
<span style="color: #A00000">-                        if (!(sngss7_test_flag (sngss7_info, FLAG_RESET_TX)) &&</span>
<span style="color: #A00000">-                                !(sngss7_test_flag (sngss7_info, FLAG_RESET_RX)) &&</span>
<span style="color: #A00000">-                                !(sngss7_test_flag (sngss7_info, FLAG_GRP_RESET_TX)) &&</span>
<span style="color: #A00000">-                                !(sngss7_test_flag (sngss7_info, FLAG_GRP_RESET_RX))) {</span>
<span style="color: #00A000">+                        if (!(sngss7_test_ckt_flag (sngss7_info, FLAG_RESET_TX)) &&</span>
<span style="color: #00A000">+                                !(sngss7_test_ckt_flag (sngss7_info, FLAG_RESET_RX)) &&</span>
<span style="color: #00A000">+                                !(sngss7_test_ckt_flag (sngss7_info, FLAG_GRP_RESET_TX)) &&</span>
<span style="color: #00A000">+                                !(sngss7_test_ckt_flag (sngss7_info, FLAG_GRP_RESET_RX))) {</span>
                                /* now check if there is an active block */
<span style="color: #A00000">-                                if (!(sngss7_test_flag(sngss7_info, FLAG_CKT_LC_BLOCK_RX)) &&</span>
<span style="color: #A00000">-                                        !(sngss7_test_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX)) &&</span>
<span style="color: #A00000">-                                        !(sngss7_test_flag(sngss7_info, FLAG_CKT_MN_BLOCK_TX)) &&</span>
<span style="color: #A00000">-                                        !(sngss7_test_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX)) &&</span>
<span style="color: #A00000">-                                        !(sngss7_test_flag(sngss7_info, FLAG_GRP_HW_BLOCK_TX)) &&</span>
<span style="color: #A00000">-                                        !(sngss7_test_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX)) &&</span>
<span style="color: #A00000">-                                        !(sngss7_test_flag(sngss7_info, FLAG_GRP_MN_BLOCK_TX))) {</span>
<span style="color: #00A000">+                                if (!(sngss7_test_ckt_flag(sngss7_info, FLAG_CKT_LC_BLOCK_RX)) &&</span>
<span style="color: #00A000">+                                        !(sngss7_test_ckt_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX)) &&</span>
<span style="color: #00A000">+                                        !(sngss7_test_ckt_flag(sngss7_info, FLAG_CKT_MN_BLOCK_TX)) &&</span>
<span style="color: #00A000">+                                        !(sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX)) &&</span>
<span style="color: #00A000">+                                        !(sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_HW_BLOCK_TX)) &&</span>
<span style="color: #00A000">+                                        !(sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX)) &&</span>
<span style="color: #00A000">+                                        !(sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_MN_BLOCK_TX))) {</span>
                                
                                        /* check if the sig status is down, and bring it up if it isn't */
                                        if (!ftdm_test_flag (ftdmchan, FTDM_CHANNEL_SIG_UP)) {
<span style="color: #800080; font-weight: bold">@@ -839,7 +839,7 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)</span>
                                        } /* if (!ftdm_test_flag (ftdmchan, FTDM_CHANNEL_SIG_UP)) */
                                } /* if !blocked */
                        } else {
<span style="color: #A00000">-                                SS7_DEBUG_CHAN(ftdmchan,"Reset flags present (0x%X)\n", sngss7_info->flags);</span>
<span style="color: #00A000">+                                SS7_DEBUG_CHAN(ftdmchan,"Reset flags present (0x%X)\n", sngss7_info->ckt_flags);</span>
                        
                                /* there is still another reset pending so go back to reset*/
                                ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
<span style="color: #800080; font-weight: bold">@@ -858,8 +858,8 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)</span>
                sngss7_info->spId = 0;
                /* clear any call related flags */
<span style="color: #A00000">-                sngss7_clear_flag (sngss7_info, FLAG_REMOTE_REL);</span>
<span style="color: #A00000">-                sngss7_clear_flag (sngss7_info, FLAG_LOCAL_REL);</span>
<span style="color: #00A000">+                sngss7_clear_ckt_flag (sngss7_info, FLAG_REMOTE_REL);</span>
<span style="color: #00A000">+                sngss7_clear_ckt_flag (sngss7_info, FLAG_LOCAL_REL);</span>
                if (ftdm_test_flag (ftdmchan, FTDM_CHANNEL_OPEN)) {
<span style="color: #800080; font-weight: bold">@@ -869,10 +869,10 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)</span>
                } /* if (ftdm_test_flag (ftdmchan, FTDM_CHANNEL_OPEN)) */
                /* check if there is a glared call that needs to be processed */
<span style="color: #A00000">-                if (sngss7_test_flag(sngss7_info, FLAG_GLARE)) {</span>
<span style="color: #00A000">+                if (sngss7_test_ckt_flag(sngss7_info, FLAG_GLARE)) {</span>
                        
                        /* clear the glare flag */
<span style="color: #A00000">-                        sngss7_clear_flag (sngss7_info, FLAG_GLARE);</span>
<span style="color: #00A000">+                        sngss7_clear_ckt_flag (sngss7_info, FLAG_GLARE);</span>
                        /* check if we have an IAM stored...if we don't have one just exit */
                        if (sngss7_info->glare.circuit != 0) {
<span style="color: #800080; font-weight: bold">@@ -885,23 +885,23 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)</span>
                                /* clear the glare info */
                                memset(&sngss7_info->glare, 0x0, sizeof(sngss7_glare_data_t));
                        } /* if (sngss7_info->glare.circuit != 0) */
<span style="color: #A00000">-                } /* if (sngss7_test_flag(sngss7_info, FLAG_GLARE)) */</span>
<span style="color: #00A000">+                } /* if (sngss7_test_ckt_flag(sngss7_info, FLAG_GLARE)) */</span>
                break;
        /**************************************************************************/
        case FTDM_CHANNEL_STATE_RESTART:        /* CICs needs a Reset */
<span style="color: #A00000">-                if (sngss7_test_flag(sngss7_info, FLAG_CKT_UCIC_BLOCK)) {</span>
<span style="color: #A00000">-                        if ((sngss7_test_flag(sngss7_info, FLAG_RESET_RX)) ||</span>
<span style="color: #A00000">-                                (sngss7_test_flag(sngss7_info, FLAG_GRP_RESET_RX))) {</span>
<span style="color: #00A000">+                if (sngss7_test_ckt_flag(sngss7_info, FLAG_CKT_UCIC_BLOCK)) {</span>
<span style="color: #00A000">+                        if ((sngss7_test_ckt_flag(sngss7_info, FLAG_RESET_RX)) ||</span>
<span style="color: #00A000">+                                (sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_RESET_RX))) {</span>
                                SS7_DEBUG_CHAN(ftdmchan,"Incoming Reset request on CIC in UCIC block, removing UCIC block%s\n", "");
                                /* set the unblk flag */
<span style="color: #A00000">-                                sngss7_set_flag(sngss7_info, FLAG_CKT_UCIC_UNBLK);</span>
<span style="color: #00A000">+                                sngss7_set_ckt_flag(sngss7_info, FLAG_CKT_UCIC_UNBLK);</span>
                                /* clear the block flag */
<span style="color: #A00000">-                                sngss7_clear_flag(sngss7_info, FLAG_CKT_UCIC_BLOCK);</span>
<span style="color: #00A000">+                                sngss7_clear_ckt_flag(sngss7_info, FLAG_CKT_UCIC_BLOCK);</span>
                                /* process the flag */
                                ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
<span style="color: #800080; font-weight: bold">@@ -915,28 +915,28 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)</span>
                 * we can also check if we are in a PAUSED state (no point in sending message
                 */
                if ((ftdmchan->last_state != FTDM_CHANNEL_STATE_HANGUP_COMPLETE) &&
<span style="color: #A00000">-                        (!sngss7_test_flag(sngss7_info, FLAG_INFID_PAUSED))) {</span>
<span style="color: #00A000">+                        (!sngss7_test_ckt_flag(sngss7_info, FLAG_INFID_PAUSED))) {</span>
                        /* check if this is an outgoing RSC */
<span style="color: #A00000">-                        if ((sngss7_test_flag(sngss7_info, FLAG_RESET_TX)) &&</span>
<span style="color: #A00000">-                                !(sngss7_test_flag(sngss7_info, FLAG_RESET_SENT))) {</span>
<span style="color: #00A000">+                        if ((sngss7_test_ckt_flag(sngss7_info, FLAG_RESET_TX)) &&</span>
<span style="color: #00A000">+                                !(sngss7_test_ckt_flag(sngss7_info, FLAG_RESET_SENT))) {</span>
                                /* send a reset request */
                                ft_to_sngss7_rsc (ftdmchan);
<span style="color: #A00000">-                                sngss7_set_flag(sngss7_info, FLAG_RESET_SENT);</span>
<span style="color: #00A000">+                                sngss7_set_ckt_flag(sngss7_info, FLAG_RESET_SENT);</span>
<span style="color: #A00000">-                        } /* if (sngss7_test_flag(sngss7_info, FLAG_RESET_TX)) */</span>
<span style="color: #00A000">+                        } /* if (sngss7_test_ckt_flag(sngss7_info, FLAG_RESET_TX)) */</span>
        
                        /* check if this is the first channel of a GRS (this flag is thrown when requesting reset) */
<span style="color: #A00000">-                        if ( (sngss7_test_flag (sngss7_info, FLAG_GRP_RESET_TX)) &&</span>
<span style="color: #A00000">-                                !(sngss7_test_flag(sngss7_info, FLAG_GRP_RESET_SENT)) &&</span>
<span style="color: #A00000">-                                (sngss7_test_flag(sngss7_info, FLAG_GRP_RESET_BASE))) {</span>
<span style="color: #00A000">+                        if ( (sngss7_test_ckt_flag (sngss7_info, FLAG_GRP_RESET_TX)) &&</span>
<span style="color: #00A000">+                                !(sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_RESET_SENT)) &&</span>
<span style="color: #00A000">+                                (sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_RESET_BASE))) {</span>
                                        /* send out the grs */
                                        ft_to_sngss7_grs (ftdmchan);
<span style="color: #A00000">-                                        sngss7_set_flag(sngss7_info, FLAG_GRP_RESET_SENT);</span>
<span style="color: #00A000">+                                        sngss7_set_ckt_flag(sngss7_info, FLAG_GRP_RESET_SENT);</span>
<span style="color: #A00000">-                        }/* if ( sngss7_test_flag ( sngss7_info, FLAG_GRP_RESET_TX ) ) */</span>
<span style="color: #00A000">+                        }/* if ( sngss7_test_ckt_flag ( sngss7_info, FLAG_GRP_RESET_TX ) ) */</span>
                } /* if ( last_state != HANGUP && !PAUSED */
        
                /* if the sig_status is up...bring it down */
<span style="color: #800080; font-weight: bold">@@ -946,10 +946,10 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)</span>
                        ftdm_span_send_signal (ftdmchan->span, &sigev);
                }
<span style="color: #A00000">-                if (sngss7_test_flag (sngss7_info, FLAG_GRP_RESET_RX)) {</span>
<span style="color: #00A000">+                if (sngss7_test_ckt_flag (sngss7_info, FLAG_GRP_RESET_RX)) {</span>
                        /* set the grp reset done flag so we know we have finished this reset */
<span style="color: #A00000">-                        sngss7_set_flag(sngss7_info, FLAG_GRP_RESET_RX_DN);</span>
<span style="color: #A00000">-                } /* if (sngss7_test_flag (sngss7_info, FLAG_GRP_RESET_RX)) */</span>
<span style="color: #00A000">+                        sngss7_set_ckt_flag(sngss7_info, FLAG_GRP_RESET_RX_DN);</span>
<span style="color: #00A000">+                } /* if (sngss7_test_ckt_flag (sngss7_info, FLAG_GRP_RESET_RX)) */</span>
                if (ftdm_test_flag (ftdmchan, FTDM_CHANNEL_INUSE)) {
<span style="color: #800080; font-weight: bold">@@ -987,17 +987,17 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)</span>
                        } /* switch (ftdmchan->last_state) */
                } else {
                        /* check if this an incoming RSC or we have a response already */
<span style="color: #A00000">-                        if (sngss7_test_flag (sngss7_info, FLAG_RESET_RX) ||</span>
<span style="color: #A00000">-                                sngss7_test_flag (sngss7_info, FLAG_RESET_TX_RSP) ||</span>
<span style="color: #A00000">-                                sngss7_test_flag (sngss7_info, FLAG_GRP_RESET_TX_RSP) ||</span>
<span style="color: #A00000">-                                sngss7_test_flag (sngss7_info, FLAG_GRP_RESET_RX_CMPLT)) {</span>
<span style="color: #00A000">+                        if (sngss7_test_ckt_flag (sngss7_info, FLAG_RESET_RX) ||</span>
<span style="color: #00A000">+                                sngss7_test_ckt_flag (sngss7_info, FLAG_RESET_TX_RSP) ||</span>
<span style="color: #00A000">+                                sngss7_test_ckt_flag (sngss7_info, FLAG_GRP_RESET_TX_RSP) ||</span>
<span style="color: #00A000">+                                sngss7_test_ckt_flag (sngss7_info, FLAG_GRP_RESET_RX_CMPLT)) {</span>
        
<span style="color: #A00000">-                                SS7_DEBUG_CHAN(ftdmchan, "Reset processed moving to DOWN (0x%X)\n", sngss7_info->flags);</span>
<span style="color: #00A000">+                                SS7_DEBUG_CHAN(ftdmchan, "Reset processed moving to DOWN (0x%X)\n", sngss7_info->ckt_flags);</span>
        
                                /* go to a down state to clear the channel and send the response */
                                ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_DOWN);
                        } else {
<span style="color: #A00000">-                                SS7_DEBUG_CHAN(ftdmchan, "Waiting on Reset Rsp/Grp Reset to move to DOWN (0x%X)\n", sngss7_info->flags);</span>
<span style="color: #00A000">+                                SS7_DEBUG_CHAN(ftdmchan, "Waiting on Reset Rsp/Grp Reset to move to DOWN (0x%X)\n", sngss7_info->ckt_flags);</span>
                        }
                }
<span style="color: #800080; font-weight: bold">@@ -1005,20 +1005,20 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)</span>
        /**************************************************************************/
        case FTDM_CHANNEL_STATE_SUSPENDED:        /* circuit has been blocked */
<span style="color: #A00000">-                 SS7_DEBUG_CHAN(ftdmchan,"Current flags: 0x%X\n", sngss7_info->flags);</span>
<span style="color: #00A000">+                 SS7_DEBUG_CHAN(ftdmchan,"Current flags: 0x%X\n", sngss7_info->ckt_flags);</span>
                /**********************************************************************/
<span style="color: #A00000">-                if (sngss7_test_flag(sngss7_info, FLAG_INFID_RESUME)) {</span>
<span style="color: #00A000">+                if (sngss7_test_ckt_flag(sngss7_info, FLAG_INFID_RESUME)) {</span>
                        SS7_DEBUG_CHAN(ftdmchan, "Processing RESUME%s\n", "");
                        /* clear the RESUME flag */
<span style="color: #A00000">-                        sngss7_clear_flag(sngss7_info, FLAG_INFID_RESUME);</span>
<span style="color: #00A000">+                        sngss7_clear_ckt_flag(sngss7_info, FLAG_INFID_RESUME);</span>
                        /* if there are any resets present */
<span style="color: #A00000">-                        if ((sngss7_test_flag (sngss7_info, FLAG_RESET_TX)) ||</span>
<span style="color: #A00000">-                                (sngss7_test_flag (sngss7_info, FLAG_RESET_RX)) ||</span>
<span style="color: #A00000">-                                (sngss7_test_flag (sngss7_info, FLAG_GRP_RESET_TX)) ||</span>
<span style="color: #A00000">-                                (sngss7_test_flag (sngss7_info, FLAG_GRP_RESET_RX))) {</span>
<span style="color: #00A000">+                        if ((sngss7_test_ckt_flag (sngss7_info, FLAG_RESET_TX)) ||</span>
<span style="color: #00A000">+                                (sngss7_test_ckt_flag (sngss7_info, FLAG_RESET_RX)) ||</span>
<span style="color: #00A000">+                                (sngss7_test_ckt_flag (sngss7_info, FLAG_GRP_RESET_TX)) ||</span>
<span style="color: #00A000">+                                (sngss7_test_ckt_flag (sngss7_info, FLAG_GRP_RESET_RX))) {</span>
                                /* go back to the reset state */
                                goto suspend_goto_restart;
<span style="color: #800080; font-weight: bold">@@ -1034,7 +1034,7 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)</span>
                        goto suspend_goto_last;
                } /* if (sngss7_test_flag(sngss7_info, FLAG_INFID_RESUME)) */
<span style="color: #A00000">-                if (sngss7_test_flag(sngss7_info, FLAG_INFID_PAUSED)) {</span>
<span style="color: #00A000">+                if (sngss7_test_ckt_flag(sngss7_info, FLAG_INFID_PAUSED)) {</span>
                        SS7_DEBUG_CHAN(ftdmchan, "Processing PAUSE%s\n", "");
                        /* bring the sig status down */
<span style="color: #800080; font-weight: bold">@@ -1044,9 +1044,9 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)</span>
                        /* go back to the last state */
                        goto suspend_goto_last;
<span style="color: #A00000">-                } /* if (sngss7_test_flag(sngss7_info, FLAG_INFID_PAUSED)) { */</span>
<span style="color: #00A000">+                } /* if (sngss7_test_ckt_flag(sngss7_info, FLAG_INFID_PAUSED)) { */</span>
                /**********************************************************************/
<span style="color: #A00000">-                if (sngss7_test_flag (sngss7_info, FLAG_CKT_MN_BLOCK_RX)) {</span>
<span style="color: #00A000">+                if (sngss7_test_ckt_flag (sngss7_info, FLAG_CKT_MN_BLOCK_RX)) {</span>
                        SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_MN_BLOCK_RX flag %s\n", "");
                        /* bring the sig status down */
<span style="color: #800080; font-weight: bold">@@ -1061,11 +1061,11 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)</span>
                        goto suspend_goto_last;
                }
<span style="color: #A00000">-                if (sngss7_test_flag (sngss7_info, FLAG_CKT_MN_UNBLK_RX)){</span>
<span style="color: #00A000">+                if (sngss7_test_ckt_flag (sngss7_info, FLAG_CKT_MN_UNBLK_RX)){</span>
                        SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_MN_UNBLK_RX flag %s\n", "");
                        /* clear the unblock flag */
<span style="color: #A00000">-                        sngss7_clear_flag (sngss7_info, FLAG_CKT_MN_UNBLK_RX);</span>
<span style="color: #00A000">+                        sngss7_clear_ckt_flag (sngss7_info, FLAG_CKT_MN_UNBLK_RX);</span>
                        /* bring the sig status up */
                        sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED;
<span style="color: #800080; font-weight: bold">@@ -1080,7 +1080,7 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)</span>
                }
                /**********************************************************************/
<span style="color: #A00000">-                if (sngss7_test_flag (sngss7_info, FLAG_CKT_MN_BLOCK_TX)) {</span>
<span style="color: #00A000">+                if (sngss7_test_ckt_flag (sngss7_info, FLAG_CKT_MN_BLOCK_TX)) {</span>
                        SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_MN_BLOCK_TX flag %s\n", "");
                        /* bring the sig status down */
<span style="color: #800080; font-weight: bold">@@ -1095,11 +1095,11 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)</span>
                        goto suspend_goto_last;
                }
<span style="color: #A00000">-                if (sngss7_test_flag (sngss7_info, FLAG_CKT_MN_UNBLK_TX)){</span>
<span style="color: #00A000">+                if (sngss7_test_ckt_flag (sngss7_info, FLAG_CKT_MN_UNBLK_TX)){</span>
                        SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_MN_UNBLK_TX flag %s\n", "");
                        /* clear the unblock flag */
<span style="color: #A00000">-                        sngss7_clear_flag (sngss7_info, FLAG_CKT_MN_UNBLK_TX);</span>
<span style="color: #00A000">+                        sngss7_clear_ckt_flag (sngss7_info, FLAG_CKT_MN_UNBLK_TX);</span>
                        /* bring the sig status up */
                        sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED;
<span style="color: #800080; font-weight: bold">@@ -1114,7 +1114,7 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)</span>
                }
                /**********************************************************************/
<span style="color: #A00000">-                if (sngss7_test_flag (sngss7_info, FLAG_CKT_LC_BLOCK_RX)) {</span>
<span style="color: #00A000">+                if (sngss7_test_ckt_flag (sngss7_info, FLAG_CKT_LC_BLOCK_RX)) {</span>
                        SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_LC_BLOCK_RX flag %s\n", "");
                        /* send a BLA */
<span style="color: #800080; font-weight: bold">@@ -1124,11 +1124,11 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)</span>
                        goto suspend_goto_last;
                }
<span style="color: #A00000">-                if (sngss7_test_flag (sngss7_info, FLAG_CKT_LC_UNBLK_RX)) {</span>
<span style="color: #00A000">+                if (sngss7_test_ckt_flag (sngss7_info, FLAG_CKT_LC_UNBLK_RX)) {</span>
                        SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_LC_UNBLK_RX flag %s\n", "");
                        
                        /* clear the unblock flag */
<span style="color: #A00000">-                        sngss7_clear_flag (sngss7_info, FLAG_CKT_MN_UNBLK_RX);</span>
<span style="color: #00A000">+                        sngss7_clear_ckt_flag (sngss7_info, FLAG_CKT_MN_UNBLK_RX);</span>
                        /* send a uba */
                        /*ft_to_sngss7_uba(ftdmchan);*/
<span style="color: #800080; font-weight: bold">@@ -1137,7 +1137,7 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)</span>
                        goto suspend_goto_last;
                }
                /**********************************************************************/
<span style="color: #A00000">-                if (sngss7_test_flag (sngss7_info, FLAG_CKT_UCIC_BLOCK)) {</span>
<span style="color: #00A000">+                if (sngss7_test_ckt_flag (sngss7_info, FLAG_CKT_UCIC_BLOCK)) {</span>
                        SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_UCIC_BLOCK flag %s\n", "");
                        /* bring the channel signaling status to down */
<span style="color: #800080; font-weight: bold">@@ -1157,17 +1157,17 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)</span>
                        goto suspend_goto_last;
                }
<span style="color: #A00000">-                if (sngss7_test_flag (sngss7_info, FLAG_CKT_UCIC_UNBLK)) {</span>
<span style="color: #00A000">+                if (sngss7_test_ckt_flag (sngss7_info, FLAG_CKT_UCIC_UNBLK)) {</span>
                        SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_UCIC_UNBLK flag %s\n", "");;
                        /* remove the UCIC block flag */
<span style="color: #A00000">-                        sngss7_clear_flag(sngss7_info, FLAG_CKT_UCIC_BLOCK);</span>
<span style="color: #00A000">+                        sngss7_clear_ckt_flag(sngss7_info, FLAG_CKT_UCIC_BLOCK);</span>
                        /* remove the UCIC unblock flag */
<span style="color: #A00000">-                        sngss7_clear_flag(sngss7_info, FLAG_CKT_UCIC_UNBLK);</span>
<span style="color: #00A000">+                        sngss7_clear_ckt_flag(sngss7_info, FLAG_CKT_UCIC_UNBLK);</span>
                        /* throw the channel into reset to sync states */
<span style="color: #A00000">-                        sngss7_set_flag(sngss7_info, FLAG_RESET_TX);</span>
<span style="color: #00A000">+                        sngss7_set_ckt_flag(sngss7_info, FLAG_RESET_TX);</span>
                        /* bring the channel into restart again */
                        goto suspend_goto_restart;
<span style="color: #800080; font-weight: bold">@@ -1232,9 +1232,9 @@ static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(ftdm_sangoma_ss7_outgoing_call)</span>
        }
        /* check if there is a remote block */
<span style="color: #A00000">-        if ((sngss7_test_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX)) ||</span>
<span style="color: #A00000">-                (sngss7_test_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX)) ||</span>
<span style="color: #A00000">-                (sngss7_test_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX))) {</span>
<span style="color: #00A000">+        if ((sngss7_test_ckt_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX)) ||</span>
<span style="color: #00A000">+                (sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX)) ||</span>
<span style="color: #00A000">+                (sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX))) {</span>
                /* the channel is blocked...can't send any calls here */
                SS7_ERROR_CHAN(ftdmchan, "Requested channel is remotely blocked, re-hunt channel!%s\n", " ");
<span style="color: #800080; font-weight: bold">@@ -1242,9 +1242,9 @@ static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(ftdm_sangoma_ss7_outgoing_call)</span>
        }
        /* check if there is a local block */
<span style="color: #A00000">-        if ((sngss7_test_flag(sngss7_info, FLAG_CKT_MN_BLOCK_TX)) ||</span>
<span style="color: #A00000">-                (sngss7_test_flag(sngss7_info, FLAG_GRP_HW_BLOCK_TX)) ||</span>
<span style="color: #A00000">-                (sngss7_test_flag(sngss7_info, FLAG_GRP_MN_BLOCK_TX))) {</span>
<span style="color: #00A000">+        if ((sngss7_test_ckt_flag(sngss7_info, FLAG_CKT_MN_BLOCK_TX)) ||</span>
<span style="color: #00A000">+                (sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_HW_BLOCK_TX)) ||</span>
<span style="color: #00A000">+                (sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_MN_BLOCK_TX))) {</span>
                /* KONRAD FIX ME : we should check if this is a TEST call and allow it */
<span style="color: #800080; font-weight: bold">@@ -1339,6 +1339,25 @@ static ftdm_status_t ftdm_sangoma_ss7_start(ftdm_span_t * span)</span>
        SS7_INFO ("Starting span %s:%u.\n", span->name, span->span_id);
<span style="color: #00A000">+        /* clear the monitor thread stop flag */</span>
<span style="color: #00A000">+        ftdm_clear_flag (span, FTDM_SPAN_STOP_THREAD);</span>
<span style="color: #00A000">+        ftdm_clear_flag (span, FTDM_SPAN_IN_THREAD);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* activate all the configured ss7 links */</span>
<span style="color: #00A000">+        if (ft_to_sngss7_activate_all()) {</span>
<span style="color: #00A000">+                SS7_CRITICAL ("Failed to activate LibSngSS7!\n");</span>
<span style="color: #00A000">+                return FTDM_FAIL;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /*start the span monitor thread */</span>
<span style="color: #00A000">+        if (ftdm_thread_create_detached (ftdm_sangoma_ss7_run, span) != FTDM_SUCCESS) {</span>
<span style="color: #00A000">+                SS7_CRITICAL ("Failed to start Span Monitor Thread!\n");</span>
<span style="color: #00A000">+                return FTDM_FAIL;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* confirm the state of all isup interfaces*/</span>
<span style="color: #00A000">+        check_status_of_all_isup_intf();</span>
<span style="color: #00A000">+</span>
        /* throw the channels in pause */
        for (x = 1; x < (span->chan_count + 1); x++) {
                /* extract the channel structure and sngss7 channel data */
<span style="color: #800080; font-weight: bold">@@ -1348,23 +1367,24 @@ static ftdm_status_t ftdm_sangoma_ss7_start(ftdm_span_t * span)</span>
                sngss7_span = ftdmchan->span->signal_data;
                sngss7_intf = &g_ftdm_sngss7_data.cfg.isupIntf[sngss7_info->circuit->infId];
<span style="color: #A00000">-</span>
                /* lock the channel */
                ftdm_mutex_lock(ftdmchan->mutex);
                /* check if the interface is paused or resumed */
                if (sngss7_test_flag(sngss7_intf, SNGSS7_PAUSED)) {
<span style="color: #00A000">+                        SS7_DEBUG_CHAN(ftdmchan, "ISUP intf %d is PAUSED\n", sngss7_intf->id);</span>
                        /* throw the pause flag */
<span style="color: #A00000">-                        sngss7_clear_flag(sngss7_info, FLAG_INFID_RESUME);</span>
<span style="color: #A00000">-                        sngss7_set_flag(sngss7_info, FLAG_INFID_PAUSED);</span>
<span style="color: #00A000">+                        sngss7_clear_ckt_flag(sngss7_info, FLAG_INFID_RESUME);</span>
<span style="color: #00A000">+                        sngss7_set_ckt_flag(sngss7_info, FLAG_INFID_PAUSED);</span>
                } else {
<span style="color: #A00000">-                        /* throw the pause flag */</span>
<span style="color: #A00000">-                        sngss7_clear_flag(sngss7_info, FLAG_INFID_PAUSED);</span>
<span style="color: #A00000">-                        sngss7_set_flag(sngss7_info, FLAG_INFID_RESUME);</span>
<span style="color: #00A000">+                        SS7_DEBUG_CHAN(ftdmchan, "ISUP intf %d is RESUMED\n", sngss7_intf->id);</span>
<span style="color: #00A000">+                        /* throw the resume flag */</span>
<span style="color: #00A000">+                        sngss7_clear_ckt_flag(sngss7_info, FLAG_INFID_PAUSED);</span>
<span style="color: #00A000">+                        sngss7_set_ckt_flag(sngss7_info, FLAG_INFID_RESUME);</span>
                }
#if 0
                /* throw the grp reset flag */
<span style="color: #A00000">-                sngss7_set_flag(sngss7_info, FLAG_GRP_RESET_TX);</span>
<span style="color: #00A000">+                sngss7_set_ckt_flag(sngss7_info, FLAG_GRP_RESET_TX);</span>
                if (x == 1) {
                        sngss7_set_flag(sngss7_info, FLAG_GRP_RESET_BASE);
                        sngss7_span->tx_grs.circuit = sngss7_info->circuit->id;
<span style="color: #800080; font-weight: bold">@@ -1372,7 +1392,7 @@ static ftdm_status_t ftdm_sangoma_ss7_start(ftdm_span_t * span)</span>
                }
#else
                /* throw the channel into reset */
<span style="color: #A00000">-                sngss7_set_flag(sngss7_info, FLAG_RESET_TX);</span>
<span style="color: #00A000">+                sngss7_set_ckt_flag(sngss7_info, FLAG_RESET_TX);</span>
#endif
                /* throw the channel to suspend */
                ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
<span style="color: #800080; font-weight: bold">@@ -1381,22 +1401,6 @@ static ftdm_status_t ftdm_sangoma_ss7_start(ftdm_span_t * span)</span>
                ftdm_mutex_unlock(ftdmchan->mutex);
        }
<span style="color: #A00000">-        /* clear the monitor thread stop flag */</span>
<span style="color: #A00000">-        ftdm_clear_flag (span, FTDM_SPAN_STOP_THREAD);</span>
<span style="color: #A00000">-        ftdm_clear_flag (span, FTDM_SPAN_IN_THREAD);</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-        /* activate all the configured ss7 links */</span>
<span style="color: #A00000">-        if (ft_to_sngss7_activate_all()) {</span>
<span style="color: #A00000">-                SS7_CRITICAL ("Failed to activate LibSngSS7!\n");</span>
<span style="color: #A00000">-                return FTDM_FAIL;</span>
<span style="color: #A00000">-        }</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-        /*start the span monitor thread */</span>
<span style="color: #A00000">-        if (ftdm_thread_create_detached (ftdm_sangoma_ss7_run, span) != FTDM_SUCCESS) {</span>
<span style="color: #A00000">-                SS7_CRITICAL ("Failed to start Span Monitor Thread!\n");</span>
<span style="color: #A00000">-                return FTDM_FAIL;</span>
<span style="color: #A00000">-        }</span>
<span style="color: #A00000">-</span>
        SS7_DEBUG ("Finished starting span %s:%u.\n", span->name, span->span_id);
        return FTDM_SUCCESS;
<span style="color: #800080; font-weight: bold">@@ -1537,7 +1541,6 @@ static FIO_SIG_LOAD_FUNCTION(ftdm_sangoma_ss7_init)</span>
        sng_event.cc.sng_umsg_ind = sngss7_umsg_ind;
        sng_event.cc.sng_susp_ind = sngss7_susp_ind;
        sng_event.cc.sng_resm_ind = sngss7_resm_ind;
<span style="color: #A00000">-        sng_event.cc.sng_ssp_sta_cfm = sngss7_ssp_sta_cfm;</span>
        sng_event.sm.sng_log = handle_sng_log;
        sng_event.sm.sng_mtp1_alarm = handle_sng_mtp1_alarm;
<span style="color: #800080; font-weight: bold">@@ -1545,9 +1548,10 @@ static FIO_SIG_LOAD_FUNCTION(ftdm_sangoma_ss7_init)</span>
        sng_event.sm.sng_mtp3_alarm = handle_sng_mtp3_alarm;
        sng_event.sm.sng_isup_alarm = handle_sng_isup_alarm;
        sng_event.sm.sng_cc_alarm = handle_sng_cc_alarm;
<span style="color: #00A000">+        sng_event.sm.sng_relay_alarm = handle_sng_relay_alarm;</span>
        /* initalize sng_ss7 library */
<span style="color: #A00000">-        sng_isup_init (&sng_event);</span>
<span style="color: #00A000">+        sng_isup_init_gen(&sng_event);</span>
        /* print the version of the library being used */
        sng_isup_version(&major, &minor, &build);
<span style="color: #800080; font-weight: bold">@@ -1566,7 +1570,32 @@ static FIO_SIG_UNLOAD_FUNCTION(ftdm_sangoma_ss7_unload)</span>
        ftdm_log (FTDM_LOG_INFO, "Starting ftmod_sangoma_ss7 unload...\n");
<span style="color: #A00000">-        sng_isup_free();</span>
<span style="color: #00A000">+        if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_CC)) {</span>
<span style="color: #00A000">+                sng_isup_free_cc();</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_ISUP)) {</span>
<span style="color: #00A000">+                ftmod_ss7_shutdown_isup();</span>
<span style="color: #00A000">+                sng_isup_free_isup();</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP3)) {</span>
<span style="color: #00A000">+                ftmod_ss7_shutdown_mtp3();</span>
<span style="color: #00A000">+                sng_isup_free_mtp3();</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP2)) {</span>
<span style="color: #00A000">+                ftmod_ss7_shutdown_mtp2();</span>
<span style="color: #00A000">+                sng_isup_free_mtp2();</span>
<span style="color: #00A000">+                sng_isup_free_mtp1();</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        ftmod_ss7_shutdown_relay();</span>
<span style="color: #00A000">+        sng_isup_free_relay();</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        sng_isup_free_sm();</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        sng_isup_free_gen();</span>
        ftdm_log (FTDM_LOG_INFO, "Finished ftmod_sangoma_ss7 unload!\n");
        return FTDM_SUCCESS;
<span style="color: #000080; font-weight: bold">diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h</span>
<span style="color: #000080; font-weight: bold">index f28547f..5272aa8 100644</span>
<span style="color: #A00000">--- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h</span>
<span style="color: #00A000">+++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h</span>
<span style="color: #800080; font-weight: bold">@@ -83,12 +83,6 @@ typedef enum {</span>
} sng_ckt_type_t;
typedef enum {
<span style="color: #A00000">-        CONFIGURED                = (1 << 0),</span>
<span style="color: #A00000">-        ACTIVE                        = (1 << 1),</span>
<span style="color: #A00000">-        SNGSS7_PAUSED        = (1 << 7)</span>
<span style="color: #A00000">-} sng_flag_t;</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-typedef enum {</span>
        SNGSS7_LPA_FOR_COT                = (1 << 0),        /* send LPA when COT arrives */
        SNGSS7_ACM_OBCI_BITA        = (1 << 10)        /* in-band indication */
} sng_intf_options_t;
<span style="color: #800080; font-weight: bold">@@ -98,84 +92,124 @@ typedef enum {</span>
        SNG_CALLING                        = 2
} sng_addr_type_t;
<span style="color: #A00000">-typedef struct sng_mtp_link {</span>
<span style="color: #A00000">-        char                        name[MAX_NAME_LEN];</span>
<span style="color: #A00000">-        uint32_t                id;</span>
<span style="color: #A00000">-        uint32_t                flags;</span>
<span style="color: #A00000">-        struct {</span>
<span style="color: #A00000">-                uint32_t        span;</span>
<span style="color: #A00000">-                uint32_t        chan;</span>
<span style="color: #A00000">-        } mtp1;</span>
<span style="color: #A00000">-        struct {</span>
<span style="color: #A00000">-                uint32_t        lssuLength;</span>
<span style="color: #A00000">-                uint32_t        errorType;</span>
<span style="color: #A00000">-                uint32_t        linkType;</span>
<span style="color: #A00000">-                uint32_t        mtp1Id;</span>
<span style="color: #A00000">-                uint32_t        t1;</span>
<span style="color: #A00000">-                uint32_t        t2;</span>
<span style="color: #A00000">-                uint32_t        t3;</span>
<span style="color: #A00000">-                uint32_t        t4n;</span>
<span style="color: #A00000">-                uint32_t        t4e;</span>
<span style="color: #A00000">-                uint32_t        t5;</span>
<span style="color: #A00000">-                uint32_t        t6;</span>
<span style="color: #A00000">-                uint32_t        t7;</span>
<span style="color: #A00000">-        } mtp2;</span>
<span style="color: #A00000">-        struct {</span>
<span style="color: #A00000">-                uint32_t        priority;</span>
<span style="color: #A00000">-                uint32_t        linkType;</span>
<span style="color: #A00000">-                uint32_t        switchType;</span>
<span style="color: #A00000">-                uint32_t        apc;</span>
<span style="color: #A00000">-                uint32_t        spc;</span>
<span style="color: #A00000">-                uint32_t        ssf;</span>
<span style="color: #A00000">-                uint32_t        slc;</span>
<span style="color: #A00000">-                uint32_t        linkSetId;</span>
<span style="color: #A00000">-                uint32_t        mtp2Id;</span>
<span style="color: #A00000">-                uint32_t        t1;</span>
<span style="color: #A00000">-                uint32_t        t2;</span>
<span style="color: #A00000">-                uint32_t        t3;</span>
<span style="color: #A00000">-                uint32_t        t4;</span>
<span style="color: #A00000">-                uint32_t        t5;</span>
<span style="color: #A00000">-                uint32_t        t6;</span>
<span style="color: #A00000">-                uint32_t        t7;</span>
<span style="color: #A00000">-                uint32_t        t8;</span>
<span style="color: #A00000">-                uint32_t        t9;</span>
<span style="color: #A00000">-                uint32_t        t10;</span>
<span style="color: #A00000">-                uint32_t        t11;</span>
<span style="color: #A00000">-                uint32_t        t12;</span>
<span style="color: #A00000">-                uint32_t        t13;</span>
<span style="color: #A00000">-                uint32_t        t14;</span>
<span style="color: #A00000">-                uint32_t        t15;</span>
<span style="color: #A00000">-                uint32_t        t16;</span>
<span style="color: #A00000">-                uint32_t        t17;</span>
<span style="color: #A00000">-                uint32_t        t18;</span>
<span style="color: #A00000">-                uint32_t        t19;</span>
<span style="color: #A00000">-                uint32_t        t20;</span>
<span style="color: #A00000">-                uint32_t        t21;</span>
<span style="color: #A00000">-                uint32_t        t22;</span>
<span style="color: #A00000">-                uint32_t        t23;</span>
<span style="color: #A00000">-                uint32_t        t24;</span>
<span style="color: #A00000">-                uint32_t        t25;</span>
<span style="color: #A00000">-                uint32_t        t27;</span>
<span style="color: #A00000">-                uint32_t        t28;</span>
<span style="color: #A00000">-                uint32_t        t29;</span>
<span style="color: #A00000">-                uint32_t        t30;</span>
<span style="color: #A00000">-                uint32_t        t31;</span>
<span style="color: #A00000">-                uint32_t        t32;</span>
<span style="color: #A00000">-                uint32_t        t33;</span>
<span style="color: #A00000">-                uint32_t        t34;</span>
<span style="color: #A00000">-                uint32_t        t35;</span>
<span style="color: #A00000">-                uint32_t        t36;</span>
<span style="color: #A00000">-                uint32_t        t37;</span>
<span style="color: #A00000">-                uint32_t        tcraft;</span>
<span style="color: #A00000">-                uint32_t        tflc;</span>
<span style="color: #A00000">-                uint32_t        tbnd;</span>
<span style="color: #A00000">-        } mtp3;</span>
<span style="color: #A00000">-} sng_mtp_link_t;</span>
<span style="color: #00A000">+typedef struct sng_mtp2_error_type {</span>
<span style="color: #00A000">+        int        init;</span>
<span style="color: #00A000">+        char sng_type[MAX_NAME_LEN];</span>
<span style="color: #00A000">+        uint32_t tril_type;</span>
<span style="color: #00A000">+} sng_mtp2_error_type_t;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+typedef struct sng_link_type {</span>
<span style="color: #00A000">+        int init;</span>
<span style="color: #00A000">+        char sng_type[MAX_NAME_LEN];</span>
<span style="color: #00A000">+        uint32_t tril_mtp2_type;</span>
<span style="color: #00A000">+        uint32_t tril_mtp3_type;</span>
<span style="color: #00A000">+} sng_link_type_t;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+typedef struct sng_switch_type {</span>
<span style="color: #00A000">+        int init;</span>
<span style="color: #00A000">+        char sng_type[MAX_NAME_LEN];</span>
<span style="color: #00A000">+        uint32_t tril_mtp3_type;</span>
<span style="color: #00A000">+        uint32_t tril_isup_type;</span>
<span style="color: #00A000">+} sng_switch_type_t;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+typedef struct sng_ssf_type {</span>
<span style="color: #00A000">+        int init;</span>
<span style="color: #00A000">+        char sng_type[MAX_NAME_LEN];</span>
<span style="color: #00A000">+        uint32_t tril_type;</span>
<span style="color: #00A000">+} sng_ssf_type_t;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+typedef struct sng_cic_cntrl_type {</span>
<span style="color: #00A000">+        int init;</span>
<span style="color: #00A000">+        char sng_type[MAX_NAME_LEN];</span>
<span style="color: #00A000">+        uint32_t tril_type;</span>
<span style="color: #00A000">+} sng_cic_cntrl_type_t;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+typedef struct sng_mtp1_link {</span>
<span style="color: #00A000">+        char                name[MAX_NAME_LEN];</span>
<span style="color: #00A000">+        uint32_t        flags;</span>
<span style="color: #00A000">+        uint32_t        id;</span>
<span style="color: #00A000">+        uint32_t        span;</span>
<span style="color: #00A000">+        uint32_t        chan;</span>
<span style="color: #00A000">+} sng_mtp1_link_t;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+typedef struct sng_mtp2_link {</span>
<span style="color: #00A000">+        char                name[MAX_NAME_LEN];</span>
<span style="color: #00A000">+        uint32_t        flags;</span>
<span style="color: #00A000">+        uint32_t        id;</span>
<span style="color: #00A000">+        uint32_t        lssuLength;</span>
<span style="color: #00A000">+        uint32_t        errorType;</span>
<span style="color: #00A000">+        uint32_t        linkType;</span>
<span style="color: #00A000">+        uint32_t        mtp1Id;</span>
<span style="color: #00A000">+        uint32_t        mtp1ProcId;</span>
<span style="color: #00A000">+        uint32_t        t1;</span>
<span style="color: #00A000">+        uint32_t        t2;</span>
<span style="color: #00A000">+        uint32_t        t3;</span>
<span style="color: #00A000">+        uint32_t        t4n;</span>
<span style="color: #00A000">+        uint32_t        t4e;</span>
<span style="color: #00A000">+        uint32_t        t5;</span>
<span style="color: #00A000">+        uint32_t        t6;</span>
<span style="color: #00A000">+        uint32_t        t7;</span>
<span style="color: #00A000">+} sng_mtp2_link_t;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+typedef struct sng_mtp3_link {</span>
<span style="color: #00A000">+        char                name[MAX_NAME_LEN];</span>
<span style="color: #00A000">+        uint32_t        flags;</span>
<span style="color: #00A000">+        uint32_t        id;</span>
<span style="color: #00A000">+        uint32_t        priority;</span>
<span style="color: #00A000">+        uint32_t        linkType;</span>
<span style="color: #00A000">+        uint32_t        switchType;</span>
<span style="color: #00A000">+        uint32_t        apc;</span>
<span style="color: #00A000">+        uint32_t        spc;</span>
<span style="color: #00A000">+        uint32_t        ssf;</span>
<span style="color: #00A000">+        uint32_t        slc;</span>
<span style="color: #00A000">+        uint32_t        linkSetId;</span>
<span style="color: #00A000">+        uint32_t        mtp2Id;</span>
<span style="color: #00A000">+        uint32_t        mtp2ProcId;</span>
<span style="color: #00A000">+        uint32_t        t1;</span>
<span style="color: #00A000">+        uint32_t        t2;</span>
<span style="color: #00A000">+        uint32_t        t3;</span>
<span style="color: #00A000">+        uint32_t        t4;</span>
<span style="color: #00A000">+        uint32_t        t5;</span>
<span style="color: #00A000">+        uint32_t        t6;</span>
<span style="color: #00A000">+        uint32_t        t7;</span>
<span style="color: #00A000">+        uint32_t        t8;</span>
<span style="color: #00A000">+        uint32_t        t9;</span>
<span style="color: #00A000">+        uint32_t        t10;</span>
<span style="color: #00A000">+        uint32_t        t11;</span>
<span style="color: #00A000">+        uint32_t        t12;</span>
<span style="color: #00A000">+        uint32_t        t13;</span>
<span style="color: #00A000">+        uint32_t        t14;</span>
<span style="color: #00A000">+        uint32_t        t15;</span>
<span style="color: #00A000">+        uint32_t        t16;</span>
<span style="color: #00A000">+        uint32_t        t17;</span>
<span style="color: #00A000">+        uint32_t        t18;</span>
<span style="color: #00A000">+        uint32_t        t19;</span>
<span style="color: #00A000">+        uint32_t        t20;</span>
<span style="color: #00A000">+        uint32_t        t21;</span>
<span style="color: #00A000">+        uint32_t        t22;</span>
<span style="color: #00A000">+        uint32_t        t23;</span>
<span style="color: #00A000">+        uint32_t        t24;</span>
<span style="color: #00A000">+        uint32_t        t25;</span>
<span style="color: #00A000">+        uint32_t        t27;</span>
<span style="color: #00A000">+        uint32_t        t28;</span>
<span style="color: #00A000">+        uint32_t        t29;</span>
<span style="color: #00A000">+        uint32_t        t30;</span>
<span style="color: #00A000">+        uint32_t        t31;</span>
<span style="color: #00A000">+        uint32_t        t32;</span>
<span style="color: #00A000">+        uint32_t        t33;</span>
<span style="color: #00A000">+        uint32_t        t34;</span>
<span style="color: #00A000">+        uint32_t        t35;</span>
<span style="color: #00A000">+        uint32_t        t36;</span>
<span style="color: #00A000">+        uint32_t        t37;</span>
<span style="color: #00A000">+        uint32_t        tcraft;</span>
<span style="color: #00A000">+        uint32_t        tflc;</span>
<span style="color: #00A000">+        uint32_t        tbnd;</span>
<span style="color: #00A000">+} sng_mtp3_link_t;</span>
typedef struct sng_link_set {
<span style="color: #A00000">-        uint32_t                id;</span>
        char                        name[MAX_NAME_LEN];
        uint32_t                flags;
<span style="color: #00A000">+        uint32_t                id;</span>
        uint32_t                apc;
        uint32_t                linkType;
        uint32_t                switchType;
<span style="color: #800080; font-weight: bold">@@ -186,9 +220,9 @@ typedef struct sng_link_set {</span>
} sng_link_set_t;
typedef struct sng_route {
<span style="color: #A00000">-        uint32_t                id;</span>
        char                        name[MAX_NAME_LEN];
        uint32_t                flags;
<span style="color: #00A000">+        uint32_t                id;</span>
        uint32_t                dpc;
        uint32_t                cmbLinkSetId;
        uint32_t                linkSetId;
<span style="color: #800080; font-weight: bold">@@ -211,10 +245,10 @@ typedef struct sng_route {</span>
} sng_route_t;
typedef struct sng_isup_intf {
<span style="color: #A00000">-        uint32_t                id;</span>
        char                        name[MAX_NAME_LEN];
        uint32_t                options;
        uint32_t                flags;
<span style="color: #00A000">+        uint32_t                id;</span>
        uint32_t                spc;
        uint32_t                dpc;
        uint32_t                switchType;
<span style="color: #800080; font-weight: bold">@@ -222,9 +256,6 @@ typedef struct sng_isup_intf {</span>
        uint32_t                mtpRouteId;
        uint32_t                ssf;
        uint32_t                isap;
<span style="color: #A00000">-        uint32_t                clg_nadi;</span>
<span style="color: #A00000">-        uint32_t                cld_nadi;</span>
<span style="color: #A00000">-        uint32_t                min_digits;</span>
        uint16_t                t4;
        uint32_t                t10;
        uint32_t                t11;
<span style="color: #800080; font-weight: bold">@@ -241,7 +272,6 @@ typedef struct sng_isup_intf {</span>
        uint32_t                t29;
        uint32_t                t30;
        uint32_t                t32;
<span style="color: #A00000">-        uint32_t                t35;</span>
        uint32_t                t37;
        uint32_t                t38;
        uint32_t                t39;
<span style="color: #800080; font-weight: bold">@@ -251,15 +281,23 @@ typedef struct sng_isup_intf {</span>
} sng_isup_inf_t;
typedef struct sng_isup_ckt {
<span style="color: #A00000">-        uint32_t                id;</span>
<span style="color: #00A000">+        uint32_t                options;</span>
        uint32_t                flags;
<span style="color: #00A000">+        uint32_t                ckt_flags;</span>
<span style="color: #00A000">+        uint32_t                procId;</span>
<span style="color: #00A000">+        uint32_t                id;</span>
<span style="color: #00A000">+        uint32_t                ccSpanId;</span>
        uint32_t                span;
        uint32_t                chan;
        uint32_t                type;        /* VOICE/SIG/HOLE */
        uint32_t                cic;
        uint32_t                infId;
<span style="color: #A00000">-        uint32_t                ssf;</span>
        uint32_t                typeCntrl;
<span style="color: #00A000">+        uint32_t                ssf;</span>
<span style="color: #00A000">+        uint32_t                switchType;</span>
<span style="color: #00A000">+        uint32_t                clg_nadi;</span>
<span style="color: #00A000">+        uint32_t                cld_nadi;</span>
<span style="color: #00A000">+        uint32_t                min_digits;</span>
        void                        *obj;
        uint16_t                t3;
        uint16_t                t12;
<span style="color: #800080; font-weight: bold">@@ -268,12 +306,13 @@ typedef struct sng_isup_ckt {</span>
        uint16_t                t15;
        uint16_t                t16;
        uint16_t                t17;
<span style="color: #00A000">+        uint32_t                t35;</span>
        uint16_t                tval;
} sng_isup_ckt_t;
typedef struct sng_nsap {
<span style="color: #A00000">-        uint32_t                id;</span>
        uint32_t                flags;
<span style="color: #00A000">+        uint32_t                id;</span>
        uint32_t                suId;
        uint32_t                spId;
        uint32_t                nwId;
<span style="color: #800080; font-weight: bold">@@ -311,15 +350,30 @@ typedef struct sng_isap {</span>
        uint32_t                tfnlrelrsp;
} sng_isap_t;
<span style="color: #00A000">+typedef struct sng_relay {</span>
<span style="color: #00A000">+        uint32_t                id;</span>
<span style="color: #00A000">+        char                        name[MAX_NAME_LEN];</span>
<span style="color: #00A000">+        uint32_t                flags;</span>
<span style="color: #00A000">+        uint32_t                type;</span>
<span style="color: #00A000">+        uint32_t                port;</span>
<span style="color: #00A000">+        char                        hostname[RY_REMHOSTNAME_SIZE];</span>
<span style="color: #00A000">+        uint32_t                procId;</span>
<span style="color: #00A000">+} sng_relay_t;</span>
<span style="color: #00A000">+</span>
typedef struct sng_ss7_cfg {
        uint32_t                        spc;
<span style="color: #00A000">+        uint32_t                        procId;</span>
        char                                license[MAX_PATH];
        char                                signature[MAX_PATH];
<span style="color: #A00000">-        sng_mtp_link_t                mtpLink[MAX_MTP_LINKS+1];</span>
<span style="color: #00A000">+        uint32_t                        flags;</span>
<span style="color: #00A000">+        sng_relay_t                        relay[MAX_RELAY_CHANNELS+1];</span>
<span style="color: #00A000">+        sng_mtp1_link_t                mtp1Link[MAX_MTP_LINKS+1];</span>
<span style="color: #00A000">+        sng_mtp2_link_t                mtp2Link[MAX_MTP_LINKS+1];</span>
<span style="color: #00A000">+        sng_mtp3_link_t                mtp3Link[MAX_MTP_LINKS+1];</span>
        sng_link_set_t                mtpLinkSet[MAX_MTP_LINKSETS+1];
        sng_route_t                        mtpRoute[MAX_MTP_ROUTES+1];
        sng_isup_inf_t                isupIntf[MAX_ISUP_INFS+1];
<span style="color: #A00000">-        sng_isup_ckt_t                isupCkt[MAX_ISUP_CKTS+1];</span>
<span style="color: #00A000">+        sng_isup_ckt_t                isupCkt[10000];         /* KONRAD - only need 2000 ( and 0-1000 aren't used) since other servers are registerd else where */</span>
        sng_nsap_t                        nsap[MAX_NSAPS+1];
        sng_isap_t                        isap[MAX_ISAPS+1];        
}sng_ss7_cfg_t;
<span style="color: #800080; font-weight: bold">@@ -365,7 +419,7 @@ typedef struct sngss7_chan_data {</span>
        uint32_t                                spInstId;
        uint32_t                                spId;
        uint8_t                                        globalFlg;
<span style="color: #A00000">-        uint32_t                                flags;</span>
<span style="color: #00A000">+        uint32_t                                ckt_flags;</span>
        sngss7_glare_data_t                glare;
        sngss7_timer_data_t                t35;
}sngss7_chan_data_t;
<span style="color: #800080; font-weight: bold">@@ -407,8 +461,6 @@ typedef struct sngss7_event_data</span>
} sngss7_event_data_t;
<span style="color: #A00000">-</span>
<span style="color: #A00000">-</span>
typedef enum {
        FLAG_RESET_RX                        = (1 << 0),
        FLAG_RESET_TX                        = (1 << 1),
<span style="color: #800080; font-weight: bold">@@ -439,15 +491,39 @@ typedef enum {</span>
        FLAG_GRP_MN_BLOCK_RX        = (1 << 26),
        FLAG_GRP_MN_BLOCK_TX        = (1 << 27),
        FLAG_GRP_HW_UNBLK_TX        = (1 << 28),
<span style="color: #A00000">-        FLAG_GRP_MN_UNBLK_TX        = (1 << 29)</span>
<span style="color: #A00000">-} flag_t;</span>
<span style="color: #00A000">+        FLAG_GRP_MN_UNBLK_TX        = (1 << 29),</span>
<span style="color: #00A000">+        FLAG_RELAY_DOWN                        = (1 << 30)</span>
<span style="color: #00A000">+} sng_ckt_flag_t;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/* valid for every cfg array except circuits */</span>
<span style="color: #00A000">+typedef enum {</span>
<span style="color: #00A000">+        SNGSS7_CONFIGURED                = (1 << 0),</span>
<span style="color: #00A000">+        SNGSS7_ACTIVE                        = (1 << 1),</span>
<span style="color: #00A000">+        SNGSS7_RELAY_INIT                = (1 << 3),</span>
<span style="color: #00A000">+        SNGSS7_PAUSED                        = (1 << 7) /* for isup interfaces */</span>
<span style="color: #00A000">+} sng_cfg_flag_t;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+typedef enum {</span>
<span style="color: #00A000">+        SNGSS7_SM                = (1 << 0),</span>
<span style="color: #00A000">+        SNGSS7_RY                = (1 << 1),</span>
<span style="color: #00A000">+        SNGSS7_MTP1                = (1 << 2),</span>
<span style="color: #00A000">+        SNGSS7_MTP2                = (1 << 3),</span>
<span style="color: #00A000">+        SNGSS7_MTP3                = (1 << 4),</span>
<span style="color: #00A000">+        SNGSS7_ISUP                = (1 << 5),</span>
<span style="color: #00A000">+        SNGSS7_CC                = (1 << 6)</span>
<span style="color: #00A000">+} sng_task_flag_t;</span>
/******************************************************************************/
/* GLOBALS ********************************************************************/
<span style="color: #A00000">-extern ftdm_sngss7_data_t g_ftdm_sngss7_data;</span>
<span style="color: #A00000">-extern uint32_t                         sngss7_id;</span>
<span style="color: #A00000">-extern ftdm_sched_t                 *sngss7_sched;</span>
<span style="color: #A00000">-extern int                                cmbLinkSetId;</span>
<span style="color: #00A000">+extern ftdm_sngss7_data_t                g_ftdm_sngss7_data;</span>
<span style="color: #00A000">+extern sng_ssf_type_t                        sng_ssf_type_map[];</span>
<span style="color: #00A000">+extern sng_switch_type_t                sng_switch_type_map[];</span>
<span style="color: #00A000">+extern sng_link_type_t                        sng_link_type_map[];</span>
<span style="color: #00A000">+extern sng_mtp2_error_type_t        sng_mtp2_error_type_map[];</span>
<span style="color: #00A000">+extern sng_cic_cntrl_type_t         sng_cic_cntrl_type_map[];</span>
<span style="color: #00A000">+extern uint32_t                                        sngss7_id;</span>
<span style="color: #00A000">+extern ftdm_sched_t                                *sngss7_sched;</span>
<span style="color: #00A000">+extern int                                                cmbLinkSetId;</span>
/******************************************************************************/
/* PROTOTYPES *****************************************************************/
<span style="color: #800080; font-weight: bold">@@ -461,6 +537,12 @@ void handle_sng_mtp2_alarm(Pst *pst, SdMngmt *sta);</span>
void handle_sng_mtp3_alarm(Pst *pst, SnMngmt *sta);
void handle_sng_isup_alarm(Pst *pst, SiMngmt *sta);
void handle_sng_cc_alarm(Pst *pst, CcMngmt *sta);
<span style="color: #00A000">+void handle_sng_relay_alarm(Pst *pst, RyMngmt *sta);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/* in ftmod_sangoma_ss7_relay.c */</span>
<span style="color: #00A000">+ftdm_status_t handle_relay_connect(RyMngmt *sta);</span>
<span style="color: #00A000">+ftdm_status_t handle_relay_disconnect_on_down(RyMngmt *sta);</span>
<span style="color: #00A000">+ftdm_status_t handle_relay_disconnect_on_error(RyMngmt *sta);</span>
/* in ftmod_sangoma_ss7_cfg.c */
int ft_to_sngss7_cfg_all(void);
<span style="color: #800080; font-weight: bold">@@ -484,20 +566,36 @@ int ftmod_ss7_cc_isap_config(int id);</span>
/* in ftmod_sangoma_ss7_cntrl.c */
int ft_to_sngss7_activate_all(void);
<span style="color: #A00000">-int ftmod_ss7_inhibit_mtplink(uint32_t id);</span>
<span style="color: #A00000">-int ftmod_ss7_uninhibit_mtplink(uint32_t id);</span>
<span style="color: #A00000">-int ftmod_ss7_activate_mtplink(uint32_t id);</span>
<span style="color: #A00000">-int ftmod_ss7_deactivate_mtplink(uint32_t id);</span>
<span style="color: #A00000">-int ftmod_ss7_deactivate2_mtplink(uint32_t id);</span>
<span style="color: #00A000">+int ftmod_ss7_inhibit_mtp3link(uint32_t id);</span>
<span style="color: #00A000">+int ftmod_ss7_uninhibit_mtp3link(uint32_t id);</span>
<span style="color: #00A000">+int ftmod_ss7_bind_mtp3link(uint32_t id);</span>
<span style="color: #00A000">+int ftmod_ss7_unbind_mtp3link(uint32_t id);</span>
<span style="color: #00A000">+int ftmod_ss7_activate_mtp3link(uint32_t id);</span>
<span style="color: #00A000">+int ftmod_ss7_deactivate_mtp3link(uint32_t id);</span>
<span style="color: #00A000">+int ftmod_ss7_deactivate2_mtp3link(uint32_t id);</span>
int ftmod_ss7_activate_mtplinkSet(uint32_t id);
int ftmod_ss7_deactivate_mtplinkSet(uint32_t id);
int ftmod_ss7_deactivate2_mtplinkSet(uint32_t id);
<span style="color: #A00000">-int ftmod_ss7_lpo_mtplink(uint32_t id);</span>
<span style="color: #A00000">-int ftmod_ss7_lpr_mtplink(uint32_t id);</span>
<span style="color: #00A000">+int ftmod_ss7_lpo_mtp3link(uint32_t id);</span>
<span style="color: #00A000">+int ftmod_ss7_lpr_mtp3link(uint32_t id);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+int ftmod_ss7_shutdown_isup(void);</span>
<span style="color: #00A000">+int ftmod_ss7_shutdown_mtp3(void);</span>
<span style="color: #00A000">+int ftmod_ss7_shutdown_mtp2(void);</span>
<span style="color: #00A000">+int ftmod_ss7_shutdown_relay(void);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+int ftmod_ss7_disable_grp_mtp3Link(uint32_t procId);</span>
<span style="color: #00A000">+int ftmod_ss7_enable_grp_mtp3Link(uint32_t procId);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+int ftmod_ss7_disable_grp_mtp2Link(uint32_t procId);</span>
/* in ftmod_sangoma_ss7_sta.c */
<span style="color: #A00000">-int ftmod_ss7_mtplink_sta(uint32_t id, SnMngmt *cfm);</span>
<span style="color: #00A000">+int ftmod_ss7_mtp1link_sta(uint32_t id, L1Mngmt *cfm);</span>
<span style="color: #00A000">+int ftmod_ss7_mtp2link_sta(uint32_t id, SdMngmt *cfm);</span>
<span style="color: #00A000">+int ftmod_ss7_mtp3link_sta(uint32_t id, SnMngmt *cfm);</span>
int ftmod_ss7_mtplinkSet_sta(uint32_t id, SnMngmt *cfm);
<span style="color: #00A000">+int ftmod_ss7_isup_intf_sta(uint32_t id, uint8_t *status);</span>
<span style="color: #00A000">+int ftmod_ss7_relay_status(uint32_t id, RyMngmt *cfm);</span>
/* in ftmod_sangoma_ss7_out.c */
<span style="color: #800080; font-weight: bold">@@ -607,6 +705,14 @@ ftdm_status_t clear_tx_grs_data(sngss7_chan_data_t *sngss7_info);</span>
ftdm_status_t encode_subAddrIE_nsap(const char *subAddr, char *subAddrIE, int type);
ftdm_status_t encode_subAddrIE_nat(const char *subAddr, char *subAddrIE, int type);
<span style="color: #00A000">+int find_mtp2_error_type_in_map(const char *err_type);</span>
<span style="color: #00A000">+int find_link_type_in_map(const char *linkType);</span>
<span style="color: #00A000">+int find_switch_type_in_map(const char *switchType);</span>
<span style="color: #00A000">+int find_ssf_type_in_map(const char *ssfType);</span>
<span style="color: #00A000">+int find_cic_cntrl_in_map(const char *cntrlType);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+ftdm_status_t check_status_of_all_isup_intf(void);</span>
<span style="color: #00A000">+</span>
/* in ftmod_sangoma_ss7_timers.c */
void handle_isup_t35(void *userdata);
/******************************************************************************/
<span style="color: #800080; font-weight: bold">@@ -739,6 +845,10 @@ void handle_isup_t35(void *userdata);</span>
#define sngss7_clear_flag(obj, flag) ((obj)->flags &= ~(flag))
#define sngss7_set_flag(obj, flag) ((obj)->flags |= (flag))
<span style="color: #00A000">+#define sngss7_test_ckt_flag(obj, flag) ((obj)->ckt_flags & flag)</span>
<span style="color: #00A000">+#define sngss7_clear_ckt_flag(obj, flag) ((obj)->ckt_flags &= ~(flag))</span>
<span style="color: #00A000">+#define sngss7_set_ckt_flag(obj, flag) ((obj)->ckt_flags |= (flag))</span>
<span style="color: #00A000">+</span>
#define sngss7_test_options(obj, option) ((obj)->options & option)
#define sngss7_clear_options(obj, option) ((obj)->options &= ~(option))
#define sngss7_set_options(obj, option) ((obj)->options |= (option))
<span style="color: #000080; font-weight: bold">diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c</span>
<span style="color: #000080; font-weight: bold">index ec8d7df..06b0b21 100644</span>
<span style="color: #A00000">--- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c</span>
<span style="color: #00A000">+++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c</span>
<span style="color: #800080; font-weight: bold">@@ -125,9 +125,9 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan)</span>
        iam.txMedReq.trMedReq.pres                         = PRSNT_NODEF;
        iam.txMedReq.trMedReq.val                         = ftdmchan->caller_data.bearer_capability;
<span style="color: #A00000">-        if ((g_ftdm_sngss7_data.cfg.isupIntf[sngss7_info->circuit->infId].switchType == LSI_SW_ANS88) ||</span>
<span style="color: #A00000">-                (g_ftdm_sngss7_data.cfg.isupIntf[sngss7_info->circuit->infId].switchType == LSI_SW_ANS92) ||</span>
<span style="color: #A00000">-                (g_ftdm_sngss7_data.cfg.isupIntf[sngss7_info->circuit->infId].switchType == LSI_SW_ANS95)) {</span>
<span style="color: #00A000">+        if ((g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].switchType == LSI_SW_ANS88) ||</span>
<span style="color: #00A000">+                (g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].switchType == LSI_SW_ANS92) ||</span>
<span style="color: #00A000">+                (g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].switchType == LSI_SW_ANS95)) {</span>
                /* include only if we're running ANSI */
                iam.fwdCallInd.transCallNInd.pres = PRSNT_NODEF;
<span style="color: #800080; font-weight: bold">@@ -178,7 +178,7 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan)</span>
                iam.usrServInfoA.rateMultiplier.pres        = PRSNT_NODEF;
                iam.usrServInfoA.rateMultiplier.val                = 0x1;                                /* 1x rate multipler */
        } /* if ANSI */
<span style="color: #A00000">-        </span>
<span style="color: #00A000">+</span>
        /* copy down the called number information */
        copy_cdPtyNum_to_sngss7 (&ftdmchan->caller_data, &iam.cdPtyNum);
        
<span style="color: #800080; font-weight: bold">@@ -192,7 +192,7 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan)</span>
                SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Calling NADI value \"%s\"\n", clg_nadi);
                iam.cgPtyNum.natAddrInd.val        = atoi(clg_nadi);
        } else {
<span style="color: #A00000">-                iam.cgPtyNum.natAddrInd.val        = g_ftdm_sngss7_data.cfg.isupIntf[sngss7_info->circuit->infId].clg_nadi;</span>
<span style="color: #00A000">+                iam.cgPtyNum.natAddrInd.val        = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].clg_nadi;</span>
                SS7_DEBUG_CHAN(ftdmchan,"No user supplied NADI value found for CLG, using \"%d\"\n", iam.cgPtyNum.natAddrInd.val);
        }
<span style="color: #800080; font-weight: bold">@@ -201,7 +201,7 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan)</span>
                SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Called NADI value \"%s\"\n", cld_nadi);
                iam.cdPtyNum.natAddrInd.val        = atoi(cld_nadi);
        } else {
<span style="color: #A00000">-                iam.cdPtyNum.natAddrInd.val        = g_ftdm_sngss7_data.cfg.isupIntf[sngss7_info->circuit->infId].cld_nadi;</span>
<span style="color: #00A000">+                iam.cdPtyNum.natAddrInd.val        = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].cld_nadi;</span>
                SS7_DEBUG_CHAN(ftdmchan,"No user supplied NADI value found for CLD, using \"%d\"\n", iam.cdPtyNum.natAddrInd.val);
        }
<span style="color: #800080; font-weight: bold">@@ -310,7 +310,6 @@ void ft_to_sngss7_acm (ftdm_channel_t * ftdmchan)</span>
        SS7_FUNC_TRACE_ENTER (__FUNCTION__);
        
        sngss7_chan_data_t        *sngss7_info = ftdmchan->call_data;
<span style="color: #A00000">-        sng_isup_inf_t                *isup_intf = &g_ftdm_sngss7_data.cfg.isupIntf[sngss7_info->circuit->infId];</span>
        SiCnStEvnt acm;
        
        memset (&acm, 0x0, sizeof (acm));
<span style="color: #800080; font-weight: bold">@@ -360,8 +359,8 @@ void ft_to_sngss7_acm (ftdm_channel_t * ftdmchan)</span>
        acm.bckCallInd.sccpMethInd.val                = SCCPMTH_NOIND;
        /* fill in any optional parameters */
<span style="color: #A00000">-        if (sngss7_test_options(isup_intf, SNGSS7_ACM_OBCI_BITA)) {</span>
<span style="color: #A00000">-                SS7_DEBUG_CHAN(ftdmchan, "Found ACM_OBCI_BITA flag:0x%X\n", isup_intf->options);</span>
<span style="color: #00A000">+        if (sngss7_test_options(&g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id], SNGSS7_ACM_OBCI_BITA)) {</span>
<span style="color: #00A000">+                SS7_DEBUG_CHAN(ftdmchan, "Found ACM_OBCI_BITA flag:0x%X\n", g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].options);</span>
                acm.optBckCalInd.eh.pres                                = PRSNT_NODEF;
                acm.optBckCalInd.inbndInfoInd.pres                = PRSNT_NODEF;
                acm.optBckCalInd.inbndInfoInd.val                = 0x1;
<span style="color: #000080; font-weight: bold">diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_relay.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_relay.c</span>
new file mode 100644
<span style="color: #000080; font-weight: bold">index 0000000..05ea69e</span>
<span style="color: #A00000">--- /dev/null</span>
<span style="color: #00A000">+++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_relay.c</span>
<span style="color: #800080; font-weight: bold">@@ -0,0 +1,318 @@</span>
<span style="color: #00A000">+/*</span>
<span style="color: #00A000">+ * Copyright (c) 2009|Konrad Hammel <konrad@sangoma.com></span>
<span style="color: #00A000">+ * All rights reserved.</span>
<span style="color: #00A000">+ *</span>
<span style="color: #00A000">+ * Redistribution and use in source and binary forms|with or without</span>
<span style="color: #00A000">+ * modification|are permitted provided that the following conditions</span>
<span style="color: #00A000">+ * are met:</span>
<span style="color: #00A000">+ *</span>
<span style="color: #00A000">+ * * Redistributions of source code must retain the above copyright</span>
<span style="color: #00A000">+ * notice|this list of conditions and the following disclaimer.</span>
<span style="color: #00A000">+ *</span>
<span style="color: #00A000">+ * * Redistributions in binary form must reproduce the above copyright</span>
<span style="color: #00A000">+ * notice|this list of conditions and the following disclaimer in the</span>
<span style="color: #00A000">+ * documentation and/or other materials provided with the distribution.</span>
<span style="color: #00A000">+ *</span>
<span style="color: #00A000">+ * * Neither the name of the original author; nor the names of any contributors</span>
<span style="color: #00A000">+ * may be used to endorse or promote products derived from this software</span>
<span style="color: #00A000">+ * without specific prior written permission.</span>
<span style="color: #00A000">+ *</span>
<span style="color: #00A000">+ *</span>
<span style="color: #00A000">+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS</span>
<span style="color: #00A000">+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES|INCLUDING|BUT NOT</span>
<span style="color: #00A000">+ * LIMITED TO|THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR</span>
<span style="color: #00A000">+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER</span>
<span style="color: #00A000">+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT|INDIRECT|INCIDENTAL|SPECIAL,</span>
<span style="color: #00A000">+ * EXEMPLARY|OR CONSEQUENTIAL DAMAGES (INCLUDING|BUT NOT LIMITED TO,</span>
<span style="color: #00A000">+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE|DATA|OR</span>
<span style="color: #00A000">+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF</span>
<span style="color: #00A000">+ * LIABILITY|WHETHER IN CONTRACT|STRICT LIABILITY|OR TORT (INCLUDING</span>
<span style="color: #00A000">+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS</span>
<span style="color: #00A000">+ * SOFTWARE|EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span>
<span style="color: #00A000">+ */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/* INCLUDE ********************************************************************/</span>
<span style="color: #00A000">+#include "ftmod_sangoma_ss7_main.h"</span>
<span style="color: #00A000">+/******************************************************************************/</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/* DEFINES ********************************************************************/</span>
<span style="color: #00A000">+/******************************************************************************/</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/* GLOBALS ********************************************************************/</span>
<span style="color: #00A000">+/******************************************************************************/</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/* PROTOTYPES *****************************************************************/</span>
<span style="color: #00A000">+ftdm_status_t handle_relay_connect(RyMngmt *sta);</span>
<span style="color: #00A000">+ftdm_status_t handle_relay_disconnect(RyMngmt *sta);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+static ftdm_status_t enable_all_ckts_for_relay(void);</span>
<span style="color: #00A000">+static ftdm_status_t reconfig_all_ckts_for_relay(void);</span>
<span style="color: #00A000">+static ftdm_status_t disable_all_ckts_for_relay(void);</span>
<span style="color: #00A000">+static ftdm_status_t block_all_ckts_for_relay(uint32_t procId);</span>
<span style="color: #00A000">+static ftdm_status_t disable_all_sigs_for_relay(uint32_t procId);</span>
<span style="color: #00A000">+static ftdm_status_t disble_all_mtp2_sigs_for_relay(void);</span>
<span style="color: #00A000">+/******************************************************************************/</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/* FUNCTIONS ******************************************************************/</span>
<span style="color: #00A000">+ftdm_status_t handle_relay_connect(RyMngmt *sta)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        sng_relay_t        *sng_relay = &g_ftdm_sngss7_data.cfg.relay[sta->t.usta.s.ryUpUsta.id];</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* test if this is the first time the channel comes up */</span>
<span style="color: #00A000">+        if (!sngss7_test_flag(sng_relay, SNGSS7_RELAY_INIT)) {</span>
<span style="color: #00A000">+                SS7_DEBUG("Relay Channel %d initial connection UP\n", sng_relay->id);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                /* mark the channel as being up */</span>
<span style="color: #00A000">+                sngss7_set_flag(sng_relay, SNGSS7_RELAY_INIT);</span>
<span style="color: #00A000">+        } else {</span>
<span style="color: #00A000">+                SS7_DEBUG("Relay Channel %d connection UP\n", sng_relay->id);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                /* react based on type of channel */</span>
<span style="color: #00A000">+                switch (sng_relay->type) {</span>
<span style="color: #00A000">+                /******************************************************************/</span>
<span style="color: #00A000">+                case (LRY_CT_TCP_CLIENT):</span>
<span style="color: #00A000">+                        /* reconfigure all ISUP ckts, since the main system would have lost all configs */</span>
<span style="color: #00A000">+                        if (reconfig_all_ckts_for_relay()) {</span>
<span style="color: #00A000">+                                SS7_ERROR("Failed to reconfigure ISUP Ckts!\n");</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                                /* we're done....this is very bad! */</span>
<span style="color: #00A000">+                        } else {                                </span>
<span style="color: #00A000">+                                enable_all_ckts_for_relay();</span>
<span style="color: #00A000">+                        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                        break;</span>
<span style="color: #00A000">+                /******************************************************************/</span>
<span style="color: #00A000">+                case (LRY_CT_TCP_SERVER):</span>
<span style="color: #00A000">+                        /*unblock_all_ckts_for_relay(sta->t.usta.s.ryErrUsta.errPid);*/</span>
<span style="color: #00A000">+                        ftmod_ss7_enable_grp_mtp3Link(sta->t.usta.s.ryUpUsta.id);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                        break;</span>
<span style="color: #00A000">+                /******************************************************************/</span>
<span style="color: #00A000">+                default:</span>
<span style="color: #00A000">+                        break;</span>
<span style="color: #00A000">+                /******************************************************************/</span>
<span style="color: #00A000">+                } /* switch (g_ftdm_sngss7_data.cfg.relay[sta->t.usta.s.ryUpUsta.id].type) */</span>
<span style="color: #00A000">+        } /* intial up? */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return FTDM_SUCCESS;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/******************************************************************************/</span>
<span style="color: #00A000">+ftdm_status_t handle_relay_disconnect_on_error(RyMngmt *sta)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* check which procId is in error, if it is 1, disable the ckts */</span>
<span style="color: #00A000">+        if (sta->t.usta.s.ryErrUsta.errPid == 1 ) {</span>
<span style="color: #00A000">+                disable_all_ckts_for_relay();</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                disble_all_mtp2_sigs_for_relay();</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* check if the channel is a server, means we just lost a MGW */</span>
<span style="color: #00A000">+        if (g_ftdm_sngss7_data.cfg.relay[sta->t.usta.s.ryErrUsta.errPid].type == LRY_CT_TCP_SERVER) {</span>
<span style="color: #00A000">+                block_all_ckts_for_relay(sta->t.usta.s.ryErrUsta.errPid);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                disable_all_sigs_for_relay(sta->t.usta.s.ryErrUsta.errPid);</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return FTDM_SUCCESS;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/******************************************************************************/</span>
<span style="color: #00A000">+ftdm_status_t handle_relay_disconnect_on_down(RyMngmt *sta)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* check if the channel is a server, means we just lost a MGW */</span>
<span style="color: #00A000">+        if (g_ftdm_sngss7_data.cfg.relay[sta->t.usta.s.ryUpUsta.id].type == LRY_CT_TCP_SERVER) {</span>
<span style="color: #00A000">+                block_all_ckts_for_relay(sta->t.usta.s.ryUpUsta.id);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                disable_all_sigs_for_relay(sta->t.usta.s.ryUpUsta.id);</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return FTDM_SUCCESS;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/******************************************************************************/</span>
<span style="color: #00A000">+ftdm_status_t disable_all_ckts_for_relay(void)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        sngss7_chan_data_t        *sngss7_info = NULL;</span>
<span style="color: #00A000">+        ftdm_channel_t                *ftdmchan = NULL;</span>
<span style="color: #00A000">+        int                                        x;        </span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        SS7_INFO("Disabling all ckts becuase of Relay loss\n");</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1;</span>
<span style="color: #00A000">+        while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) {</span>
<span style="color: #00A000">+        /**********************************************************************/</span>
<span style="color: #00A000">+                /* make sure this is voice channel */</span>
<span style="color: #00A000">+                if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) {</span>
<span style="color: #00A000">+        </span>
<span style="color: #00A000">+                        /* get the ftdmchan and ss7_chan_data from the circuit */</span>
<span style="color: #00A000">+                        if (extract_chan_data(g_ftdm_sngss7_data.cfg.isupCkt[x].id, &sngss7_info, &ftdmchan)) {</span>
<span style="color: #00A000">+                                SS7_ERROR("Failed to extract channel data for circuit = %d!\n", g_ftdm_sngss7_data.cfg.isupCkt[x].id);</span>
<span style="color: #00A000">+                                x++;</span>
<span style="color: #00A000">+                                continue;</span>
<span style="color: #00A000">+                        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                        /* throw the relay_down flag */</span>
<span style="color: #00A000">+                        sngss7_set_ckt_flag(sngss7_info, FLAG_RELAY_DOWN);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                        /* throw the channel infId status flags to PAUSED ... they will be executed next process cycle */</span>
<span style="color: #00A000">+                        sngss7_clear_ckt_flag(sngss7_info, FLAG_INFID_RESUME);</span>
<span style="color: #00A000">+                        sngss7_set_ckt_flag(sngss7_info, FLAG_INFID_PAUSED);</span>
<span style="color: #00A000">+                } /* if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                /* move along */</span>
<span style="color: #00A000">+                x++;</span>
<span style="color: #00A000">+        /**********************************************************************/</span>
<span style="color: #00A000">+        } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return FTDM_SUCCESS;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/******************************************************************************/</span>
<span style="color: #00A000">+ftdm_status_t enable_all_ckts_for_relay(void)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        sngss7_chan_data_t        *sngss7_info = NULL;</span>
<span style="color: #00A000">+        sng_isup_inf_t                *sngIntf = NULL;</span>
<span style="color: #00A000">+        ftdm_channel_t                *ftdmchan = NULL;</span>
<span style="color: #00A000">+        int                                        x;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        SS7_INFO("Enabling all ckts becuase of Relay connection\n");</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1;</span>
<span style="color: #00A000">+        while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) {</span>
<span style="color: #00A000">+        /**********************************************************************/</span>
<span style="color: #00A000">+                /* make sure this is voice channel */</span>
<span style="color: #00A000">+                if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) {</span>
<span style="color: #00A000">+        </span>
<span style="color: #00A000">+                        /* get the ftdmchan and ss7_chan_data from the circuit */</span>
<span style="color: #00A000">+                        if (extract_chan_data(g_ftdm_sngss7_data.cfg.isupCkt[x].id, &sngss7_info, &ftdmchan)) {</span>
<span style="color: #00A000">+                                SS7_ERROR("Failed to extract channel data for circuit = %d!\n", g_ftdm_sngss7_data.cfg.isupCkt[x].id);</span>
<span style="color: #00A000">+                                x++;</span>
<span style="color: #00A000">+                                continue;</span>
<span style="color: #00A000">+                        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                        /* bring the relay_down flag down */</span>
<span style="color: #00A000">+                        sngss7_clear_ckt_flag(sngss7_info, FLAG_RELAY_DOWN);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                        sngIntf = &g_ftdm_sngss7_data.cfg.isupIntf[g_ftdm_sngss7_data.cfg.isupCkt[x].infId];</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                        /* check if the interface is paused or resumed */</span>
<span style="color: #00A000">+                        if (sngss7_test_flag(sngIntf, SNGSS7_PAUSED)) {</span>
<span style="color: #00A000">+                                /* don't bring the channel resume flag up...the interface is down */</span>
<span style="color: #00A000">+                                SS7_DEBUG_CHAN(ftdmchan, "ISUP interface (%d) set to paused, not resuming channel\n", sngIntf->id);</span>
<span style="color: #00A000">+                        } else {</span>
<span style="color: #00A000">+                                SS7_DEBUG_CHAN(ftdmchan, "ISUP interface (%d) set to resume, resuming channel\n", sngIntf->id);</span>
<span style="color: #00A000">+                                /* throw the channel infId status flags to PAUSED ... they will be executed next process cycle */</span>
<span style="color: #00A000">+                                sngss7_set_ckt_flag(sngss7_info, FLAG_INFID_RESUME);</span>
<span style="color: #00A000">+                                sngss7_set_ckt_flag(sngss7_info, FLAG_INFID_PAUSED);</span>
<span style="color: #00A000">+                        }</span>
<span style="color: #00A000">+                } /* if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                /* move along */</span>
<span style="color: #00A000">+                x++;</span>
<span style="color: #00A000">+        /**********************************************************************/</span>
<span style="color: #00A000">+        } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return FTDM_SUCCESS;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/******************************************************************************/</span>
<span style="color: #00A000">+ftdm_status_t reconfig_all_ckts_for_relay(void)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+#if 1</span>
<span style="color: #00A000">+        int x;</span>
<span style="color: #00A000">+        int ret;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1;</span>
<span style="color: #00A000">+        while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) {</span>
<span style="color: #00A000">+                if ( g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) {</span>
<span style="color: #00A000">+        </span>
<span style="color: #00A000">+                        ret = ftmod_ss7_isup_ckt_config(x);</span>
<span style="color: #00A000">+                        if (ret) {</span>
<span style="color: #00A000">+                                SS7_CRITICAL("ISUP CKT %d configuration FAILED (%d)!\n", x, ret);</span>
<span style="color: #00A000">+                                return 1;</span>
<span style="color: #00A000">+                        } else {</span>
<span style="color: #00A000">+                                SS7_INFO("ISUP CKT %d configuration DONE!\n", x);</span>
<span style="color: #00A000">+                        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                } /* if ( g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                /* set the SNGSS7_CONFIGURED flag */</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.isupCkt[x].flags |= SNGSS7_CONFIGURED;</span>
<span style="color: #00A000">+                </span>
<span style="color: #00A000">+                x++;</span>
<span style="color: #00A000">+        } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) */</span>
<span style="color: #00A000">+#endif</span>
<span style="color: #00A000">+        return FTDM_SUCCESS;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/******************************************************************************/</span>
<span style="color: #00A000">+ftdm_status_t block_all_ckts_for_relay(uint32_t procId)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        int x;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        SS7_INFO("BLOcking all ckts on ProcID = %d\n", procId);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* we just lost connection to this procId, send out a block for all these circuits */</span>
<span style="color: #00A000">+        x = (procId * 1000) + 1;</span>
<span style="color: #00A000">+        while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) {</span>
<span style="color: #00A000">+        /**************************************************************************/</span>
<span style="color: #00A000">+                if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) {</span>
<span style="color: #00A000">+                        /* send out a BLO */</span>
<span style="color: #00A000">+                        sng_cc_sta_request (1,</span>
<span style="color: #00A000">+                                                                0,</span>
<span style="color: #00A000">+                                                                0,</span>
<span style="color: #00A000">+                                                                g_ftdm_sngss7_data.cfg.isupCkt[x].id,</span>
<span style="color: #00A000">+                                                                0, </span>
<span style="color: #00A000">+                                                                SIT_STA_CIRBLOREQ, </span>
<span style="color: #00A000">+                                                                NULL);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                } /* if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                /* move along */</span>
<span style="color: #00A000">+                x++;</span>
<span style="color: #00A000">+        /**************************************************************************/</span>
<span style="color: #00A000">+        } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return FTDM_SUCCESS;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/******************************************************************************/</span>
<span style="color: #00A000">+ftdm_status_t disable_all_sigs_for_relay(uint32_t procId)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        SS7_INFO("Disalbing all sig links on ProcID = %d\n", procId);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        ftmod_ss7_disable_grp_mtp3Link(procId);</span>
<span style="color: #00A000">+        </span>
<span style="color: #00A000">+        return FTDM_SUCCESS;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/******************************************************************************/</span>
<span style="color: #00A000">+ftdm_status_t disble_all_mtp2_sigs_for_relay(void)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        /* check if there is a local mtp2 link*/</span>
<span style="color: #00A000">+        if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP2)) {</span>
<span style="color: #00A000">+                SS7_INFO("Disalbing all mtp2 sig links on local system\n");</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                ftmod_ss7_disable_grp_mtp2Link(1);</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return FTDM_SUCCESS;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/******************************************************************************/</span>
<span style="color: #00A000">+/* For Emacs:</span>
<span style="color: #00A000">+ * Local Variables:</span>
<span style="color: #00A000">+ * mode:c</span>
<span style="color: #00A000">+ * indent-tabs-mode:t</span>
<span style="color: #00A000">+ * tab-width:4</span>
<span style="color: #00A000">+ * c-basic-offset:4</span>
<span style="color: #00A000">+ * End:</span>
<span style="color: #00A000">+ * For VIM:</span>
<span style="color: #00A000">+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:</span>
<span style="color: #00A000">+ */</span>
<span style="color: #00A000">+/******************************************************************************/</span>
<span style="color: #000080; font-weight: bold">diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_sta.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_sta.c</span>
<span style="color: #000080; font-weight: bold">index 1235238..2f507a2 100644</span>
<span style="color: #A00000">--- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_sta.c</span>
<span style="color: #00A000">+++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_sta.c</span>
<span style="color: #800080; font-weight: bold">@@ -42,12 +42,43 @@</span>
/******************************************************************************/
/* PROTOTYPES *****************************************************************/
<span style="color: #A00000">-int ftmod_ss7_mtplink_sta(uint32_t id, SnMngmt *cfm);</span>
<span style="color: #00A000">+int ftmod_ss7_mtp1link_sta(uint32_t id, L1Mngmt *cfm);</span>
<span style="color: #00A000">+int ftmod_ss7_mtp2link_sta(uint32_t id, SdMngmt *cfm);</span>
<span style="color: #00A000">+int ftmod_ss7_mtp3link_sta(uint32_t id, SnMngmt *cfm);</span>
int ftmod_ss7_mtplinkSet_sta(uint32_t id, SnMngmt *cfm);
<span style="color: #00A000">+int ftmod_ss7_isup_intf_sta(uint32_t id, uint8_t *status);</span>
<span style="color: #00A000">+int ftmod_ss7_relay_status(uint32_t id, RyMngmt *cfm);</span>
/******************************************************************************/
/* FUNCTIONS ******************************************************************/
<span style="color: #A00000">-int ftmod_ss7_mtplink_sta(uint32_t id, SnMngmt *cfm)</span>
<span style="color: #00A000">+int ftmod_ss7_mtp1link_sta(uint32_t id, L1Mngmt *cfm)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return 1;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/******************************************************************************/</span>
<span style="color: #00A000">+int ftmod_ss7_mtp2link_sta(uint32_t id, SdMngmt *cfm)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        SdMngmt        sta;</span>
<span style="color: #00A000">+        Pst                pst;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        memset(&sta, 0x0, sizeof(sta));</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* initalize the post structure */</span>
<span style="color: #00A000">+        smPstInit(&pst);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* insert the destination Entity */</span>
<span style="color: #00A000">+        pst.dstEnt = ENTSD;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        sta.hdr.elmId.elmnt                 = STDLSAP;</span>
<span style="color: #00A000">+        sta.hdr.elmId.elmntInst1        = g_ftdm_sngss7_data.cfg.mtp2Link[id].id;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return(sng_sta_mtp2(&pst, &sta, cfm));</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/******************************************************************************/</span>
<span style="color: #00A000">+int ftmod_ss7_mtp3link_sta(uint32_t id, SnMngmt *cfm)</span>
{
        SnMngmt        sta;
        Pst                pst;
<span style="color: #800080; font-weight: bold">@@ -60,8 +91,13 @@ int ftmod_ss7_mtplink_sta(uint32_t id, SnMngmt *cfm)</span>
        /* insert the destination Entity */
        pst.dstEnt = ENTSN;
<span style="color: #00A000">+        /* check the for the correct ProcId and make sure it goes to the right system */</span>
<span style="color: #00A000">+        if (g_ftdm_sngss7_data.cfg.procId != 1) {</span>
<span style="color: #00A000">+                pst.dstProcId = 1;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
        sta.hdr.elmId.elmnt                 = STDLSAP;
<span style="color: #A00000">-        sta.hdr.elmId.elmntInst1        = g_ftdm_sngss7_data.cfg.mtpLink[id].id;</span>
<span style="color: #00A000">+        sta.hdr.elmId.elmntInst1        = g_ftdm_sngss7_data.cfg.mtp3Link[id].id;</span>
        return(sng_sta_mtp3(&pst, &sta, cfm));
}
<span style="color: #800080; font-weight: bold">@@ -80,13 +116,77 @@ int ftmod_ss7_mtplinkSet_sta(uint32_t id, SnMngmt *cfm)</span>
        /* insert the destination Entity */
        pst.dstEnt = ENTSN;
<span style="color: #00A000">+        /* check the for the correct ProcId and make sure it goes to the right system */</span>
<span style="color: #00A000">+        if (g_ftdm_sngss7_data.cfg.procId != 1) {</span>
<span style="color: #00A000">+                pst.dstProcId = 1;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
        sta.hdr.elmId.elmnt                 = STLNKSET;
        sta.hdr.elmId.elmntInst1        = g_ftdm_sngss7_data.cfg.mtpLinkSet[id].id;
        sta.hdr.elmId.elmntInst2        = g_ftdm_sngss7_data.cfg.mtpLinkSet[id].links[0];
        return(sng_sta_mtp3(&pst, &sta, cfm));
}
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/******************************************************************************/</span>
<span style="color: #00A000">+int ftmod_ss7_isup_intf_sta(uint32_t id, uint8_t *status)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        SiMngmt        sta;</span>
<span style="color: #00A000">+        SiMngmt cfm;</span>
<span style="color: #00A000">+        Pst                pst;</span>
<span style="color: #00A000">+        int                ret;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        memset(&sta, 0x0, sizeof(sta));</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* initalize the post structure */</span>
<span style="color: #00A000">+        smPstInit(&pst);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* insert the destination Entity */</span>
<span style="color: #00A000">+        pst.dstEnt = ENTSI;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* check the for the correct ProcId and make sure it goes to the right system */</span>
<span style="color: #00A000">+        if (g_ftdm_sngss7_data.cfg.procId != 1) {</span>
<span style="color: #00A000">+                pst.dstProcId = 1;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* request the status of an inftId */</span>
<span style="color: #00A000">+        sta.hdr.entId.ent                        = ENTSI;</span>
<span style="color: #00A000">+        sta.hdr.entId.inst                        = S_INST;</span>
<span style="color: #00A000">+        sta.hdr.msgType                                = TSSTA;</span>
<span style="color: #00A000">+        sta.hdr.elmId.elmnt                 = SI_STINTF;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        sta.t.ssta.elmntId.intfId = id;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        ret = sng_sta_isup(&pst, &sta, &cfm);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        *status = cfm.t.ssta.cfm.s.intf.state;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return(ret);</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
/******************************************************************************/
<span style="color: #00A000">+int ftmod_ss7_relay_status(uint32_t id, RyMngmt *cfm)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        RyMngmt        sta;</span>
<span style="color: #00A000">+        Pst                pst;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        memset(&sta, 0x0, sizeof(sta));</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* initalize the post structure */</span>
<span style="color: #00A000">+        smPstInit(&pst);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* insert the destination Entity */</span>
<span style="color: #00A000">+        pst.dstEnt = ENTRY;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        sta.hdr.entId.ent                        = ENTRY;</span>
<span style="color: #00A000">+        sta.hdr.entId.inst                        = S_INST;</span>
<span style="color: #00A000">+        sta.hdr.msgType                                = TSSTA;</span>
<span style="color: #00A000">+        sta.hdr.elmId.elmnt                 = STCHSTA;</span>
<span style="color: #00A000">+        sta.hdr.elmId.elmntInst1        = id;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return(sng_sta_relay(&pst, &sta, cfm));</span>
<span style="color: #00A000">+}</span>
/******************************************************************************/
/* For Emacs:
<span style="color: #000080; font-weight: bold">diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c</span>
<span style="color: #000080; font-weight: bold">index 23617c9..683caf2 100644</span>
<span style="color: #A00000">--- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c</span>
<span style="color: #00A000">+++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c</span>
<span style="color: #800080; font-weight: bold">@@ -75,6 +75,14 @@ ftdm_status_t clear_tx_grs_data(sngss7_chan_data_t *sngss7_info);</span>
ftdm_status_t encode_subAddrIE_nsap(const char *subAddr, char *subAddrIE, int type);
ftdm_status_t encode_subAddrIE_nat(const char *subAddr, char *subAddrIE, int type);
<span style="color: #00A000">+</span>
<span style="color: #00A000">+int find_mtp2_error_type_in_map(const char *err_type);</span>
<span style="color: #00A000">+int find_link_type_in_map(const char *linkType);</span>
<span style="color: #00A000">+int find_switch_type_in_map(const char *switchType);</span>
<span style="color: #00A000">+int find_ssf_type_in_map(const char *ssfType);</span>
<span style="color: #00A000">+int find_cic_cntrl_in_map(const char *cntrlType);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+ftdm_status_t check_status_of_all_isup_intf(void);</span>
/******************************************************************************/
/* FUNCTIONS ******************************************************************/
<span style="color: #800080; font-weight: bold">@@ -432,7 +440,7 @@ int check_cics_in_range(sngss7_chan_data_t *sngss7_info)</span>
                        }
                        /* check if the channel still has the reset flag done is up */
<span style="color: #A00000">-                        if (!sngss7_test_flag(tmp_sngss7_info, FLAG_GRP_RESET_RX_DN)) {</span>
<span style="color: #00A000">+                        if (!sngss7_test_ckt_flag(tmp_sngss7_info, FLAG_GRP_RESET_RX_DN)) {</span>
                                SS7_DEBUG_CHAN(tmp_ftdmchan, "[CIC:%d] Still processing reset...\n", tmp_sngss7_info->circuit->cic);
                                return 0;
                        }
<span style="color: #800080; font-weight: bold">@@ -475,19 +483,19 @@ ftdm_status_t extract_chan_data(uint32_t circuit, sngss7_chan_data_t **sngss7_in</span>
int check_for_reset(sngss7_chan_data_t *sngss7_info)
{
<span style="color: #A00000">-        if (sngss7_test_flag(sngss7_info,FLAG_RESET_RX)) {</span>
<span style="color: #00A000">+        if (sngss7_test_ckt_flag(sngss7_info,FLAG_RESET_RX)) {</span>
                return 1;
        }
        
<span style="color: #A00000">-        if (sngss7_test_flag(sngss7_info,FLAG_RESET_TX)) {</span>
<span style="color: #00A000">+        if (sngss7_test_ckt_flag(sngss7_info,FLAG_RESET_TX)) {</span>
                return 1;
        }
        
<span style="color: #A00000">-        if (sngss7_test_flag(sngss7_info,FLAG_GRP_RESET_RX)) {</span>
<span style="color: #00A000">+        if (sngss7_test_ckt_flag(sngss7_info,FLAG_GRP_RESET_RX)) {</span>
                return 1;
        }
        
<span style="color: #A00000">-        if (sngss7_test_flag(sngss7_info,FLAG_GRP_RESET_TX)) {</span>
<span style="color: #00A000">+        if (sngss7_test_ckt_flag(sngss7_info,FLAG_GRP_RESET_TX)) {</span>
                return 1;
        }
<span style="color: #800080; font-weight: bold">@@ -498,11 +506,13 @@ int check_for_reset(sngss7_chan_data_t *sngss7_info)</span>
/******************************************************************************/
unsigned long get_unique_id(void)
{
<span style="color: #00A000">+        int        procId = sng_get_procId(); </span>
<span style="color: #A00000">-        if (sngss7_id < 420000000) {</span>
<span style="color: #00A000">+        /* id values are between (procId * 1,000,000) and ((procId + 1) * 1,000,000) */ </span>
<span style="color: #00A000">+        if (sngss7_id < ((procId + 1) * 1000000) ) {</span>
                sngss7_id++;
        } else {
<span style="color: #A00000">-                sngss7_id = 1;</span>
<span style="color: #00A000">+                sngss7_id = procId * 1000000;</span>
        }
        return(sngss7_id);
<span style="color: #800080; font-weight: bold">@@ -525,7 +535,7 @@ ftdm_status_t check_if_rx_grs_started(ftdm_span_t *ftdmspan)</span>
                }
                /* check if the GRP_RESET_RX flag is already up */
<span style="color: #A00000">-                if (sngss7_test_flag(sngss7_info, FLAG_GRP_RESET_RX)) {</span>
<span style="color: #00A000">+                if (sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_RESET_RX)) {</span>
                        /* we have already processed this channel...move along */
                        continue;
                }
<span style="color: #800080; font-weight: bold">@@ -543,7 +553,7 @@ ftdm_status_t check_if_rx_grs_started(ftdm_span_t *ftdmspan)</span>
                                (g_ftdm_sngss7_data.cfg.isupCkt[sngss7_span->rx_grs.circuit].cic + sngss7_span->rx_grs.range));
                /* flag the channel as having received a reset */
<span style="color: #A00000">-                sngss7_set_flag(sngss7_info, FLAG_GRP_RESET_RX);</span>
<span style="color: #00A000">+                sngss7_set_ckt_flag(sngss7_info, FLAG_GRP_RESET_RX);</span>
                switch (ftdmchan->state) {
                /**************************************************************************/
<span style="color: #800080; font-weight: bold">@@ -598,10 +608,10 @@ ftdm_status_t check_if_rx_grs_processed(ftdm_span_t *ftdmspan)</span>
                /* check if there is a state change pending on the channel */
                if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE)) {
                        /* check the state to the GRP_RESET_RX_DN flag */
<span style="color: #A00000">-                        if (!sngss7_test_flag(sngss7_info, FLAG_GRP_RESET_RX_DN)) {</span>
<span style="color: #00A000">+                        if (!sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_RESET_RX_DN)) {</span>
                                /* this channel is still resetting...do nothing */
                                        goto GRS_UNLOCK_ALL;
<span style="color: #A00000">-                        } /* if (!sngss7_test_flag(sngss7_info, FLAG_GRP_RESET_RX_DN)) */</span>
<span style="color: #00A000">+                        } /* if (!sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_RESET_RX_DN)) */</span>
                } else {
                        /* state change pending */
                        goto GRS_UNLOCK_ALL;
<span style="color: #800080; font-weight: bold">@@ -625,16 +635,16 @@ ftdm_status_t check_if_rx_grs_processed(ftdm_span_t *ftdmspan)</span>
                }
                /* throw the GRP reset flag complete flag */
<span style="color: #A00000">-                sngss7_set_flag(sngss7_info, FLAG_GRP_RESET_RX_CMPLT);</span>
<span style="color: #00A000">+                sngss7_set_ckt_flag(sngss7_info, FLAG_GRP_RESET_RX_CMPLT);</span>
                /* move the channel to the down state */
                ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN);
                /* update the status map if the ckt is in blocked state */
<span style="color: #A00000">-                if ((sngss7_test_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX)) ||</span>
<span style="color: #A00000">-                        (sngss7_test_flag(sngss7_info, FLAG_CKT_MN_BLOCK_TX)) ||</span>
<span style="color: #A00000">-                        (sngss7_test_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX)) ||</span>
<span style="color: #A00000">-                        (sngss7_test_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX))) {</span>
<span style="color: #00A000">+                if ((sngss7_test_ckt_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX)) ||</span>
<span style="color: #00A000">+                        (sngss7_test_ckt_flag(sngss7_info, FLAG_CKT_MN_BLOCK_TX)) ||</span>
<span style="color: #00A000">+                        (sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX)) ||</span>
<span style="color: #00A000">+                        (sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX))) {</span>
                
                        sngss7_span->rx_grs.status[byte] = (sngss7_span->rx_grs.status[byte] | (1 << bit));
                } /* if blocked */
<span style="color: #800080; font-weight: bold">@@ -679,7 +689,7 @@ ftdm_status_t check_if_rx_gra_started(ftdm_span_t *ftdmspan)</span>
                }
                /* check if the channel is already procoessing the GRA */
<span style="color: #A00000">-                if (sngss7_test_flag(sngss7_info, FLAG_GRP_RESET_TX_RSP)) {</span>
<span style="color: #00A000">+                if (sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_RESET_TX_RSP)) {</span>
                        /* move along */
                        continue;
                }
<span style="color: #800080; font-weight: bold">@@ -701,7 +711,7 @@ ftdm_status_t check_if_rx_gra_started(ftdm_span_t *ftdmspan)</span>
                case FTDM_CHANNEL_STATE_RESTART:
                        
                        /* throw the FLAG_RESET_TX_RSP to indicate we have acknowledgement from the remote side */
<span style="color: #A00000">-                        sngss7_set_flag(sngss7_info, FLAG_GRP_RESET_TX_RSP);</span>
<span style="color: #00A000">+                        sngss7_set_ckt_flag(sngss7_info, FLAG_GRP_RESET_TX_RSP);</span>
                        /* go to DOWN */
                        ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN);
<span style="color: #800080; font-weight: bold">@@ -720,7 +730,7 @@ ftdm_status_t check_if_rx_gra_started(ftdm_span_t *ftdmspan)</span>
                case FTDM_CHANNEL_STATE_HANGUP_COMPLETE:
                        
                        /* throw the FLAG_RESET_TX_RSP to indicate we have acknowledgement from the remote side */
<span style="color: #A00000">-                        sngss7_set_flag(sngss7_info, FLAG_GRP_RESET_TX_RSP);</span>
<span style="color: #00A000">+                        sngss7_set_ckt_flag(sngss7_info, FLAG_GRP_RESET_TX_RSP);</span>
                        break;
                /**********************************************************************/
<span style="color: #800080; font-weight: bold">@@ -775,7 +785,7 @@ ftdm_status_t check_for_res_sus_flag(ftdm_span_t *ftdmspan)</span>
                sigev.channel = ftdmchan;
                /* if we have the PAUSED flag and the sig status is still UP */
<span style="color: #A00000">-                if ((sngss7_test_flag(sngss7_info, FLAG_INFID_PAUSED)) &&</span>
<span style="color: #00A000">+                if ((sngss7_test_ckt_flag(sngss7_info, FLAG_INFID_PAUSED)) &&</span>
                        (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SIG_UP))) {
                        /* clear up any pending state changes */
<span style="color: #800080; font-weight: bold">@@ -790,7 +800,7 @@ ftdm_status_t check_for_res_sus_flag(ftdm_span_t *ftdmspan)</span>
                /* if the RESUME flag is up go to SUSPENDED to process the flag */
                /* after doing this the flag will be cleared */
<span style="color: #A00000">-                if (sngss7_test_flag(sngss7_info, FLAG_INFID_RESUME)) {</span>
<span style="color: #00A000">+                if (sngss7_test_ckt_flag(sngss7_info, FLAG_INFID_RESUME)) {</span>
                        /* clear up any pending state changes */
                        while (ftdm_test_flag (ftdmchan, FTDM_CHANNEL_STATE_CHANGE)) {
<span style="color: #800080; font-weight: bold">@@ -839,7 +849,7 @@ ftdm_status_t process_span_ucic(ftdm_span_t *ftdmspan)</span>
                }
                /* throw the ckt block flag */
<span style="color: #A00000">-                sngss7_set_flag(sngss7_info, FLAG_CKT_UCIC_BLOCK);</span>
<span style="color: #00A000">+                sngss7_set_ckt_flag(sngss7_info, FLAG_CKT_UCIC_BLOCK);</span>
                /* set the channel to suspended state */
                ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
<span style="color: #800080; font-weight: bold">@@ -858,9 +868,9 @@ ftdm_status_t process_span_ucic(ftdm_span_t *ftdmspan)</span>
ftdm_status_t clear_rx_grs_flags(sngss7_chan_data_t *sngss7_info)
{
        /* clear all the flags related to an incoming GRS */
<span style="color: #A00000">-        sngss7_clear_flag(sngss7_info, FLAG_GRP_RESET_RX);</span>
<span style="color: #A00000">-        sngss7_clear_flag(sngss7_info, FLAG_GRP_RESET_RX_DN);</span>
<span style="color: #A00000">-        sngss7_clear_flag(sngss7_info, FLAG_GRP_RESET_RX_CMPLT);</span>
<span style="color: #00A000">+        sngss7_clear_ckt_flag(sngss7_info, FLAG_GRP_RESET_RX);</span>
<span style="color: #00A000">+        sngss7_clear_ckt_flag(sngss7_info, FLAG_GRP_RESET_RX_DN);</span>
<span style="color: #00A000">+        sngss7_clear_ckt_flag(sngss7_info, FLAG_GRP_RESET_RX_CMPLT);</span>
        return FTDM_SUCCESS;
}
<span style="color: #800080; font-weight: bold">@@ -892,10 +902,10 @@ ftdm_status_t clear_rx_gra_data(sngss7_chan_data_t *sngss7_info)</span>
ftdm_status_t clear_tx_grs_flags(sngss7_chan_data_t *sngss7_info)
{
        /* clear all the flags related to an outgoing GRS */
<span style="color: #A00000">-        sngss7_clear_flag(sngss7_info, FLAG_GRP_RESET_BASE);</span>
<span style="color: #A00000">-        sngss7_clear_flag(sngss7_info, FLAG_GRP_RESET_TX);</span>
<span style="color: #A00000">-        sngss7_clear_flag(sngss7_info, FLAG_GRP_RESET_SENT);</span>
<span style="color: #A00000">-        sngss7_clear_flag(sngss7_info, FLAG_GRP_RESET_TX_RSP);</span>
<span style="color: #00A000">+        sngss7_clear_ckt_flag(sngss7_info, FLAG_GRP_RESET_BASE);</span>
<span style="color: #00A000">+        sngss7_clear_ckt_flag(sngss7_info, FLAG_GRP_RESET_TX);</span>
<span style="color: #00A000">+        sngss7_clear_ckt_flag(sngss7_info, FLAG_GRP_RESET_SENT);</span>
<span style="color: #00A000">+        sngss7_clear_ckt_flag(sngss7_info, FLAG_GRP_RESET_TX_RSP);</span>
        return FTDM_SUCCESS;
}
<span style="color: #800080; font-weight: bold">@@ -918,7 +928,7 @@ ftdm_status_t clear_tx_grs_data(sngss7_chan_data_t *sngss7_info)</span>
ftdm_status_t clear_rx_rsc_flags(sngss7_chan_data_t *sngss7_info)
{
        /* clear all the flags related to an incoming RSC */
<span style="color: #A00000">-        sngss7_clear_flag(sngss7_info, FLAG_RESET_RX);</span>
<span style="color: #00A000">+        sngss7_clear_ckt_flag(sngss7_info, FLAG_RESET_RX);</span>
        return FTDM_SUCCESS;
}
<span style="color: #800080; font-weight: bold">@@ -927,9 +937,9 @@ ftdm_status_t clear_rx_rsc_flags(sngss7_chan_data_t *sngss7_info)</span>
ftdm_status_t clear_tx_rsc_flags(sngss7_chan_data_t *sngss7_info)
{
        /* clear all the flags related to an outgoing RSC */
<span style="color: #A00000">-        sngss7_clear_flag(sngss7_info, FLAG_RESET_TX);</span>
<span style="color: #A00000">-        sngss7_clear_flag(sngss7_info, FLAG_RESET_SENT);</span>
<span style="color: #A00000">-        sngss7_clear_flag(sngss7_info, FLAG_RESET_TX_RSP);</span>
<span style="color: #00A000">+        sngss7_clear_ckt_flag(sngss7_info, FLAG_RESET_TX);</span>
<span style="color: #00A000">+        sngss7_clear_ckt_flag(sngss7_info, FLAG_RESET_SENT);</span>
<span style="color: #00A000">+        sngss7_clear_ckt_flag(sngss7_info, FLAG_RESET_TX_RSP);</span>
        return FTDM_SUCCESS;
}
<span style="color: #800080; font-weight: bold">@@ -1148,6 +1158,197 @@ ftdm_status_t encode_subAddrIE_nat(const char *subAddr, char *subAddrIE, int typ</span>
}
/******************************************************************************/
<span style="color: #00A000">+int find_mtp2_error_type_in_map(const char *err_type)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        int i = 0;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        while (sng_mtp2_error_type_map[i].init == 1) {</span>
<span style="color: #00A000">+                /* check if string matches the sng_type name */ </span>
<span style="color: #00A000">+                if (!strcasecmp(err_type, sng_mtp2_error_type_map[i].sng_type)) {</span>
<span style="color: #00A000">+                        /* we've found a match break from the loop */</span>
<span style="color: #00A000">+                        break;</span>
<span style="color: #00A000">+                } else {</span>
<span style="color: #00A000">+                        /* move on to the next on */</span>
<span style="color: #00A000">+                        i++;</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+        } /* while (sng_mtp2_error_type_map[i].init == 1) */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* check how we exited the loop */</span>
<span style="color: #00A000">+        if (sng_mtp2_error_type_map[i].init == 0) {</span>
<span style="color: #00A000">+                return -1;</span>
<span style="color: #00A000">+        } else {</span>
<span style="color: #00A000">+                return i;</span>
<span style="color: #00A000">+        } /* if (sng_mtp2_error_type_map[i].init == 0) */</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/******************************************************************************/</span>
<span style="color: #00A000">+int find_link_type_in_map(const char *linkType)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        int i = 0;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        while (sng_link_type_map[i].init == 1) {</span>
<span style="color: #00A000">+                /* check if string matches the sng_type name */ </span>
<span style="color: #00A000">+                if (!strcasecmp(linkType, sng_link_type_map[i].sng_type)) {</span>
<span style="color: #00A000">+                        /* we've found a match break from the loop */</span>
<span style="color: #00A000">+                        break;</span>
<span style="color: #00A000">+                } else {</span>
<span style="color: #00A000">+                        /* move on to the next on */</span>
<span style="color: #00A000">+                        i++;</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+        } /* while (sng_link_type_map[i].init == 1) */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* check how we exited the loop */</span>
<span style="color: #00A000">+        if (sng_link_type_map[i].init == 0) {</span>
<span style="color: #00A000">+                return -1;</span>
<span style="color: #00A000">+        } else {</span>
<span style="color: #00A000">+                return i;</span>
<span style="color: #00A000">+        } /* if (sng_link_type_map[i].init == 0) */</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/******************************************************************************/</span>
<span style="color: #00A000">+int find_switch_type_in_map(const char *switchType)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        int i = 0;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        while (sng_switch_type_map[i].init == 1) {</span>
<span style="color: #00A000">+                /* check if string matches the sng_type name */ </span>
<span style="color: #00A000">+                if (!strcasecmp(switchType, sng_switch_type_map[i].sng_type)) {</span>
<span style="color: #00A000">+                        /* we've found a match break from the loop */</span>
<span style="color: #00A000">+                        break;</span>
<span style="color: #00A000">+                } else {</span>
<span style="color: #00A000">+                        /* move on to the next on */</span>
<span style="color: #00A000">+                        i++;</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+        } /* while (sng_switch_type_map[i].init == 1) */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* check how we exited the loop */</span>
<span style="color: #00A000">+        if (sng_switch_type_map[i].init == 0) {</span>
<span style="color: #00A000">+                return -1;</span>
<span style="color: #00A000">+        } else {</span>
<span style="color: #00A000">+                return i;</span>
<span style="color: #00A000">+        } /* if (sng_switch_type_map[i].init == 0) */</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/******************************************************************************/</span>
<span style="color: #00A000">+int find_ssf_type_in_map(const char *ssfType)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        int i = 0;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        while (sng_ssf_type_map[i].init == 1) {</span>
<span style="color: #00A000">+                /* check if string matches the sng_type name */ </span>
<span style="color: #00A000">+                if (!strcasecmp(ssfType, sng_ssf_type_map[i].sng_type)) {</span>
<span style="color: #00A000">+                        /* we've found a match break from the loop */</span>
<span style="color: #00A000">+                        break;</span>
<span style="color: #00A000">+                } else {</span>
<span style="color: #00A000">+                        /* move on to the next on */</span>
<span style="color: #00A000">+                        i++;</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+        } /* while (sng_ssf_type_map[i].init == 1) */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* check how we exited the loop */</span>
<span style="color: #00A000">+        if (sng_ssf_type_map[i].init == 0) {</span>
<span style="color: #00A000">+                return -1;</span>
<span style="color: #00A000">+        } else {</span>
<span style="color: #00A000">+                return i;</span>
<span style="color: #00A000">+        } /* if (sng_ssf_type_map[i].init == 0) */</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/******************************************************************************/</span>
<span style="color: #00A000">+int find_cic_cntrl_in_map(const char *cntrlType)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        int i = 0;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        while (sng_cic_cntrl_type_map[i].init == 1) {</span>
<span style="color: #00A000">+                /* check if string matches the sng_type name */ </span>
<span style="color: #00A000">+                if (!strcasecmp(cntrlType, sng_cic_cntrl_type_map[i].sng_type)) {</span>
<span style="color: #00A000">+                        /* we've found a match break from the loop */</span>
<span style="color: #00A000">+                        break;</span>
<span style="color: #00A000">+                } else {</span>
<span style="color: #00A000">+                        /* move on to the next on */</span>
<span style="color: #00A000">+                        i++;</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+        } /* while (sng_cic_cntrl_type_map[i].init == 1) */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* check how we exited the loop */</span>
<span style="color: #00A000">+        if (sng_cic_cntrl_type_map[i].init == 0) {</span>
<span style="color: #00A000">+                return -1;</span>
<span style="color: #00A000">+        } else {</span>
<span style="color: #00A000">+                return i;</span>
<span style="color: #00A000">+        } /* if (sng_cic_cntrl_type_map[i].init == 0) */</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/******************************************************************************/</span>
<span style="color: #00A000">+ftdm_status_t check_status_of_all_isup_intf(void)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        sng_isup_inf_t                *sngss7_intf = NULL;</span>
<span style="color: #00A000">+        uint8_t                                status = 0xff;</span>
<span style="color: #00A000">+        int                                        x;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* go through all the isupIntfs and ask the stack to give their current state */</span>
<span style="color: #00A000">+        x = 1;</span>
<span style="color: #00A000">+        for (x = 1; x < (MAX_ISUP_INFS + 1); x++) {</span>
<span style="color: #00A000">+        /**************************************************************************/</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                if (g_ftdm_sngss7_data.cfg.isupIntf[x].id == 0) continue;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                sngss7_intf = &g_ftdm_sngss7_data.cfg.isupIntf[x];</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                if (ftmod_ss7_isup_intf_sta(sngss7_intf->id, &status)) {</span>
<span style="color: #00A000">+                        SS7_ERROR("Failed to get status of ISUP intf %d\n", sngss7_intf->id);</span>
<span style="color: #00A000">+                        continue;</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                switch (status){</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                case (SI_INTF_AVAIL):</span>
<span style="color: #00A000">+                        SS7_DEBUG("State of ISUP intf %d = AVAIL\n", sngss7_intf->id); </span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                        /* check the current state for interface that we know */</span>
<span style="color: #00A000">+                        if (sngss7_test_flag(sngss7_intf, SNGSS7_PAUSED)) {</span>
<span style="color: #00A000">+                                /* we thing the intf is paused...put into resume */ </span>
<span style="color: #00A000">+                                sngss7_clear_flag(sngss7_intf, SNGSS7_PAUSED);</span>
<span style="color: #00A000">+                        } else {</span>
<span style="color: #00A000">+                                /* nothing to since we already know that interface is active */</span>
<span style="color: #00A000">+                        }</span>
<span style="color: #00A000">+                        break;</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                case (SI_INTF_UNAVAIL):</span>
<span style="color: #00A000">+                        SS7_DEBUG("State of ISUP intf %d = UNAVAIL\n", sngss7_intf->id); </span>
<span style="color: #00A000">+                        /* check the current state for interface that we know */</span>
<span style="color: #00A000">+                        if (sngss7_test_flag(sngss7_intf, SNGSS7_PAUSED)) {</span>
<span style="color: #00A000">+                                /* nothing to since we already know that interface is active */ </span>
<span style="color: #00A000">+                        } else {</span>
<span style="color: #00A000">+                                /* put the interface into pause */</span>
<span style="color: #00A000">+                                sngss7_set_flag(sngss7_intf, SNGSS7_PAUSED);</span>
<span style="color: #00A000">+                        }</span>
<span style="color: #00A000">+                        break;</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                case (SI_INTF_CONG1):</span>
<span style="color: #00A000">+                        SS7_DEBUG("State of ISUP intf %d = Congestion 1\n", sngss7_intf->id);</span>
<span style="color: #00A000">+                        break;</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                case (SI_INTF_CONG2):</span>
<span style="color: #00A000">+                        SS7_DEBUG("State of ISUP intf %d = Congestion 2\n", sngss7_intf->id);</span>
<span style="color: #00A000">+                        break;</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                case (SI_INTF_CONG3):</span>
<span style="color: #00A000">+                        SS7_DEBUG("State of ISUP intf %d = Congestion 3\n", sngss7_intf->id);</span>
<span style="color: #00A000">+                        break;</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                default:</span>
<span style="color: #00A000">+                        /* should do something here to handle the possiblity of an unknown case */</span>
<span style="color: #00A000">+                        SS7_ERROR("Unknown ISUP intf Status code (%d) for Intf = %d\n", status, sngss7_intf->id);</span>
<span style="color: #00A000">+                        break;</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } /* switch (status) */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /**************************************************************************/</span>
<span style="color: #00A000">+        } /* for (x = 1; x < MAX_ISUP_INFS + 1); i++) */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return FTDM_SUCCESS;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/******************************************************************************/</span>
/* For Emacs:
* Local Variables:
* mode:c
<span style="color: #000080; font-weight: bold">diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_timers.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_timers.c</span>
<span style="color: #000080; font-weight: bold">index 75b32d6..c2d493f 100644</span>
<span style="color: #A00000">--- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_timers.c</span>
<span style="color: #00A000">+++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_timers.c</span>
<span style="color: #800080; font-weight: bold">@@ -61,7 +61,7 @@ void handle_isup_t35(void *userdata)</span>
SS7_ERROR("[Call-Control] Timer 35 expired on CIC = %d\n", sngss7_info->circuit->cic);
/* set the flag to indicate this hangup is started from the local side */
<span style="color: #A00000">- sngss7_set_flag(sngss7_info, FLAG_LOCAL_REL);</span>
<span style="color: #00A000">+ sngss7_set_ckt_flag(sngss7_info, FLAG_LOCAL_REL);</span>
/* hang up on timer expiry */
ftdmchan->caller_data.hangup_cause = 28;
<span style="color: #000080; font-weight: bold">diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c</span>
<span style="color: #000080; font-weight: bold">index d4fd1ca..277951c 100644</span>
<span style="color: #A00000">--- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c</span>
<span style="color: #00A000">+++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c</span>
<span style="color: #800080; font-weight: bold">@@ -39,6 +39,60 @@</span>
/******************************************************************************/
/* GLOBALS ********************************************************************/
<span style="color: #00A000">+sng_ssf_type_t sng_ssf_type_map[] =</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        { 1, "nat" , SSF_NAT },</span>
<span style="color: #00A000">+        { 1, "int" , SSF_INTL },</span>
<span style="color: #00A000">+        { 1, "spare" , SSF_SPARE },</span>
<span style="color: #00A000">+        { 1, "res" , SSF_RES },</span>
<span style="color: #00A000">+        { 0, "", 0 },</span>
<span style="color: #00A000">+};</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+sng_switch_type_t sng_switch_type_map[] =</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        { 1, "itu88" , LSI_SW_ITU , LSI_SW_ITU },</span>
<span style="color: #00A000">+        { 1, "itu92" , LSI_SW_ITU , LSI_SW_ITU },</span>
<span style="color: #00A000">+        { 1, "itu97" , LSI_SW_ITU97 , LSI_SW_ITU97 },</span>
<span style="color: #00A000">+        { 1, "itu00" , LSI_SW_ITU2000 , LSI_SW_ITU2000 },</span>
<span style="color: #00A000">+        { 1, "ansi88" , LSI_SW_ANS88 , LSI_SW_ANS88 },</span>
<span style="color: #00A000">+        { 1, "ansi92" , LSI_SW_ANS92 , LSI_SW_ANS92 },</span>
<span style="color: #00A000">+        { 1, "ansi95" , LSI_SW_ANS92 , LSI_SW_ANS92 },</span>
<span style="color: #00A000">+        { 1, "etsiv2" , LSI_SW_ETSI , LSI_SW_ETSI },</span>
<span style="color: #00A000">+        { 1, "etsiv3" , LSI_SW_ETSIV3 , LSI_SW_ETSIV3 },</span>
<span style="color: #00A000">+        { 1, "india" , LSI_SW_INDIA , LSI_SW_INDIA },</span>
<span style="color: #00A000">+        { 1, "uk" , LSI_SW_UK , LSI_SW_UK },</span>
<span style="color: #00A000">+        { 1, "russia" , LSI_SW_RUSSIA , LSI_SW_RUSSIA },</span>
<span style="color: #00A000">+        { 0, "", 0, 0 },</span>
<span style="color: #00A000">+};</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+sng_link_type_t sng_link_type_map[] =</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        { 1, "itu88" , LSD_SW_ITU88 , LSN_SW_ITU },</span>
<span style="color: #00A000">+        { 1, "itu92" , LSD_SW_ITU92 , LSN_SW_ITU },</span>
<span style="color: #00A000">+        { 1, "etsi" , LSD_SW_ITU92 , LSN_SW_ITU },</span>
<span style="color: #00A000">+        { 1, "ansi88" , LSD_SW_ANSI88, LSN_SW_ANS },</span>
<span style="color: #00A000">+        { 1, "ansi92" , LSD_SW_ANSI92, LSN_SW_ANS },</span>
<span style="color: #00A000">+        { 1, "ansi96" , LSD_SW_ANSI92, LSN_SW_ANS96 },</span>
<span style="color: #00A000">+        { 0, "", 0, 0 },</span>
<span style="color: #00A000">+};</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+sng_mtp2_error_type_t sng_mtp2_error_type_map[] =</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        { 1, "basic", SD_ERR_NRM },</span>
<span style="color: #00A000">+        { 1, "pcr" , SD_ERR_CYC },</span>
<span style="color: #00A000">+        { 0, "", 0 },</span>
<span style="color: #00A000">+};</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+sng_cic_cntrl_type_t sng_cic_cntrl_type_map[] =</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        { 1, "bothway" , BOTHWAY },</span>
<span style="color: #00A000">+        { 1, "incoming" , INCOMING },</span>
<span style="color: #00A000">+        { 1, "outgoing" , OUTGOING },</span>
<span style="color: #00A000">+        { 1, "controlling" , CONTROLLING },</span>
<span style="color: #00A000">+        { 1, "controlled" , CONTROLLED },</span>
<span style="color: #00A000">+        { 0, "", 0 },</span>
<span style="color: #00A000">+};</span>
<span style="color: #00A000">+</span>
typedef struct sng_timeslot
{
        int         channel;
<span style="color: #800080; font-weight: bold">@@ -47,13 +101,28 @@ typedef struct sng_timeslot</span>
        int         hole;
}sng_timeslot_t;
<span style="color: #A00000">-typedef struct sng_isupCkt</span>
<span style="color: #00A000">+typedef struct sng_span</span>
{
<span style="color: #00A000">+        char                        name[MAX_NAME_LEN];</span>
        ftdm_span_t                *span;
<span style="color: #00A000">+        uint32_t                ccSpanId;</span>
<span style="color: #00A000">+} sng_span_t;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+typedef struct sng_ccSpan</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        char                        name[MAX_NAME_LEN];</span>
<span style="color: #00A000">+        uint32_t                options;</span>
<span style="color: #00A000">+        uint32_t                id;</span>
<span style="color: #00A000">+        uint32_t                procId;</span>
<span style="color: #00A000">+        uint32_t                isupInf;</span>
        uint32_t                cicbase;
<span style="color: #A00000">-        uint32_t                typeCntrl;</span>
        char                        ch_map[MAX_CIC_MAP_LENGTH];
<span style="color: #A00000">-        uint32_t                isupInf;</span>
<span style="color: #00A000">+        uint32_t                typeCntrl;</span>
<span style="color: #00A000">+        uint32_t                switchType;</span>
<span style="color: #00A000">+        uint32_t                ssf;</span>
<span style="color: #00A000">+        uint32_t                clg_nadi;</span>
<span style="color: #00A000">+        uint32_t                cld_nadi;</span>
<span style="color: #00A000">+        uint32_t                min_digits;</span>
        uint32_t                t3;
        uint32_t                t12;
        uint32_t                t13;
<span style="color: #800080; font-weight: bold">@@ -61,8 +130,9 @@ typedef struct sng_isupCkt</span>
        uint32_t                t15;
        uint32_t                t16;
        uint32_t                t17;
<span style="color: #00A000">+        uint32_t                t35;</span>
        uint32_t                tval;
<span style="color: #A00000">-} sng_isupCkt_t;</span>
<span style="color: #00A000">+} sng_ccSpan_t;</span>
int cmbLinkSetId;
/******************************************************************************/
<span style="color: #800080; font-weight: bold">@@ -72,9 +142,22 @@ int ftmod_ss7_parse_xml(ftdm_conf_parameter_t *ftdm_parameters, ftdm_span_t *spa</span>
static int ftmod_ss7_parse_sng_isup(ftdm_conf_node_t *sng_isup);
<span style="color: #00A000">+static int ftmod_ss7_parse_sng_gen(ftdm_conf_node_t *sng_gen);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+static int ftmod_ss7_parse_sng_relay(ftdm_conf_node_t *sng_relay);</span>
<span style="color: #00A000">+static int ftmod_ss7_parse_relay_channel(ftdm_conf_node_t *relay_chan);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+static int ftmod_ss7_parse_mtp1_links(ftdm_conf_node_t *mtp1_links);</span>
<span style="color: #00A000">+static int ftmod_ss7_parse_mtp1_link(ftdm_conf_node_t *mtp1_link);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+static int ftmod_ss7_parse_mtp2_links(ftdm_conf_node_t *mtp2_links);</span>
<span style="color: #00A000">+static int ftmod_ss7_parse_mtp2_link(ftdm_conf_node_t *mtp2_link);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+static int ftmod_ss7_parse_mtp3_links(ftdm_conf_node_t *mtp3_links);</span>
<span style="color: #00A000">+static int ftmod_ss7_parse_mtp3_link(ftdm_conf_node_t *mtp3_link);</span>
<span style="color: #00A000">+</span>
static int ftmod_ss7_parse_mtp_linksets(ftdm_conf_node_t *mtp_linksets);
static int ftmod_ss7_parse_mtp_linkset(ftdm_conf_node_t *mtp_linkset);
<span style="color: #A00000">-static int ftmod_ss7_parse_mtp_link(ftdm_conf_node_t *mtp_link, sng_mtp_link_t *mtpLink);</span>
static int ftmod_ss7_parse_mtp_routes(ftdm_conf_node_t *mtp_routes);
static int ftmod_ss7_parse_mtp_route(ftdm_conf_node_t *mtp_route);
<span style="color: #800080; font-weight: bold">@@ -82,19 +165,22 @@ static int ftmod_ss7_parse_mtp_route(ftdm_conf_node_t *mtp_route);</span>
static int ftmod_ss7_parse_isup_interfaces(ftdm_conf_node_t *isup_interfaces);
static int ftmod_ss7_parse_isup_interface(ftdm_conf_node_t *isup_interface);
<span style="color: #A00000">-static int ftmod_ss7_fill_in_mtpLink(sng_mtp_link_t *mtpLink);</span>
<span style="color: #00A000">+static int ftmod_ss7_parse_cc_spans(ftdm_conf_node_t *cc_spans);</span>
<span style="color: #00A000">+static int ftmod_ss7_parse_cc_span(ftdm_conf_node_t *cc_span);</span>
<span style="color: #00A000">+static int ftmod_ss7_fill_in_relay_channel(sng_relay_t *relay_channel);</span>
<span style="color: #00A000">+static int ftmod_ss7_fill_in_mtp1_link(sng_mtp1_link_t *mtp1Link);</span>
<span style="color: #00A000">+static int ftmod_ss7_fill_in_mtp2_link(sng_mtp2_link_t *mtp1Link);</span>
<span style="color: #00A000">+static int ftmod_ss7_fill_in_mtp3_link(sng_mtp3_link_t *mtp1Link);</span>
static int ftmod_ss7_fill_in_mtpLinkSet(sng_link_set_t *mtpLinkSet);
<span style="color: #A00000">-</span>
static int ftmod_ss7_fill_in_mtp3_route(sng_route_t *mtp3_route);
static int ftmod_ss7_fill_in_nsap(sng_route_t *mtp3_route);
<span style="color: #A00000">-</span>
static int ftmod_ss7_fill_in_isup_interface(sng_isup_inf_t *sng_isup);
static int ftmod_ss7_fill_in_isap(sng_isap_t *sng_isap);
<span style="color: #A00000">-</span>
<span style="color: #00A000">+static int ftmod_ss7_fill_in_ccSpan(sng_ccSpan_t *ccSpan);</span>
static int ftmod_ss7_fill_in_self_route(int spc, int linkType, int switchType, int ssf);
<span style="color: #00A000">+static int ftmod_ss7_fill_in_circuits(sng_span_t *sngSpan);</span>
<span style="color: #A00000">-static int ftmod_ss7_fill_in_circuits(sng_isupCkt_t *isupCkt);</span>
static int ftmod_ss7_next_timeslot(char *ch_map, sng_timeslot_t *timeslot);
/******************************************************************************/
<span style="color: #800080; font-weight: bold">@@ -103,18 +189,17 @@ static int ftmod_ss7_next_timeslot(char *ch_map, sng_timeslot_t *timeslot);</span>
int ftmod_ss7_parse_xml(ftdm_conf_parameter_t *ftdm_parameters, ftdm_span_t *span)
{
        int                                        i = 0;
<span style="color: #A00000">-        int                                        x = 0;</span>
        const char                        *var = NULL;
        const char                        *val = NULL;
        ftdm_conf_node_t        *ptr = NULL;
        sng_route_t                        self_route;
<span style="color: #A00000">-        sng_isupCkt_t                isupCkt;</span>
<span style="color: #00A000">+        sng_span_t                        sngSpan;</span>
        /* clean out the isup ckt */
<span style="color: #A00000">-        memset(&isupCkt, 0x0, sizeof(sng_isupCkt_t));</span>
<span style="color: #00A000">+        memset(&sngSpan, 0x0, sizeof(sngSpan));</span>
        /* clean out the self route */
<span style="color: #A00000">-        memset(&self_route, 0x0, sizeof(sng_route_t));</span>
<span style="color: #00A000">+        memset(&self_route, 0x0, sizeof(self_route));</span>
        var = ftdm_parameters[i].var;
        val = ftdm_parameters[i].val;
<span style="color: #800080; font-weight: bold">@@ -136,92 +221,23 @@ int ftmod_ss7_parse_xml(ftdm_conf_parameter_t *ftdm_parameters, ftdm_span_t *spa</span>
        i++;
        while (ftdm_parameters[i].var != NULL) {
<span style="color: #00A000">+        /**************************************************************************/</span>
                var = ftdm_parameters[i].var;
                val = ftdm_parameters[i].val;
<span style="color: #A00000">-                if (!strcasecmp(var, "ch_map")) {</span>
<span style="color: #A00000">-                /**********************************************************************/</span>
<span style="color: #A00000">-                        strncpy(isupCkt.ch_map, val, MAX_CIC_MAP_LENGTH-1);</span>
<span style="color: #A00000">-                        SS7_DEBUG("\tFound channel map \"%s\"\n", isupCkt.ch_map);</span>
<span style="color: #A00000">-                /**********************************************************************/</span>
<span style="color: #A00000">-                } else if (!strcasecmp(var, "typeCntrl")) {</span>
<span style="color: #A00000">-                        if (!strcasecmp(val, "bothway")) {</span>
<span style="color: #A00000">-                                isupCkt.typeCntrl = BOTHWAY;</span>
<span style="color: #A00000">-                                SS7_DEBUG("\tFound control type \"bothway\"\n");</span>
<span style="color: #A00000">-                        } else if (!strcasecmp(val, "incoming")) {</span>
<span style="color: #A00000">-                                isupCkt.typeCntrl = INCOMING;</span>
<span style="color: #A00000">-                                SS7_DEBUG("\tFound control type \"incoming\"\n");</span>
<span style="color: #A00000">-                        } else if (!strcasecmp(val, "outgoing")) {</span>
<span style="color: #A00000">-                                isupCkt.typeCntrl = OUTGOING;</span>
<span style="color: #A00000">-                                SS7_DEBUG("\tFound control type \"outgoing\"\n");</span>
<span style="color: #A00000">-                        } else if (!strcasecmp(val, "controlled")) {</span>
<span style="color: #A00000">-                                isupCkt.typeCntrl = CONTROLLED;</span>
<span style="color: #A00000">-                                SS7_DEBUG("\tFound control type \"controlled\"\n");</span>
<span style="color: #A00000">-                        } else if (!strcasecmp(val, "controlling")) {</span>
<span style="color: #A00000">-                                isupCkt.typeCntrl = CONTROLLING;</span>
<span style="color: #A00000">-                                SS7_DEBUG("\tFound control type \"controlling\"\n");</span>
<span style="color: #A00000">-                        } else {</span>
<span style="color: #A00000">-                                SS7_ERROR("Found invalid circuit control type \"%s\"!", val);</span>
<span style="color: #A00000">-                                goto ftmod_ss7_parse_xml_error;</span>
<span style="color: #A00000">-                        }</span>
<span style="color: #A00000">-                /**********************************************************************/</span>
<span style="color: #A00000">-                } else if (!strcasecmp(var, "cicbase")) {</span>
<span style="color: #A00000">-                        isupCkt.cicbase = atoi(val);</span>
<span style="color: #A00000">-                        SS7_DEBUG("\tFound cicbase = %d\n", isupCkt.cicbase);</span>
<span style="color: #00A000">+                if (!strcasecmp(var, "dialplan")) {</span>
                /**********************************************************************/
<span style="color: #A00000">-                } else if (!strcasecmp(var, "dialplan")) {</span>
                        /* do i give a shit about this??? */
                /**********************************************************************/
                } else if (!strcasecmp(var, "context")) {
<span style="color: #A00000">-                        /* do i give a shit about this??? */</span>
<span style="color: #A00000">-                /**********************************************************************/</span>
<span style="color: #A00000">-                } else if (!strcasecmp(var, "isup_interface")) {</span>
<span style="color: #A00000">-                        /* go through all the existing interfaces and see if we find a match */</span>
<span style="color: #A00000">-                        x = 1;</span>
<span style="color: #A00000">-                        while (g_ftdm_sngss7_data.cfg.isupIntf[x].id != 0) {</span>
<span style="color: #A00000">-                                if (!strcasecmp(g_ftdm_sngss7_data.cfg.isupIntf[x].name, val)) {</span>
<span style="color: #A00000">-                                        /* we have a match so break out of this loop */</span>
<span style="color: #A00000">-                                        break;</span>
<span style="color: #A00000">-                                }</span>
<span style="color: #A00000">-                                /* move on to the next one */</span>
<span style="color: #A00000">-                                x++;</span>
<span style="color: #A00000">-                        }</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                        isupCkt.isupInf = x;</span>
<span style="color: #A00000">-                        SS7_DEBUG("\tFound isup_interface = %s\n",g_ftdm_sngss7_data.cfg.isupIntf[x].name);</span>
<span style="color: #A00000">-                /**********************************************************************/</span>
<span style="color: #A00000">-                } else if (!strcasecmp(var, "isup.t3")) {</span>
<span style="color: #A00000">-                        isupCkt.t3 = atoi(val);</span>
<span style="color: #A00000">-                        SS7_DEBUG("\tFound isup t3 = \"%d\"\n", isupCkt.t3);</span>
<span style="color: #A00000">-                /**********************************************************************/</span>
<span style="color: #A00000">-                } else if (!strcasecmp(var, "isup.t12")) {</span>
<span style="color: #A00000">-                        isupCkt.t12 = atoi(val);</span>
<span style="color: #A00000">-                        SS7_DEBUG("\tFound isup t12 = \"%d\"\n", isupCkt.t12);</span>
<span style="color: #A00000">-                /**********************************************************************/</span>
<span style="color: #A00000">-                } else if (!strcasecmp(var, "isup.t13")) {</span>
<span style="color: #A00000">-                        isupCkt.t13 = atoi(val);</span>
<span style="color: #A00000">-                        SS7_DEBUG("\tFound isup t13 = \"%d\"\n", isupCkt.t13);</span>
                /**********************************************************************/
<span style="color: #A00000">-                } else if (!strcasecmp(var, "isup.t14")) {</span>
<span style="color: #A00000">-                        isupCkt.t14 = atoi(val);</span>
<span style="color: #A00000">-                        SS7_DEBUG("\tFound isup t14 = \"%d\"\n", isupCkt.t14);</span>
<span style="color: #A00000">-                /**********************************************************************/</span>
<span style="color: #A00000">-                } else if (!strcasecmp(var, "isup.t15")) {</span>
<span style="color: #A00000">-                        isupCkt.t15 = atoi(val);</span>
<span style="color: #A00000">-                        SS7_DEBUG("\tFound isup t15 = \"%d\"\n", isupCkt.t15);</span>
<span style="color: #A00000">-                /**********************************************************************/</span>
<span style="color: #A00000">-                } else if (!strcasecmp(var, "isup.t16")) {</span>
<span style="color: #A00000">-                        isupCkt.t16 = atoi(val);</span>
<span style="color: #A00000">-                        SS7_DEBUG("\tFound isup t16 = \"%d\"\n", isupCkt.t16);</span>
<span style="color: #00A000">+                        /* do i give a shit about this??? */</span>
                /**********************************************************************/
<span style="color: #A00000">-                } else if (!strcasecmp(var, "isup.t17")) {</span>
<span style="color: #A00000">-                        isupCkt.t17 = atoi(val);</span>
<span style="color: #A00000">-                        SS7_DEBUG("\tFound isup t17 = \"%d\"\n", isupCkt.t17);</span>
<span style="color: #00A000">+                } else if (!strcasecmp(var, "ccSpanId")) {</span>
                /**********************************************************************/
<span style="color: #A00000">-                } else if (!strcasecmp(var, "isup.tval")) {</span>
<span style="color: #A00000">-                        isupCkt.tval = atoi(val);</span>
<span style="color: #A00000">-                        SS7_DEBUG("\tFound isup tval = \"%d\"\n", isupCkt.tval);</span>
<span style="color: #00A000">+                        sngSpan.ccSpanId = atoi(val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an ccSpanId = %d\n",sngSpan.ccSpanId);</span>
                /**********************************************************************/
                } else {
                        SS7_ERROR("Unknown parameter found =\"%s\"...ignoring it!\n", var);
<span style="color: #800080; font-weight: bold">@@ -231,24 +247,11 @@ int ftmod_ss7_parse_xml(ftdm_conf_parameter_t *ftdm_parameters, ftdm_span_t *spa</span>
                i++;
        } /* while (ftdm_parameters[i].var != NULL) */
<span style="color: #A00000">-        /* setup the self mtp3 route */</span>
<span style="color: #A00000">-        i = g_ftdm_sngss7_data.cfg.isupIntf[x].mtpRouteId;</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-        if(ftmod_ss7_fill_in_self_route(g_ftdm_sngss7_data.cfg.isupIntf[x].spc,</span>
<span style="color: #A00000">-                                                                        g_ftdm_sngss7_data.cfg.mtpRoute[i].linkType,</span>
<span style="color: #A00000">-                                                                        g_ftdm_sngss7_data.cfg.mtpRoute[i].switchType,</span>
<span style="color: #A00000">-                                                                        g_ftdm_sngss7_data.cfg.mtpRoute[i].ssf)) {</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                SS7_ERROR("Failed to fill in self route structure!\n");</span>
<span style="color: #A00000">-                goto ftmod_ss7_parse_xml_error;</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-        }</span>
<span style="color: #A00000">-</span>
        /* fill the pointer to span into isupCkt */
<span style="color: #A00000">-        isupCkt.span = span;</span>
<span style="color: #00A000">+        sngSpan.span = span;</span>
        /* setup the circuits structure */
<span style="color: #A00000">-        if(ftmod_ss7_fill_in_circuits(&isupCkt)) {</span>
<span style="color: #00A000">+        if(ftmod_ss7_fill_in_circuits(&sngSpan)) {</span>
                SS7_ERROR("Failed to fill in circuits structure!\n");
                goto ftmod_ss7_parse_xml_error;
        }
<span style="color: #800080; font-weight: bold">@@ -262,9 +265,15 @@ ftmod_ss7_parse_xml_error:</span>
/******************************************************************************/
static int ftmod_ss7_parse_sng_isup(ftdm_conf_node_t *sng_isup)
{
<span style="color: #00A000">+        ftdm_conf_node_t        *gen_config = NULL;</span>
<span style="color: #00A000">+        ftdm_conf_node_t        *relay_channels = NULL;</span>
<span style="color: #00A000">+        ftdm_conf_node_t        *mtp1_links = NULL;</span>
<span style="color: #00A000">+        ftdm_conf_node_t        *mtp2_links = NULL;</span>
<span style="color: #00A000">+        ftdm_conf_node_t        *mtp3_links = NULL;</span>
        ftdm_conf_node_t        *mtp_linksets = NULL;
        ftdm_conf_node_t        *mtp_routes = NULL;
        ftdm_conf_node_t        *isup_interfaces = NULL;
<span style="color: #00A000">+        ftdm_conf_node_t        *cc_spans = NULL;</span>
        ftdm_conf_node_t        *tmp_node = NULL;
        /* confirm that we are looking at sng_isup */
<span style="color: #800080; font-weight: bold">@@ -275,51 +284,145 @@ static int ftmod_ss7_parse_sng_isup(ftdm_conf_node_t *sng_isup)</span>
                SS7_DEBUG("Parsing \"sng_isup\"...\n");
        }
<span style="color: #A00000">-        /* extract the 3 main sections of the sng_isup block */</span>
<span style="color: #00A000">+        /* extract the main sections of the sng_isup block */</span>
        tmp_node = sng_isup->child;
<span style="color: #A00000">-        while (tmp_node != NULL) {</span>
<span style="color: #A00000">-                if (!strcasecmp(tmp_node->name, "mtp_linksets")) {</span>
<span style="color: #00A000">+        while (tmp_node != NULL) {</span>
<span style="color: #00A000">+        /**************************************************************************/</span>
<span style="color: #00A000">+                /* check the type of structure */</span>
<span style="color: #00A000">+                 if (!strcasecmp(tmp_node->name, "sng_gen")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        if (gen_config == NULL) {</span>
<span style="color: #00A000">+                                gen_config = tmp_node;</span>
<span style="color: #00A000">+                                SS7_DEBUG("Found a \"sng_gen\" section!\n");</span>
<span style="color: #00A000">+                        } else {</span>
<span style="color: #00A000">+                                SS7_ERROR("Found a second \"sng_gen\" section\n!");</span>
<span style="color: #00A000">+                                return FTDM_FAIL;</span>
<span style="color: #00A000">+                        }</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else if (!strcasecmp(tmp_node->name, "sng_relay")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        if (relay_channels == NULL) {</span>
<span style="color: #00A000">+                                relay_channels = tmp_node;</span>
<span style="color: #00A000">+                                SS7_DEBUG("Found a \"sng_relay\" section!\n");</span>
<span style="color: #00A000">+                        } else {</span>
<span style="color: #00A000">+                                SS7_ERROR("Found a second \"sng_relay\" section\n!");</span>
<span style="color: #00A000">+                                return FTDM_FAIL;</span>
<span style="color: #00A000">+                        }</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                }else if (!strcasecmp(tmp_node->name, "mtp1_links")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        if (mtp1_links == NULL) {</span>
<span style="color: #00A000">+                                mtp1_links = tmp_node;</span>
<span style="color: #00A000">+                                SS7_DEBUG("Found a \"mtp1_links\" section!\n");</span>
<span style="color: #00A000">+                        } else {</span>
<span style="color: #00A000">+                                SS7_ERROR("Found a second \"mtp1_links\" section!\n");</span>
<span style="color: #00A000">+                                return FTDM_FAIL;</span>
<span style="color: #00A000">+                        }</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else if (!strcasecmp(tmp_node->name, "mtp2_links")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        if (mtp2_links == NULL) {</span>
<span style="color: #00A000">+                                mtp2_links = tmp_node;</span>
<span style="color: #00A000">+                                SS7_DEBUG("Found a \"mtp2_links\" section!\n");</span>
<span style="color: #00A000">+                        } else {</span>
<span style="color: #00A000">+                                SS7_ERROR("Found a second \"mtp2_links\" section!\n");</span>
<span style="color: #00A000">+                                return FTDM_FAIL;</span>
<span style="color: #00A000">+                        }</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else if (!strcasecmp(tmp_node->name, "mtp3_links")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        if (mtp3_links == NULL) {</span>
<span style="color: #00A000">+                                mtp3_links = tmp_node;</span>
<span style="color: #00A000">+                                SS7_DEBUG("Found a \"mtp3_links\" section!\n");</span>
<span style="color: #00A000">+                        } else {</span>
<span style="color: #00A000">+                                SS7_ERROR("Found a second \"mtp3_links\" section!\n");</span>
<span style="color: #00A000">+                                return FTDM_FAIL;</span>
<span style="color: #00A000">+                        }</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else if (!strcasecmp(tmp_node->name, "mtp_linksets")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
                        if (mtp_linksets == NULL) {
                                mtp_linksets = tmp_node;
<span style="color: #A00000">-                                SS7_DEBUG("\tFound a \"mtp_linksets section!\n");</span>
<span style="color: #00A000">+                                SS7_DEBUG("Found a \"mtp_linksets\" section!\n");</span>
                        } else {
<span style="color: #A00000">-                                SS7_ERROR("\tFound a second \"mtp_linksets\" section!\n");</span>
<span style="color: #00A000">+                                SS7_ERROR("Found a second \"mtp_linksets\" section!\n");</span>
                                return FTDM_FAIL;
                        }
<span style="color: #00A000">+                /**********************************************************************/</span>
                } else if (!strcasecmp(tmp_node->name, "mtp_routes")) {
<span style="color: #00A000">+                /**********************************************************************/</span>
                        if (mtp_routes == NULL) {
                                mtp_routes = tmp_node;
<span style="color: #A00000">-                                SS7_DEBUG("\tFound a \"mtp_routes\" section!\n");</span>
<span style="color: #00A000">+                                SS7_DEBUG("Found a \"mtp_routes\" section!\n");</span>
                        } else {
<span style="color: #A00000">-                                SS7_ERROR("\tFound a second \"mtp_routes\" section!\n");</span>
<span style="color: #00A000">+                                SS7_ERROR("Found a second \"mtp_routes\" section!\n");</span>
                                return FTDM_FAIL;
                        }
<span style="color: #00A000">+                /**********************************************************************/</span>
                } else if (!strcasecmp(tmp_node->name, "isup_interfaces")) {
<span style="color: #00A000">+                /**********************************************************************/</span>
                        if (isup_interfaces == NULL) {
                                isup_interfaces = tmp_node;
<span style="color: #A00000">-                                SS7_DEBUG("\tFound a \"isup_interfaces\" section!\n");</span>
<span style="color: #00A000">+                                SS7_DEBUG("Found a \"isup_interfaces\" section!\n");</span>
<span style="color: #00A000">+                        } else {</span>
<span style="color: #00A000">+                                SS7_ERROR("Found a second \"isup_interfaces\" section\n!");</span>
<span style="color: #00A000">+                                return FTDM_FAIL;</span>
<span style="color: #00A000">+                        }</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else if (!strcasecmp(tmp_node->name, "cc_spans")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        if (cc_spans == NULL) {</span>
<span style="color: #00A000">+                                cc_spans = tmp_node;</span>
<span style="color: #00A000">+                                SS7_DEBUG("Found a \"cc_spans\" section!\n");</span>
                        } else {
<span style="color: #A00000">-                                SS7_ERROR("\tFound a second \"isup_interfaces\" section\n!");</span>
<span style="color: #00A000">+                                SS7_ERROR("Found a second \"cc_spans\" section\n!");</span>
                                return FTDM_FAIL;
                        }
<span style="color: #00A000">+                /**********************************************************************/</span>
                } else {
<span style="color: #00A000">+                /**********************************************************************/</span>
                        SS7_ERROR("\tFound an unknown section \"%s\"!\n", tmp_node->name);
                        return FTDM_FAIL;
<span style="color: #A00000">-                }</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } </span>
                /* go to the next sibling */
                tmp_node = tmp_node->next;
<span style="color: #A00000">-</span>
        } /* while (tmp_node != NULL) */
        /* now try to parse the sections */
<span style="color: #00A000">+        if (ftmod_ss7_parse_sng_gen(gen_config)) {</span>
<span style="color: #00A000">+                SS7_ERROR("Failed to parse \"gen_config\"!\n");</span>
<span style="color: #00A000">+                return FTDM_FAIL;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if (ftmod_ss7_parse_sng_relay(relay_channels)) {</span>
<span style="color: #00A000">+                SS7_ERROR("Failed to parse \"relay_channels\"!\n");</span>
<span style="color: #00A000">+                return FTDM_FAIL;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if (ftmod_ss7_parse_mtp1_links(mtp1_links)) {</span>
<span style="color: #00A000">+                SS7_ERROR("Failed to parse \"mtp1_links\"!\n");</span>
<span style="color: #00A000">+                return FTDM_FAIL;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if (ftmod_ss7_parse_mtp2_links(mtp2_links)) {</span>
<span style="color: #00A000">+                SS7_ERROR("Failed to parse \"mtp2_links\"!\n");</span>
<span style="color: #00A000">+                return FTDM_FAIL;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if (ftmod_ss7_parse_mtp3_links(mtp3_links)) {</span>
<span style="color: #00A000">+                SS7_ERROR("Failed to parse \"mtp3_links\"!\n");</span>
<span style="color: #00A000">+                return FTDM_FAIL;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
        if (ftmod_ss7_parse_mtp_linksets(mtp_linksets)) {
                SS7_ERROR("Failed to parse \"mtp_linksets\"!\n");
                return FTDM_FAIL;
        }
<span style="color: #A00000">-        if (ftmod_ss7_parse_mtp_routes(mtp_routes)) {</span>
<span style="color: #00A000">+        if (ftmod_ss7_parse_mtp_routes(mtp_routes)) {        </span>
                SS7_ERROR("Failed to parse \"mtp_routes\"!\n");
                return FTDM_FAIL;
        }
<span style="color: #800080; font-weight: bold">@@ -329,35 +432,190 @@ static int ftmod_ss7_parse_sng_isup(ftdm_conf_node_t *sng_isup)</span>
                return FTDM_FAIL;
        }
<span style="color: #00A000">+        if (ftmod_ss7_parse_cc_spans(cc_spans)) {</span>
<span style="color: #00A000">+                SS7_ERROR("Failed to parse \"cc_spans\"!\n");</span>
<span style="color: #00A000">+                return FTDM_FAIL;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
        return FTDM_SUCCESS;
}
/******************************************************************************/
<span style="color: #A00000">-static int ftmod_ss7_parse_mtp_linksets(ftdm_conf_node_t *mtp_linksets)</span>
<span style="color: #00A000">+static int ftmod_ss7_parse_sng_gen(ftdm_conf_node_t *sng_gen)</span>
{
<span style="color: #A00000">-        ftdm_conf_node_t        *mtp_linkset = NULL;</span>
<span style="color: #00A000">+        ftdm_conf_parameter_t        *parm = sng_gen->parameters;</span>
<span style="color: #00A000">+        int                                                num_parms = sng_gen->n_parameters;</span>
<span style="color: #00A000">+        int                                                i = 0;</span>
<span style="color: #A00000">-        /* confirm that we are looking at mtp_linksets */</span>
<span style="color: #A00000">-        if (strcasecmp(mtp_linksets->name, "mtp_linksets")) {</span>
<span style="color: #A00000">-                SS7_ERROR("We're looking at \"%s\"...but we're supposed to be looking at \"mtp_linksets\"!\n",mtp_linksets->name);</span>
<span style="color: #00A000">+        /* extract all the information from the parameters */</span>
<span style="color: #00A000">+        for (i = 0; i < num_parms; i++) {</span>
<span style="color: #00A000">+        /**************************************************************************/</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                if (!strcasecmp(parm->var, "procId")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        g_ftdm_sngss7_data.cfg.procId = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found a procId = %d\n", g_ftdm_sngss7_data.cfg.procId);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "license")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        strcpy(g_ftdm_sngss7_data.cfg.license, parm->val);</span>
<span style="color: #00A000">+                        strcpy(g_ftdm_sngss7_data.cfg.signature, parm->val);</span>
<span style="color: #00A000">+                        strcat(g_ftdm_sngss7_data.cfg.signature, ".sig");</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found license file = %s\n", g_ftdm_sngss7_data.cfg.license);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found signature file = %s\n", g_ftdm_sngss7_data.cfg.signature);        </span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "spc")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        g_ftdm_sngss7_data.cfg.spc = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found SPC = %d\n", g_ftdm_sngss7_data.cfg.spc);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        SS7_ERROR("Found an invalid parameter \"%s\"!\n", parm->val);</span>
<span style="color: #00A000">+                        return FTDM_FAIL;</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                /* move to the next parmeter */</span>
<span style="color: #00A000">+                parm = parm + 1;</span>
<span style="color: #00A000">+        } /* for (i = 0; i < num_parms; i++) */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return FTDM_SUCCESS;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/******************************************************************************/</span>
<span style="color: #00A000">+static int ftmod_ss7_parse_sng_relay(ftdm_conf_node_t *sng_relay)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        ftdm_conf_node_t        *relay_chan = NULL;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* confirm that we are looking at sng_relay */</span>
<span style="color: #00A000">+        if (strcasecmp(sng_relay->name, "sng_relay")) {</span>
<span style="color: #00A000">+                SS7_ERROR("We're looking at \"%s\"...but we're supposed to be looking at \"sng_relay\"!\n",sng_relay->name);</span>
                return FTDM_FAIL;
        } else {
<span style="color: #A00000">-                SS7_DEBUG("Parsing \"mtp_linksets\"...\n");</span>
<span style="color: #00A000">+                SS7_DEBUG("Parsing \"sng_relay\"...\n");</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        relay_chan = sng_relay->child;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if (relay_chan != NULL) {</span>
<span style="color: #00A000">+                while (relay_chan != NULL) {</span>
<span style="color: #00A000">+                        /* try to the parse relay_channel */</span>
<span style="color: #00A000">+                        if (ftmod_ss7_parse_relay_channel(relay_chan)) {</span>
<span style="color: #00A000">+                                SS7_ERROR("Failed to parse \"relay_channels\"!\n");</span>
<span style="color: #00A000">+                                return FTDM_FAIL;</span>
<span style="color: #00A000">+                        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                        /* move on to the next linkset */</span>
<span style="color: #00A000">+                        relay_chan = relay_chan->next;</span>
<span style="color: #00A000">+                } /* while (relay_chan != NULL) */</span>
<span style="color: #00A000">+        } /* if (relay_chan != NULL) */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return FTDM_SUCCESS;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/******************************************************************************/</span>
<span style="color: #00A000">+static int ftmod_ss7_parse_relay_channel(ftdm_conf_node_t *relay_chan)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        sng_relay_t                                tmp_chan;</span>
<span style="color: #00A000">+        ftdm_conf_parameter_t        *parm = relay_chan->parameters;</span>
<span style="color: #00A000">+        int                                                num_parms = relay_chan->n_parameters;</span>
<span style="color: #00A000">+        int                                                i = 0;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* confirm that we are looking at relay_channel */</span>
<span style="color: #00A000">+        if (strcasecmp(relay_chan->name, "relay_channel")) {</span>
<span style="color: #00A000">+                SS7_ERROR("We're looking at \"%s\"...but we're supposed to be looking at \"relay_channel\"!\n",relay_chan->name);</span>
<span style="color: #00A000">+                return FTDM_FAIL;</span>
<span style="color: #00A000">+        } else {</span>
<span style="color: #00A000">+                SS7_DEBUG("Parsing \"relay_channel\"...\n");</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* initalize the tmp_chan structure */</span>
<span style="color: #00A000">+        memset(&tmp_chan, 0x0, sizeof(tmp_chan));</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* extract all the information from the parameters */</span>
<span style="color: #00A000">+        for (i = 0; i < num_parms; i++) {</span>
<span style="color: #00A000">+        /**************************************************************************/</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                if (!strcasecmp(parm->var, "name")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        strcpy((char *)tmp_chan.name, parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an relay_channel named = %s\n", tmp_chan.name);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "type")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        if (!strcasecmp(parm->val, "listen")) {</span>
<span style="color: #00A000">+                                tmp_chan.type = LRY_CT_TCP_LISTEN;</span>
<span style="color: #00A000">+                                SS7_DEBUG("Found a type = LISTEN\n");</span>
<span style="color: #00A000">+                        } else if (!strcasecmp(parm->val, "server")) {</span>
<span style="color: #00A000">+                                tmp_chan.type = LRY_CT_TCP_SERVER;</span>
<span style="color: #00A000">+                                SS7_DEBUG("Found a type = SERVER\n");</span>
<span style="color: #00A000">+                        } else if (!strcasecmp(parm->val, "client")) {</span>
<span style="color: #00A000">+                                tmp_chan.type = LRY_CT_TCP_CLIENT;</span>
<span style="color: #00A000">+                                SS7_DEBUG("Found a type = CLIENT\n");</span>
<span style="color: #00A000">+                        } else {</span>
<span style="color: #00A000">+                                SS7_ERROR("Found an invalid \"type\" = %s\n", parm->var);</span>
<span style="color: #00A000">+                                return FTDM_FAIL;</span>
<span style="color: #00A000">+                        }</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "hostname")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        strcpy((char *)tmp_chan.hostname, parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found a hostname = %s\n", tmp_chan.hostname);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "port")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        tmp_chan.port = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found a port = %d\n", tmp_chan.port);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "procId")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        tmp_chan.procId = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found a procId = %d\n", tmp_chan.procId);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        SS7_ERROR("Found an invalid parameter \"%s\"!\n", parm->val);</span>
<span style="color: #00A000">+                        return FTDM_FAIL;</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                /* move to the next parmeter */</span>
<span style="color: #00A000">+                parm = parm + 1;</span>
<span style="color: #00A000">+        } /* for (i = 0; i < num_parms; i++) */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* store the channel in the global structure */</span>
<span style="color: #00A000">+        ftmod_ss7_fill_in_relay_channel(&tmp_chan);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return FTDM_SUCCESS;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/******************************************************************************/</span>
<span style="color: #00A000">+static int ftmod_ss7_parse_mtp1_links(ftdm_conf_node_t *mtp1_links)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        ftdm_conf_node_t        *mtp1_link = NULL;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* confirm that we are looking at mtp1_links */</span>
<span style="color: #00A000">+        if (strcasecmp(mtp1_links->name, "mtp1_links")) {</span>
<span style="color: #00A000">+                SS7_ERROR("We're looking at \"%s\"...but we're supposed to be looking at \"mtp1_links\"!\n",mtp1_links->name);</span>
<span style="color: #00A000">+                return FTDM_FAIL;</span>
<span style="color: #00A000">+        } else {</span>
<span style="color: #00A000">+                SS7_DEBUG("Parsing \"mtp1_links\"...\n");</span>
        }
        /* extract the mtp_links */
<span style="color: #A00000">-        mtp_linkset = mtp_linksets->child;</span>
<span style="color: #00A000">+        mtp1_link = mtp1_links->child;</span>
<span style="color: #A00000">-        /* run through all of the mtp_linksets found */</span>
<span style="color: #A00000">-        while (mtp_linkset != NULL) {</span>
<span style="color: #A00000">-                /* try to the parse mtp_linkset */</span>
<span style="color: #A00000">-                if (ftmod_ss7_parse_mtp_linkset(mtp_linkset)) {</span>
<span style="color: #A00000">-                        SS7_ERROR("Failed to parse \"mtp_linkset\"!\n");</span>
<span style="color: #00A000">+        /* run through all of the links found */</span>
<span style="color: #00A000">+        while (mtp1_link != NULL) {</span>
<span style="color: #00A000">+                /* try to the parse mtp_link */</span>
<span style="color: #00A000">+                if (ftmod_ss7_parse_mtp1_link(mtp1_link)) {</span>
<span style="color: #00A000">+                        SS7_ERROR("Failed to parse \"mtp1_link\"!\n");</span>
                        return FTDM_FAIL;
                }
<span style="color: #A00000">-                /* move on to the next linkset */</span>
<span style="color: #A00000">-                mtp_linkset = mtp_linkset->next;</span>
<span style="color: #00A000">+                /* move on to the next link */</span>
<span style="color: #00A000">+                mtp1_link = mtp1_link->next;</span>
        } /* while (mtp_linkset != NULL) */
<span style="color: #800080; font-weight: bold">@@ -365,413 +623,611 @@ static int ftmod_ss7_parse_mtp_linksets(ftdm_conf_node_t *mtp_linksets)</span>
}
/******************************************************************************/
<span style="color: #A00000">-static int ftmod_ss7_parse_mtp_linkset(ftdm_conf_node_t *mtp_linkset)</span>
<span style="color: #00A000">+static int ftmod_ss7_parse_mtp1_link(ftdm_conf_node_t *mtp1_link)</span>
{
<span style="color: #A00000">-        ftdm_conf_parameter_t        *parm = mtp_linkset->parameters;</span>
<span style="color: #A00000">-        int                                                num_parms = mtp_linkset->n_parameters;</span>
<span style="color: #A00000">-        ftdm_conf_node_t                *mtp_link = NULL;</span>
<span style="color: #A00000">-        sng_mtp_link_t                        mtpLink[MAX_MTP_LINKS+1];</span>
<span style="color: #A00000">-        sng_link_set_t                        mtpLinkSet;</span>
<span style="color: #A00000">-        int                                                count;</span>
<span style="color: #A00000">-        int                                                i;</span>
<span style="color: #00A000">+        sng_mtp1_link_t                         mtp1Link;</span>
<span style="color: #00A000">+        ftdm_conf_parameter_t        *parm = mtp1_link->parameters;</span>
<span style="color: #00A000">+        int                                                 num_parms = mtp1_link->n_parameters;</span>
<span style="color: #00A000">+        int                                                 i;</span>
<span style="color: #A00000">-        /* initialize the mtp_link structures */</span>
<span style="color: #A00000">-        for (i = 0; i < (MAX_MTP_LINKS + 1); i++) {</span>
<span style="color: #A00000">-                memset(&mtpLink[i], 0x0, sizeof(mtpLink[i]));</span>
<span style="color: #A00000">-        }</span>
<span style="color: #A00000">-        memset(&mtpLinkSet, 0x0, sizeof(mtpLinkSet));</span>
<span style="color: #00A000">+        /* initalize the mtp1Link structure */</span>
<span style="color: #00A000">+        memset(&mtp1Link, 0x0, sizeof(mtp1Link));</span>
<span style="color: #A00000">-        /* confirm that we are looking at mtp_linkset */</span>
<span style="color: #A00000">-        if (strcasecmp(mtp_linkset->name, "mtp_linkset")) {</span>
<span style="color: #A00000">-                SS7_ERROR("We're looking at \"%s\"...but we're supposed to be looking at \"mtp_linkset\"!\n",mtp_linkset->name);</span>
<span style="color: #00A000">+        /* confirm that we are looking at an mtp_link */</span>
<span style="color: #00A000">+        if (strcasecmp(mtp1_link->name, "mtp1_link")) {</span>
<span style="color: #00A000">+                SS7_ERROR("We're looking at \"%s\"...but we're supposed to be looking at \"mtp1_link\"!\n",mtp1_link->name);</span>
                return FTDM_FAIL;
        } else {
<span style="color: #A00000">-                SS7_DEBUG("Parsing \"mtp_linkset\"...\n");</span>
<span style="color: #00A000">+                SS7_DEBUG("Parsing \"mtp1_link\"...\n");</span>
        }
<span style="color: #A00000">-        /* extract all the information from the parameters */</span>
        for (i = 0; i < num_parms; i++) {
<span style="color: #A00000">-                /**********************************************************************/</span>
<span style="color: #00A000">+        /**************************************************************************/</span>
<span style="color: #00A000">+</span>
                if (!strcasecmp(parm->var, "name")) {
<span style="color: #A00000">-                        strncpy((char *)mtpLinkSet.name, parm->val, MAX_NAME_LEN-1);</span>
<span style="color: #A00000">-                        SS7_DEBUG("\tFound an \"mtp_linkset\" named = %s\n", mtpLinkSet.name);</span>
                /**********************************************************************/
<span style="color: #A00000">-                } else if (!strcasecmp(parm->var, "apc")) {</span>
<span style="color: #A00000">-                        mtpLinkSet.apc = atoi(parm->val);</span>
<span style="color: #A00000">-                        SS7_DEBUG("\tFound mtpLinkSet->apc = %d\n", mtpLinkSet.apc);</span>
<span style="color: #00A000">+                        strcpy((char *)mtp1Link.name, parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtp1_link named = %s\n", mtp1Link.name);</span>
                /**********************************************************************/
<span style="color: #A00000">-                } else if (!strcasecmp(parm->var, "minActive")) {</span>
<span style="color: #A00000">-                        mtpLinkSet.minActive = atoi(parm->val);</span>
<span style="color: #A00000">-                        SS7_DEBUG("\tFound mtpLinkSet->minActive = %d\n", mtpLinkSet.minActive);</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "id")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        mtp1Link.id = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtp1_link id = %d\n", mtp1Link.id);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "span")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        mtp1Link.span = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtp1_link span = %d\n", mtp1Link.span);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "chan")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        mtp1Link.chan = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtp1_link chan = %d\n", mtp1Link.chan);</span>
                /**********************************************************************/
                } else {
<span style="color: #00A000">+                /**********************************************************************/</span>
                        SS7_ERROR("\tFound an invalid parameter \"%s\"!\n", parm->val);
                        return FTDM_FAIL;
<span style="color: #00A000">+                /**********************************************************************/</span>
                }
                /* move to the next parmeter */
                parm = parm + 1;
<span style="color: #00A000">+        /**************************************************************************/</span>
        } /* for (i = 0; i < num_parms; i++) */
<span style="color: #A00000">-        /* grab the first mtp-link (which sits below the mtp_links section) */</span>
<span style="color: #A00000">-        mtp_link = mtp_linkset->child->child;</span>
<span style="color: #00A000">+        /* store the link in global structure */</span>
<span style="color: #00A000">+        ftmod_ss7_fill_in_mtp1_link(&mtp1Link);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return FTDM_SUCCESS;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/******************************************************************************/</span>
<span style="color: #00A000">+static int ftmod_ss7_parse_mtp2_links(ftdm_conf_node_t *mtp2_links)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        ftdm_conf_node_t        *mtp2_link = NULL;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* confirm that we are looking at mtp2_links */</span>
<span style="color: #00A000">+        if (strcasecmp(mtp2_links->name, "mtp2_links")) {</span>
<span style="color: #00A000">+                SS7_ERROR("We're looking at \"%s\"...but we're supposed to be looking at \"mtp2_links\"!\n",mtp2_links->name);</span>
<span style="color: #00A000">+                return FTDM_FAIL;</span>
<span style="color: #00A000">+        } else {</span>
<span style="color: #00A000">+                SS7_DEBUG("Parsing \"mtp2_links\"...\n");</span>
<span style="color: #00A000">+        }</span>
<span style="color: #A00000">-        /* initalize the link counter */</span>
<span style="color: #A00000">-        count = 0;</span>
<span style="color: #00A000">+        /* extract the mtp_links */</span>
<span style="color: #00A000">+        mtp2_link = mtp2_links->child;</span>
<span style="color: #A00000">-        /* run through all of the mtp_links found */</span>
<span style="color: #A00000">-        while (mtp_link != NULL) {</span>
<span style="color: #00A000">+        /* run through all of the links found */</span>
<span style="color: #00A000">+        while (mtp2_link != NULL) {</span>
                /* try to the parse mtp_linkset */
<span style="color: #A00000">-                if (ftmod_ss7_parse_mtp_link(mtp_link, &mtpLink[count] )) {</span>
<span style="color: #A00000">-                        SS7_ERROR("Failed to parse \"mtp_link\"!\n");</span>
<span style="color: #00A000">+                if (ftmod_ss7_parse_mtp2_link(mtp2_link)) {</span>
<span style="color: #00A000">+                        SS7_ERROR("Failed to parse \"mtp2_link\"!\n");</span>
                        return FTDM_FAIL;
                }
<span style="color: #A00000">-                /* incremenet the link counter */</span>
<span style="color: #A00000">-                count++;</span>
<span style="color: #A00000">-</span>
                /* move on to the next link */
<span style="color: #A00000">-                mtp_link = mtp_link->next;</span>
<span style="color: #00A000">+                mtp2_link = mtp2_link->next;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        } /* while (mtp_linkset != NULL) */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return FTDM_SUCCESS;</span>
<span style="color: #00A000">+}</span>
<span style="color: #A00000">-        } /* while (mtp_link != NULL) */</span>
<span style="color: #00A000">+/******************************************************************************/</span>
<span style="color: #00A000">+static int ftmod_ss7_parse_mtp2_link(ftdm_conf_node_t *mtp2_link)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        sng_mtp2_link_t                         mtp2Link;</span>
<span style="color: #00A000">+        ftdm_conf_parameter_t        *parm = mtp2_link->parameters;</span>
<span style="color: #00A000">+        int                                                 num_parms = mtp2_link->n_parameters;</span>
<span style="color: #00A000">+        int                                                 i;</span>
<span style="color: #00A000">+        int                                                ret;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* initalize the mtp1Link structure */</span>
<span style="color: #00A000">+        memset(&mtp2Link, 0x0, sizeof(mtp2Link));</span>
<span style="color: #A00000">-        /* confirm we have the right number of links */</span>
<span style="color: #A00000">-        if (count < 1 || count > 15 ) {</span>
<span style="color: #A00000">-                SS7_ERROR("Invalid number of mtp_links found (%d)\n", count);</span>
<span style="color: #00A000">+        /* confirm that we are looking at an mtp2_link */</span>
<span style="color: #00A000">+        if (strcasecmp(mtp2_link->name, "mtp2_link")) {</span>
<span style="color: #00A000">+                SS7_ERROR("We're looking at \"%s\"...but we're supposed to be looking at \"mtp2_link\"!\n",mtp2_link->name);</span>
                return FTDM_FAIL;
<span style="color: #00A000">+        } else {</span>
<span style="color: #00A000">+                SS7_DEBUG("Parsing \"mtp2_link\"...\n");</span>
        }
<span style="color: #A00000">-        /* now we need to see if this linkset exists already or not and grab an Id */</span>
<span style="color: #A00000">-        i = 1;</span>
<span style="color: #A00000">-        while (g_ftdm_sngss7_data.cfg.mtpLinkSet[i].id != 0) {</span>
<span style="color: #A00000">-                if (!strcasecmp((const char *)g_ftdm_sngss7_data.cfg.mtpLinkSet[i].name, (const char *)mtpLinkSet.name)) {</span>
<span style="color: #A00000">-                        /* we've found the linkset...so it has already been configured */</span>
<span style="color: #A00000">-                        break;</span>
<span style="color: #00A000">+        for (i = 0; i < num_parms; i++) {</span>
<span style="color: #00A000">+        /**************************************************************************/</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                if (!strcasecmp(parm->var, "name")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        strcpy((char *)mtp2Link.name, parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtp2_link named = %s\n", mtp2Link.name);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "id")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        mtp2Link.id = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtp2_link id = %d\n", mtp2Link.id);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "mtp1Id")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        mtp2Link.mtp1Id = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtp2_link mtp1Id = %d\n", mtp2Link.mtp1Id);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "errorType")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        ret = find_mtp2_error_type_in_map(parm->val);</span>
<span style="color: #00A000">+                        if (ret == -1) {</span>
<span style="color: #00A000">+                                SS7_ERROR("Found an invalid mtp2_link errorType = %s\n", parm->var);</span>
<span style="color: #00A000">+                                return FTDM_FAIL;</span>
<span style="color: #00A000">+                        } else {</span>
<span style="color: #00A000">+                                mtp2Link.errorType = sng_mtp2_error_type_map[ret].tril_type;</span>
<span style="color: #00A000">+                                SS7_DEBUG("Found an mtp2_link errorType = %s\n", sng_mtp2_error_type_map[ret].sng_type);</span>
<span style="color: #00A000">+                        }</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "lssuLength")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        mtp2Link.lssuLength = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtp2_link lssuLength = %d\n", mtp2Link.lssuLength);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "linkType")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        ret = find_link_type_in_map(parm->val);</span>
<span style="color: #00A000">+                        if (ret == -1) {</span>
<span style="color: #00A000">+                                SS7_ERROR("Found an invalid mtp2_link linkType = %s\n", parm->var);</span>
<span style="color: #00A000">+                                return FTDM_FAIL;</span>
<span style="color: #00A000">+                        } else {</span>
<span style="color: #00A000">+                                mtp2Link.linkType = sng_link_type_map[ret].tril_mtp2_type;</span>
<span style="color: #00A000">+                                SS7_DEBUG("Found an mtp2_link linkType = %s\n", sng_link_type_map[ret].sng_type);</span>
<span style="color: #00A000">+                        }</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "t1")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        mtp2Link.t1 = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtp2 t1 = \"%d\"\n",mtp2Link.t1);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "t2")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        mtp2Link.t2 = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtp2 t2 = \"%d\"\n",mtp2Link.t2);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "t3")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        mtp2Link.t3 = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtp2 t3 = \"%d\"\n",mtp2Link.t3);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "t4n")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        mtp2Link.t4n = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtp2 t4n = \"%d\"\n",mtp2Link.t4n);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "t4e")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        mtp2Link.t4e = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtp2 t4e = \"%d\"\n",mtp2Link.t4e);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "t5")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        mtp2Link.t5 = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtp2 t5 = \"%d\"\n",mtp2Link.t5);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "t6")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        mtp2Link.t6 = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtp2 t6 = \"%d\"\n",mtp2Link.t6);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "t7")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        mtp2Link.t7 = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtp2 t7 = \"%d\"\n",mtp2Link.t7);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        SS7_ERROR("Found an invalid parameter \"%s\"!\n", parm->val);</span>
<span style="color: #00A000">+                        return FTDM_FAIL;</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
                }
<span style="color: #A00000">-                i++;</span>
<span style="color: #A00000">-                /* add in error check to make sure we don't go out-of-bounds */</span>
<span style="color: #A00000">-        }</span>
<span style="color: #A00000">-        /* if the id value is 0 that means we didn't find the linkset */</span>
<span style="color: #A00000">-        if (g_ftdm_sngss7_data.cfg.mtpLinkSet[i].id == 0) {</span>
<span style="color: #A00000">-                mtpLinkSet.id = i;</span>
<span style="color: #A00000">-                SS7_DEBUG("found new mtpLinkSet, id is = %d\n", mtpLinkSet.id);</span>
<span style="color: #A00000">-        } else {</span>
<span style="color: #A00000">-                mtpLinkSet.id = i;</span>
<span style="color: #A00000">-                SS7_DEBUG("found existing mtpLinkSet, id is = %d\n", mtpLinkSet.id);</span>
<span style="color: #A00000">-        }</span>
<span style="color: #00A000">+                /* move to the next parmeter */</span>
<span style="color: #00A000">+                parm = parm + 1;</span>
<span style="color: #A00000">-        /* we now have all the information to fill in the Libsng_ss7 structures */</span>
<span style="color: #A00000">-        i = 0;</span>
<span style="color: #A00000">-        count = 0;</span>
<span style="color: #A00000">-        while (mtpLink[i].mtp1.span != 0 ){</span>
<span style="color: #00A000">+        /**************************************************************************/</span>
<span style="color: #00A000">+        } /* for (i = 0; i < num_parms; i++) */</span>
<span style="color: #A00000">-                /* have to grab a couple of values from the linkset */</span>
<span style="color: #A00000">-                mtpLink[i].mtp3.apc                        = mtpLinkSet.apc;</span>
<span style="color: #A00000">-                mtpLink[i].mtp3.linkSetId        = mtpLinkSet.id;</span>
<span style="color: #00A000">+        /* store the link in global structure */</span>
<span style="color: #00A000">+        ftmod_ss7_fill_in_mtp2_link(&mtp2Link);</span>
<span style="color: #A00000">-                ftmod_ss7_fill_in_mtpLink(&mtpLink[i]);</span>
<span style="color: #00A000">+        return FTDM_SUCCESS;</span>
<span style="color: #00A000">+}</span>
<span style="color: #A00000">-                /* increment the links counter */</span>
<span style="color: #A00000">-                count++;</span>
<span style="color: #00A000">+/******************************************************************************/</span>
<span style="color: #00A000">+static int ftmod_ss7_parse_mtp3_links(ftdm_conf_node_t *mtp3_links)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        ftdm_conf_node_t        *mtp3_link = NULL;</span>
<span style="color: #A00000">-                /* increment the index value */</span>
<span style="color: #A00000">-                i++;</span>
<span style="color: #00A000">+        /* confirm that we are looking at mtp3_links */</span>
<span style="color: #00A000">+        if (strcasecmp(mtp3_links->name, "mtp3_links")) {</span>
<span style="color: #00A000">+                SS7_ERROR("We're looking at \"%s\"...but we're supposed to be looking at \"mtp3_links\"!\n",mtp3_links->name);</span>
<span style="color: #00A000">+                return FTDM_FAIL;</span>
<span style="color: #00A000">+        } else {</span>
<span style="color: #00A000">+                SS7_DEBUG("Parsing \"mtp3_links\"...\n");</span>
        }
<span style="color: #A00000">-        mtpLinkSet.linkType                = mtpLink[0].mtp3.linkType;</span>
<span style="color: #A00000">-        mtpLinkSet.switchType        = mtpLink[0].mtp3.switchType;</span>
<span style="color: #A00000">-        mtpLinkSet.ssf                        = mtpLink[0].mtp3.ssf;</span>
<span style="color: #00A000">+        /* extract the mtp_links */</span>
<span style="color: #00A000">+        mtp3_link = mtp3_links->child;</span>
<span style="color: #A00000">-        ftmod_ss7_fill_in_mtpLinkSet(&mtpLinkSet);</span>
<span style="color: #00A000">+        /* run through all of the links found */</span>
<span style="color: #00A000">+        while (mtp3_link != NULL) {</span>
<span style="color: #00A000">+                /* try to the parse mtp_linkset */</span>
<span style="color: #00A000">+                if (ftmod_ss7_parse_mtp3_link(mtp3_link)) {</span>
<span style="color: #00A000">+                        SS7_ERROR("Failed to parse \"mtp3_link\"!\n");</span>
<span style="color: #00A000">+                        return FTDM_FAIL;</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                /* move on to the next link */</span>
<span style="color: #00A000">+                mtp3_link = mtp3_link->next;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        } /* while (mtp_linkset != NULL) */</span>
        return FTDM_SUCCESS;
}
/******************************************************************************/
<span style="color: #A00000">-static int ftmod_ss7_parse_mtp_link(ftdm_conf_node_t *mtp_link, sng_mtp_link_t *mtpLink)</span>
<span style="color: #00A000">+static int ftmod_ss7_parse_mtp3_link(ftdm_conf_node_t *mtp3_link)</span>
{
<span style="color: #A00000">-        ftdm_conf_parameter_t        *parm = mtp_link->parameters;</span>
<span style="color: #A00000">-        int                                                 num_parms = mtp_link->n_parameters;</span>
<span style="color: #00A000">+        sng_mtp3_link_t                         mtp3Link;</span>
<span style="color: #00A000">+        ftdm_conf_parameter_t        *parm = mtp3_link->parameters;</span>
<span style="color: #00A000">+        int                                                 num_parms = mtp3_link->n_parameters;</span>
        int                                                 i;
<span style="color: #A00000">-        </span>
<span style="color: #00A000">+        int                                                ret;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* initalize the mtp3Link structure */</span>
<span style="color: #00A000">+        memset(&mtp3Link, 0x0, sizeof(mtp3Link));</span>
<span style="color: #00A000">+</span>
        /* confirm that we are looking at an mtp_link */
<span style="color: #A00000">-        if (strcasecmp(mtp_link->name, "mtp_link")) {</span>
<span style="color: #A00000">-                SS7_ERROR("We're looking at \"%s\"...but we're supposed to be looking at \"mtp_link\"!\n",mtp_link->name);</span>
<span style="color: #00A000">+        if (strcasecmp(mtp3_link->name, "mtp3_link")) {</span>
<span style="color: #00A000">+                SS7_ERROR("We're looking at \"%s\"...but we're supposed to be looking at \"mtp3_link\"!\n",mtp3_link->name);</span>
                return FTDM_FAIL;
        } else {
<span style="color: #A00000">-                SS7_DEBUG("Parsing \"mtp_link\"...\n");</span>
<span style="color: #00A000">+                SS7_DEBUG("Parsing \"mtp3_link\"...\n");</span>
        }
<span style="color: #A00000">-        </span>
<span style="color: #00A000">+</span>
        for (i = 0; i < num_parms; i++) {
<span style="color: #A00000">-                /* try to match the parameter to what we expect */</span>
<span style="color: #A00000">-                /**********************************************************************/</span>
<span style="color: #00A000">+        /**************************************************************************/</span>
                if (!strcasecmp(parm->var, "name")) {
<span style="color: #A00000">-                        strncpy((char *)mtpLink->name, parm->val, MAX_NAME_LEN-1);</span>
<span style="color: #A00000">-                        SS7_DEBUG("\tFound an \"mtp_link\" named = %s\n", mtpLink->name);</span>
                /**********************************************************************/
<span style="color: #A00000">-                } else if (!strcasecmp(parm->var, "span")) {</span>
<span style="color: #A00000">-                        mtpLink->mtp1.span = atoi(parm->val);</span>
<span style="color: #A00000">-                        SS7_DEBUG("\tFound mtpLink->span = %d\n", mtpLink->mtp1.span);</span>
<span style="color: #00A000">+                        strcpy((char *)mtp3Link.name, parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtp3_link named = %s\n", mtp3Link.name);</span>
                /**********************************************************************/
<span style="color: #A00000">-                } else if (!strcasecmp(parm->var, "chan")) {</span>
<span style="color: #A00000">-                        mtpLink->mtp1.chan = atoi(parm->val);</span>
<span style="color: #A00000">-                        SS7_DEBUG("\tFound mtpLink->chan = %d\n", mtpLink->mtp1.chan);</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "id")) {</span>
                /**********************************************************************/
<span style="color: #A00000">-                } else if (!strcasecmp(parm->var, "errorType")) {</span>
<span style="color: #A00000">-                        if (!strcasecmp(parm->val, "basic")) {</span>
<span style="color: #A00000">-                                mtpLink->mtp2.errorType = SD_ERR_NRM;</span>
<span style="color: #A00000">-                        } else if (!strcasecmp(parm->val, "pcr")) {</span>
<span style="color: #A00000">-                                mtpLink->mtp2.errorType = SD_ERR_CYC;</span>
<span style="color: #A00000">-                        } else {</span>
<span style="color: #A00000">-                                SS7_ERROR("\tFound an invalid \"errorType\" = %s\n", parm->var);</span>
<span style="color: #A00000">-                                return FTDM_FAIL;</span>
<span style="color: #A00000">-                        }</span>
<span style="color: #A00000">-                        SS7_DEBUG("\tFound mtpLink->errorType=%s\n", parm->val);</span>
<span style="color: #00A000">+                        mtp3Link.id = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtp3_link id = %d\n", mtp3Link.id);</span>
                /**********************************************************************/
<span style="color: #A00000">-                } else if (!strcasecmp(parm->var, "lssuLength")) {</span>
<span style="color: #A00000">-                        mtpLink->mtp2.lssuLength = atoi(parm->val);</span>
<span style="color: #A00000">-                        if ((mtpLink->mtp2.lssuLength != 1) && (mtpLink->mtp2.lssuLength != 2)) {</span>
<span style="color: #A00000">-                                SS7_ERROR("\tFound an invalid \"lssuLength\" = %d\n", mtpLink->mtp2.lssuLength);</span>
<span style="color: #A00000">-                                return FTDM_FAIL;</span>
<span style="color: #A00000">-                        } else {</span>
<span style="color: #A00000">-                                SS7_DEBUG("\tFound mtpLink->lssuLength=%d\n", mtpLink->mtp2.lssuLength);</span>
<span style="color: #A00000">-                        }</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "mtp2Id")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        mtp3Link.mtp2Id = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtp3_link mtp2Id = %d\n", mtp3Link.mtp2Id);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "mtp2ProcId")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        mtp3Link.mtp2ProcId = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtp3_link mtp2ProcId = %d\n", mtp3Link.mtp2ProcId);</span>
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "priority")) {
<span style="color: #A00000">-                        mtpLink->mtp3.priority = atoi(parm->val);</span>
<span style="color: #A00000">-                        if ((mtpLink->mtp3.priority == 0) || (mtpLink->mtp3.priority == 1) || </span>
<span style="color: #A00000">-                                (mtpLink->mtp3.priority == 2) || (mtpLink->mtp3.priority == 3)) {</span>
<span style="color: #A00000">-                                SS7_DEBUG("\tFound mtpLink->priority = %d\n",mtpLink->mtp3.priority);</span>
<span style="color: #A00000">-                        } else {</span>
<span style="color: #A00000">-                                SS7_ERROR("\tFound an invalid \"priority\"=%d\n",mtpLink->mtp3.priority);</span>
<span style="color: #A00000">-                                return FTDM_FAIL;</span>
<span style="color: #A00000">-                        } </span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        mtp3Link.priority = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtp3 Link priority = %d\n",mtp3Link.priority); </span>
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "linkType")) {
<span style="color: #A00000">-                        if (!strcasecmp(parm->val, "itu92")) {</span>
<span style="color: #A00000">-                                mtpLink->mtp2.linkType = LSD_SW_ITU92;</span>
<span style="color: #A00000">-                                mtpLink->mtp3.linkType = LSN_SW_ITU;</span>
<span style="color: #A00000">-                                SS7_DEBUG("\tFound mtpLink->linkType = \"ITU92\"\n");</span>
<span style="color: #A00000">-                        } else if (!strcasecmp(parm->val, "itu88")) {</span>
<span style="color: #A00000">-                                mtpLink->mtp2.linkType = LSD_SW_ITU88;</span>
<span style="color: #A00000">-                                mtpLink->mtp3.linkType = LSN_SW_ITU;</span>
<span style="color: #A00000">-                                SS7_DEBUG("\tFound mtpLink->linkType = \"ITU88\"\n");</span>
<span style="color: #A00000">-                        } else if (!strcasecmp(parm->val, "ansi96")) {</span>
<span style="color: #A00000">-                                mtpLink->mtp2.linkType = LSD_SW_ANSI92;</span>
<span style="color: #A00000">-                                mtpLink->mtp3.linkType = LSN_SW_ANS96;</span>
<span style="color: #A00000">-                                SS7_DEBUG("\tFound mtpLink->linkType = \"ANSI96\"\n");</span>
<span style="color: #A00000">-                        } else if (!strcasecmp(parm->val, "ansi92")) {</span>
<span style="color: #A00000">-                                mtpLink->mtp2.linkType = LSD_SW_ANSI92;</span>
<span style="color: #A00000">-                                mtpLink->mtp3.linkType = LSN_SW_ANS;</span>
<span style="color: #A00000">-                                SS7_DEBUG("\tFound mtpLink->linkType = \"ANSI92\"\n");</span>
<span style="color: #A00000">-                        } else if (!strcasecmp(parm->val, "ansi88")) {</span>
<span style="color: #A00000">-                                mtpLink->mtp2.linkType = LSD_SW_ANSI88;</span>
<span style="color: #A00000">-                                mtpLink->mtp3.linkType = LSN_SW_ANS;</span>
<span style="color: #A00000">-                                SS7_DEBUG("\tFound mtpLink->linkType = \"ANSI88\"\n");</span>
<span style="color: #A00000">-                        } else if (!strcasecmp(parm->val, "etsi")) {</span>
<span style="color: #A00000">-                                mtpLink->mtp2.linkType = LSD_SW_ITU92;</span>
<span style="color: #A00000">-                                mtpLink->mtp3.linkType = LSN_SW_ITU;</span>
<span style="color: #A00000">-                                SS7_DEBUG("\tFound mtpLink->linkType = \"ETSI\"\n");</span>
<span style="color: #A00000">-                        } else {</span>
<span style="color: #A00000">-                                SS7_ERROR("\tFound an invalid linktype of \"%s\"!\n", parm->val);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        ret = find_link_type_in_map(parm->val);</span>
<span style="color: #00A000">+                        if (ret == -1) {</span>
<span style="color: #00A000">+                                SS7_ERROR("Found an invalid mtp3_link linkType = %s\n", parm->var);</span>
                                return FTDM_FAIL;
<span style="color: #00A000">+                        } else {</span>
<span style="color: #00A000">+                                mtp3Link.linkType = sng_link_type_map[ret].tril_mtp3_type;</span>
<span style="color: #00A000">+                                SS7_DEBUG("Found an mtp3_link linkType = %s\n", sng_link_type_map[ret].sng_type);</span>
                        }
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "switchType")) {
<span style="color: #A00000">-                        if (!strcasecmp(parm->val, "itu97")) {</span>
<span style="color: #A00000">-                                mtpLink->mtp3.switchType = LSI_SW_ITU97;</span>
<span style="color: #A00000">-                                SS7_DEBUG("\tFound mtpLink->switchType = \"ITU97\"\n");</span>
<span style="color: #A00000">-                        } else if (!strcasecmp(parm->val, "itu88")) {</span>
<span style="color: #A00000">-                                mtpLink->mtp3.switchType = LSI_SW_ITU;</span>
<span style="color: #A00000">-                                SS7_DEBUG("\tFound mtpLink->switchType = \"ITU88\"\n");</span>
<span style="color: #A00000">-                        } else if (!strcasecmp(parm->val, "itu92")) {</span>
<span style="color: #A00000">-                                mtpLink->mtp3.switchType = LSI_SW_ITU;</span>
<span style="color: #A00000">-                                SS7_DEBUG("\tFound mtpLink->switchType = \"ITU92\"\n");</span>
<span style="color: #A00000">-                        } else if (!strcasecmp(parm->val, "itu00")) {</span>
<span style="color: #A00000">-                                mtpLink->mtp3.switchType = LSI_SW_ITU2000;</span>
<span style="color: #A00000">-                                SS7_DEBUG("\tFound mtpLink->switchType = \"ITU00\"\n");</span>
<span style="color: #A00000">-                        } else if (!strcasecmp(parm->val, "ETSIV2")) {</span>
<span style="color: #A00000">-                                mtpLink->mtp3.switchType = LSI_SW_ETSI;</span>
<span style="color: #A00000">-                                SS7_DEBUG("\tFound mtpLink->switchType = \"ETSIV2\"\n");</span>
<span style="color: #A00000">-                        } else if (!strcasecmp(parm->val, "ETSIV3")) {</span>
<span style="color: #A00000">-                                mtpLink->mtp3.switchType = LSI_SW_ETSIV3;</span>
<span style="color: #A00000">-                                SS7_DEBUG("\tFound mtpLink->switchType = \"ETSIV3\"\n");</span>
<span style="color: #A00000">-                        } else if (!strcasecmp(parm->val, "UK")) {</span>
<span style="color: #A00000">-                                mtpLink->mtp3.switchType = LSI_SW_UK;</span>
<span style="color: #A00000">-                                SS7_DEBUG("\tFound mtpLink->switchType = \"UK\"\n");</span>
<span style="color: #A00000">-                        } else if (!strcasecmp(parm->val, "RUSSIA")) {</span>
<span style="color: #A00000">-                                mtpLink->mtp3.switchType = LSI_SW_RUSSIA;</span>
<span style="color: #A00000">-                                SS7_DEBUG("\tFound mtpLink->switchType = \"RUSSIA\"\n");</span>
<span style="color: #A00000">-                        } else if (!strcasecmp(parm->val, "INDIA")) {</span>
<span style="color: #A00000">-                                mtpLink->mtp3.switchType = LSI_SW_INDIA;</span>
<span style="color: #A00000">-                                SS7_DEBUG("\tFound mtpLink->switchType = \"INDIA\"\n");</span>
<span style="color: #A00000">-                        } else if (!strcasecmp(parm->val, "ansi88")) {</span>
<span style="color: #A00000">-                                mtpLink->mtp3.switchType = LSI_SW_ANS88;</span>
<span style="color: #A00000">-                                SS7_DEBUG("\tFound mtpLink->switchType = \"ANSI88\"\n");</span>
<span style="color: #A00000">-                        } else if (!strcasecmp(parm->val, "ansi92")) {</span>
<span style="color: #A00000">-                                mtpLink->mtp3.switchType = LSI_SW_ANS92;</span>
<span style="color: #A00000">-                                SS7_DEBUG("\tFound mtpLink->switchType = \"ANSI92\"\n");</span>
<span style="color: #A00000">-                        } else if (!strcasecmp(parm->val, "ansi95")) {</span>
<span style="color: #A00000">-                                mtpLink->mtp3.switchType = LSI_SW_ANS95;</span>
<span style="color: #A00000">-                                SS7_DEBUG("\tFound mtpLink->switchType = \"ANSI95\"\n");</span>
<span style="color: #A00000">-                        } else {</span>
<span style="color: #A00000">-                                SS7_ERROR("\tFound an invalid linktype of \"%s\"!\n", parm->val);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        ret = find_switch_type_in_map(parm->val);</span>
<span style="color: #00A000">+                        if (ret == -1) {</span>
<span style="color: #00A000">+                                SS7_ERROR("Found an invalid mtp3_link switchType = %s\n", parm->var);</span>
                                return FTDM_FAIL;
<span style="color: #00A000">+                        } else {</span>
<span style="color: #00A000">+                                mtp3Link.switchType = sng_switch_type_map[ret].tril_mtp3_type;</span>
<span style="color: #00A000">+                                SS7_DEBUG("Found an mtp3_link switchType = %s\n", sng_switch_type_map[ret].sng_type);</span>
                        }
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "ssf")) {
<span style="color: #A00000">-                        if (!strcasecmp(parm->val, "nat")) {</span>
<span style="color: #A00000">-                                mtpLink->mtp3.ssf = SSF_NAT;</span>
<span style="color: #A00000">-                        } else if (!strcasecmp(parm->val, "int")) {</span>
<span style="color: #A00000">-                                mtpLink->mtp3.ssf = SSF_INTL;</span>
<span style="color: #A00000">-                        } else if (!strcasecmp(parm->val, "spare")) {</span>
<span style="color: #A00000">-                                mtpLink->mtp3.ssf = SSF_SPARE;</span>
<span style="color: #A00000">-                        } else if (!strcasecmp(parm->val, "res")) {</span>
<span style="color: #A00000">-                                mtpLink->mtp3.ssf = SSF_RES;</span>
<span style="color: #A00000">-                        } else {</span>
<span style="color: #A00000">-                                SS7_ERROR("\tFound an invalid ssf of \"%s\"!\n", parm->val);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        ret = find_ssf_type_in_map(parm->val);</span>
<span style="color: #00A000">+                        if (ret == -1) {</span>
<span style="color: #00A000">+                                SS7_ERROR("Found an invalid mtp3_link ssf = %s\n", parm->var);</span>
                                return FTDM_FAIL;
<span style="color: #00A000">+                        } else {</span>
<span style="color: #00A000">+                                mtp3Link.ssf = sng_ssf_type_map[ret].tril_type;</span>
<span style="color: #00A000">+                                SS7_DEBUG("Found an mtp3_link ssf = %s\n", sng_ssf_type_map[ret].sng_type);</span>
                        }
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "slc")) {
<span style="color: #A00000">-                        mtpLink->mtp3.slc = atoi(parm->val);</span>
<span style="color: #A00000">-                        SS7_DEBUG("\tFound mtpLink->slc = \"%d\"\n",mtpLink->mtp3.slc);</span>
                /**********************************************************************/
<span style="color: #A00000">-                } else if (!strcasecmp(parm->var, "mtp2.t1")) {</span>
<span style="color: #A00000">-                        mtpLink->mtp2.t1 = atoi(parm->val);</span>
<span style="color: #A00000">-                        SS7_DEBUG("\tFound mtp2 t1 = \"%d\"\n",mtpLink->mtp2.t1);</span>
<span style="color: #00A000">+                        mtp3Link.slc = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtp3 Link slc = %d\n",mtp3Link.slc);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "linkset")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        mtp3Link.linkSetId = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtp3 Link linkset = %d\n",mtp3Link.linkSetId);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "t1")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        mtp3Link.t1 = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtp3 t1 = %d\n",mtp3Link.t1);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "t2")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        mtp3Link.t2 = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtp3 t2 = %d\n",mtp3Link.t2);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "t3")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        mtp3Link.t3 = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtp3 t3 = %d\n",mtp3Link.t3);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "t4")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        mtp3Link.t4 = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtp3 t4 = %d\n",mtp3Link.t4);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "t5")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        mtp3Link.t5 = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtp3 t5 = %d\n",mtp3Link.t5);</span>
                /**********************************************************************/
<span style="color: #A00000">-                } else if (!strcasecmp(parm->var, "mtp2.t2")) {</span>
<span style="color: #A00000">-                        mtpLink->mtp2.t2 = atoi(parm->val);</span>
<span style="color: #A00000">-                        SS7_DEBUG("\tFound mtp2 t2 = \"%d\"\n",mtpLink->mtp2.t2);</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "t7")) {</span>
                /**********************************************************************/
<span style="color: #A00000">-                } else if (!strcasecmp(parm->var, "mtp2.t3")) {</span>
<span style="color: #A00000">-                        mtpLink->mtp2.t3 = atoi(parm->val);</span>
<span style="color: #A00000">-                        SS7_DEBUG("\tFound mtp2 t3 = \"%d\"\n",mtpLink->mtp2.t3);</span>
<span style="color: #00A000">+                        mtp3Link.t7 = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtp3 t7 = %d\n",mtp3Link.t7);</span>
                /**********************************************************************/
<span style="color: #A00000">-                } else if (!strcasecmp(parm->var, "mtp2.t4n")) {</span>
<span style="color: #A00000">-                        mtpLink->mtp2.t4n = atoi(parm->val);</span>
<span style="color: #A00000">-                        SS7_DEBUG("\tFound mtp2 t4n = \"%d\"\n",mtpLink->mtp2.t4n);</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "t12")) {</span>
                /**********************************************************************/
<span style="color: #A00000">-                } else if (!strcasecmp(parm->var, "mtp2.t4e")) {</span>
<span style="color: #A00000">-                        mtpLink->mtp2.t4e = atoi(parm->val);</span>
<span style="color: #A00000">-                        SS7_DEBUG("\tFound mtp2 t4e = \"%d\"\n",mtpLink->mtp2.t4e);</span>
<span style="color: #00A000">+                        mtp3Link.t12 = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtp3 t12 = %d\n",mtp3Link.t12);</span>
                /**********************************************************************/
<span style="color: #A00000">-                } else if (!strcasecmp(parm->var, "mtp2.t5")) {</span>
<span style="color: #A00000">-                        mtpLink->mtp2.t5 = atoi(parm->val);</span>
<span style="color: #A00000">-                        SS7_DEBUG("\tFound mtp2 t5 = \"%d\"\n",mtpLink->mtp2.t5);</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "t13")) {</span>
                /**********************************************************************/
<span style="color: #A00000">-                } else if (!strcasecmp(parm->var, "mtp2.t6")) {</span>
<span style="color: #A00000">-                        mtpLink->mtp2.t6 = atoi(parm->val);</span>
<span style="color: #A00000">-                        SS7_DEBUG("\tFound mtp2 t6 = \"%d\"\n",mtpLink->mtp2.t6);</span>
<span style="color: #00A000">+                        mtp3Link.t13 = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtp3 t13 = %d\n",mtp3Link.t13);</span>
                /**********************************************************************/
<span style="color: #A00000">-                } else if (!strcasecmp(parm->var, "mtp2.t7")) {</span>
<span style="color: #A00000">-                        mtpLink->mtp2.t7 = atoi(parm->val);</span>
<span style="color: #A00000">-                        SS7_DEBUG("\tFound mtp2 t7 = \"%d\"\n",mtpLink->mtp2.t7);</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "t14")) {</span>
                /**********************************************************************/
<span style="color: #A00000">-                } else if (!strcasecmp(parm->var, "mtp3.t1")) {</span>
<span style="color: #A00000">-                        mtpLink->mtp3.t1 = atoi(parm->val);</span>
<span style="color: #A00000">-                        SS7_DEBUG("\tFound mtp3 t1 = \"%d\"\n",mtpLink->mtp3.t1);</span>
<span style="color: #00A000">+                        mtp3Link.t14 = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtp3 t14 = %d\n",mtp3Link.t14);</span>
                /**********************************************************************/
<span style="color: #A00000">-                } else if (!strcasecmp(parm->var, "mtp3.t2")) {</span>
<span style="color: #A00000">-                        mtpLink->mtp3.t2 = atoi(parm->val);</span>
<span style="color: #A00000">-                        SS7_DEBUG("\tFound mtp3 t2 = \"%d\"\n",mtpLink->mtp3.t2);</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "t17")) {</span>
                /**********************************************************************/
<span style="color: #A00000">-                } else if (!strcasecmp(parm->var, "mtp3.t3")) {</span>
<span style="color: #A00000">-                        mtpLink->mtp3.t3 = atoi(parm->val);</span>
<span style="color: #A00000">-                        SS7_DEBUG("\tFound mtp3 t3 = \"%d\"\n",mtpLink->mtp3.t3);</span>
<span style="color: #00A000">+                        mtp3Link.t17 = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtp3 t17 = %d\n",mtp3Link.t17);</span>
                /**********************************************************************/
<span style="color: #A00000">-                } else if (!strcasecmp(parm->var, "mtp3.t4")) {</span>
<span style="color: #A00000">-                        mtpLink->mtp3.t4 = atoi(parm->val);</span>
<span style="color: #A00000">-                        SS7_DEBUG("\tFound mtp3 t4 = \"%d\"\n",mtpLink->mtp3.t4);</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "t22")) {</span>
                /**********************************************************************/
<span style="color: #A00000">-                } else if (!strcasecmp(parm->var, "mtp3.t5")) {</span>
<span style="color: #A00000">-                        mtpLink->mtp3.t5 = atoi(parm->val);</span>
<span style="color: #A00000">-                        SS7_DEBUG("\tFound mtp3 t5 = \"%d\"\n",mtpLink->mtp3.t5);</span>
<span style="color: #00A000">+                        mtp3Link.t22 = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtp3 t22 = %d\n",mtp3Link.t22);</span>
                /**********************************************************************/
<span style="color: #A00000">-                } else if (!strcasecmp(parm->var, "mtp3.t7")) {</span>
<span style="color: #A00000">-                        mtpLink->mtp3.t7 = atoi(parm->val);</span>
<span style="color: #A00000">-                        SS7_DEBUG("\tFound mtp3 t7 = \"%d\"\n",mtpLink->mtp3.t7);</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "t23")) {</span>
                /**********************************************************************/
<span style="color: #A00000">-                } else if (!strcasecmp(parm->var, "mtp3.t12")) {</span>
<span style="color: #A00000">-                        mtpLink->mtp3.t12 = atoi(parm->val);</span>
<span style="color: #A00000">-                        SS7_DEBUG("\tFound mtp3 t12 = \"%d\"\n",mtpLink->mtp3.t12);</span>
<span style="color: #00A000">+                        mtp3Link.t23 = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtp3 t23 = %d\n",mtp3Link.t23);</span>
                /**********************************************************************/
<span style="color: #A00000">-                } else if (!strcasecmp(parm->var, "mtp3.t13")) {</span>
<span style="color: #A00000">-                        mtpLink->mtp3.t13 = atoi(parm->val);</span>
<span style="color: #A00000">-                        SS7_DEBUG("\tFound mtp3 t13 = \"%d\"\n",mtpLink->mtp3.t13);</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "t24")) {</span>
                /**********************************************************************/
<span style="color: #A00000">-                } else if (!strcasecmp(parm->var, "mtp3.t14")) {</span>
<span style="color: #A00000">-                        mtpLink->mtp3.t14 = atoi(parm->val);</span>
<span style="color: #A00000">-                        SS7_DEBUG("\tFound mtp3 t14 = \"%d\"\n",mtpLink->mtp3.t14);</span>
<span style="color: #00A000">+                        mtp3Link.t24 = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtp3 t24 = %d\n",mtp3Link.t24);</span>
                /**********************************************************************/
<span style="color: #A00000">-                } else if (!strcasecmp(parm->var, "mtp3.t17")) {</span>
<span style="color: #A00000">-                        mtpLink->mtp3.t17 = atoi(parm->val);</span>
<span style="color: #A00000">-                        SS7_DEBUG("\tFound mtp3 t17 = \"%d\"\n",mtpLink->mtp3.t17);</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "t31")) {</span>
<span style="color: #00A000">+                        mtp3Link.t31 = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtp3 t31 = %d\n",mtp3Link.t31);</span>
                /**********************************************************************/
<span style="color: #A00000">-                } else if (!strcasecmp(parm->var, "mtp3.t22")) {</span>
<span style="color: #A00000">-                        mtpLink->mtp3.t22 = atoi(parm->val);</span>
<span style="color: #A00000">-                        SS7_DEBUG("\tFound mtp3 t22 = \"%d\"\n",mtpLink->mtp3.t22);</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "t32")) {</span>
                /**********************************************************************/
<span style="color: #A00000">-                } else if (!strcasecmp(parm->var, "mtp3.t23")) {</span>
<span style="color: #A00000">-                        mtpLink->mtp3.t23 = atoi(parm->val);</span>
<span style="color: #A00000">-                        SS7_DEBUG("\tFound mtp3 t23 = \"%d\"\n",mtpLink->mtp3.t23);</span>
<span style="color: #00A000">+                        mtp3Link.t32 = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtp3 t32 = %d\n",mtp3Link.t32);</span>
                /**********************************************************************/
<span style="color: #A00000">-                } else if (!strcasecmp(parm->var, "mtp3.t24")) {</span>
<span style="color: #A00000">-                        mtpLink->mtp3.t24 = atoi(parm->val);</span>
<span style="color: #A00000">-                        SS7_DEBUG("\tFound mtp3 t24 = \"%d\"\n",mtpLink->mtp3.t24);</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "t33")) {</span>
                /**********************************************************************/
<span style="color: #A00000">-                } else if (!strcasecmp(parm->var, "mtp3.t31")) {</span>
<span style="color: #A00000">-                        mtpLink->mtp3.t31 = atoi(parm->val);</span>
<span style="color: #A00000">-                        SS7_DEBUG("\tFound mtp3 t31 = \"%d\"\n",mtpLink->mtp3.t31);</span>
<span style="color: #00A000">+                        mtp3Link.t33 = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtp3 t33 = %d\n",mtp3Link.t33);</span>
                /**********************************************************************/
<span style="color: #A00000">-                } else if (!strcasecmp(parm->var, "mtp3.t32")) {</span>
<span style="color: #A00000">-                        mtpLink->mtp3.t32 = atoi(parm->val);</span>
<span style="color: #A00000">-                        SS7_DEBUG("\tFound mtp3 t32 = \"%d\"\n",mtpLink->mtp3.t32);</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "t34")) {</span>
                /**********************************************************************/
<span style="color: #A00000">-                } else if (!strcasecmp(parm->var, "mtp3.t33")) {</span>
<span style="color: #A00000">-                        mtpLink->mtp3.t33 = atoi(parm->val);</span>
<span style="color: #A00000">-                        SS7_DEBUG("\tFound mtp3 t33 = \"%d\"\n",mtpLink->mtp3.t33);</span>
<span style="color: #00A000">+                        mtp3Link.t34 = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtp3 t34 = %d\n",mtp3Link.t34);</span>
                /**********************************************************************/
<span style="color: #A00000">-                } else if (!strcasecmp(parm->var, "mtp3.t34")) {</span>
<span style="color: #A00000">-                        mtpLink->mtp3.t34 = atoi(parm->val);</span>
<span style="color: #A00000">-                        SS7_DEBUG("\tFound mtp3 t34 = \"%d\"\n",mtpLink->mtp3.t34);</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "t35")) {</span>
                /**********************************************************************/
<span style="color: #A00000">-                } else if (!strcasecmp(parm->var, "mtp3.t35")) {</span>
<span style="color: #A00000">-                        mtpLink->mtp3.t35 = atoi(parm->val);</span>
<span style="color: #A00000">-                        SS7_DEBUG("\tFound mtp3 t35 = \"%d\"\n",mtpLink->mtp3.t35);</span>
<span style="color: #00A000">+                        mtp3Link.t35 = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtp3 t35 = %d\n",mtp3Link.t35);</span>
                /**********************************************************************/
<span style="color: #A00000">-                } else if (!strcasecmp(parm->var, "mtp3.t36")) {</span>
<span style="color: #A00000">-                        mtpLink->mtp3.t36 = atoi(parm->val);</span>
<span style="color: #A00000">-                        SS7_DEBUG("\tFound mtp3 t36 = \"%d\"\n",mtpLink->mtp3.t36);</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "t36")) {</span>
                /**********************************************************************/
<span style="color: #A00000">-                } else if (!strcasecmp(parm->var, "mtp3.t37")) {</span>
<span style="color: #A00000">-                        mtpLink->mtp3.t37 = atoi(parm->val);</span>
<span style="color: #A00000">-                        SS7_DEBUG("\tFound mtp3 t37 = \"%d\"\n",mtpLink->mtp3.t37);</span>
<span style="color: #00A000">+                        mtp3Link.t36 = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtp3 t36 = %d\n",mtp3Link.t36);</span>
                /**********************************************************************/
<span style="color: #A00000">-                } else if (!strcasecmp(parm->var, "mtp3.tcraft")) {</span>
<span style="color: #A00000">-                        mtpLink->mtp3.tcraft = atoi(parm->val);</span>
<span style="color: #A00000">-                        SS7_DEBUG("\tFound mtp3 tcraft = \"%d\"\n",mtpLink->mtp3.tcraft);</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "t37")) {</span>
                /**********************************************************************/
<span style="color: #A00000">-                } else if (!strcasecmp(parm->var, "mtp3.tflc")) {</span>
<span style="color: #A00000">-                        mtpLink->mtp3.tflc = atoi(parm->val);</span>
<span style="color: #A00000">-                        SS7_DEBUG("\tFound mtp3 tflc = \"%d\"\n",mtpLink->mtp3.tflc);</span>
<span style="color: #00A000">+                        mtp3Link.t37 = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtp3 t37 = %d\n",mtp3Link.t37);</span>
                /**********************************************************************/
<span style="color: #A00000">-                } else if (!strcasecmp(parm->var, "mtp3.tbnd")) {</span>
<span style="color: #A00000">-                        mtpLink->mtp3.tbnd = atoi(parm->val);</span>
<span style="color: #A00000">-                        SS7_DEBUG("\tFound mtp3 tbnd = \"%d\"\n",mtpLink->mtp3.tbnd);</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "tcraft")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        mtp3Link.tcraft = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtp3 tcraft = %d\n",mtp3Link.tcraft);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "tflc")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        mtp3Link.tflc = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtp3 tflc = %d\n",mtp3Link.tflc);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "tbnd")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        mtp3Link.tbnd = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtp3 tbnd = %d\n",mtp3Link.tbnd);</span>
                /**********************************************************************/
                } else {
<span style="color: #A00000">-                        SS7_ERROR("\tFound an invalid parameter \"%s\"!\n", parm->val);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        SS7_ERROR("Found an invalid parameter %s!\n", parm->val);</span>
                        return FTDM_FAIL;
<span style="color: #00A000">+                /**********************************************************************/</span>
                }
<span style="color: #A00000">-        </span>
<span style="color: #A00000">-                /* move to the next parameter */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                /* move to the next parmeter */</span>
                parm = parm + 1;
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /**************************************************************************/</span>
<span style="color: #00A000">+        } /* for (i = 0; i < num_parms; i++) */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* store the link in global structure */</span>
<span style="color: #00A000">+        ftmod_ss7_fill_in_mtp3_link(&mtp3Link);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* move the linktype, switchtype and ssf to the linkset */</span>
<span style="color: #00A000">+        if (g_ftdm_sngss7_data.cfg.mtpLinkSet[mtp3Link.linkSetId].linkType == 0) {</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtpLinkSet[mtp3Link.linkSetId].linkType = mtp3Link.linkType;</span>
<span style="color: #00A000">+        } else if (g_ftdm_sngss7_data.cfg.mtpLinkSet[mtp3Link.linkSetId].linkType != mtp3Link.linkType) {</span>
<span style="color: #00A000">+                SS7_ERROR("Trying to add an MTP3 Link to a Linkset with a different linkType: mtp3.id=%d, mtp3.name=%s, mtp3.linktype=%d, linkset.id=%d, linkset.linktype=%d\n",</span>
<span style="color: #00A000">+                                        mtp3Link.id, mtp3Link.name, mtp3Link.linkType,</span>
<span style="color: #00A000">+                                        g_ftdm_sngss7_data.cfg.mtpLinkSet[mtp3Link.linkSetId].id, g_ftdm_sngss7_data.cfg.mtpLinkSet[mtp3Link.linkSetId].linkType);</span>
<span style="color: #00A000">+                return FTDM_FAIL;</span>
<span style="color: #00A000">+        } else {</span>
<span style="color: #00A000">+                /* should print that all is ok...*/</span>
        }
<span style="color: #A00000">-        </span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if (g_ftdm_sngss7_data.cfg.mtpLinkSet[mtp3Link.linkSetId].switchType == 0) {</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtpLinkSet[mtp3Link.linkSetId].switchType = mtp3Link.switchType;</span>
<span style="color: #00A000">+        } else if (g_ftdm_sngss7_data.cfg.mtpLinkSet[mtp3Link.linkSetId].switchType != mtp3Link.switchType) {</span>
<span style="color: #00A000">+                SS7_ERROR("Trying to add an MTP3 Link to a Linkset with a different switchType: mtp3.id=%d, mtp3.name=%s, mtp3.switchtype=%d, linkset.id=%d, linkset.switchtype=%d\n",</span>
<span style="color: #00A000">+                                        mtp3Link.id, mtp3Link.name, mtp3Link.switchType,</span>
<span style="color: #00A000">+                                        g_ftdm_sngss7_data.cfg.mtpLinkSet[mtp3Link.linkSetId].id, g_ftdm_sngss7_data.cfg.mtpLinkSet[mtp3Link.linkSetId].switchType);</span>
<span style="color: #00A000">+                return FTDM_FAIL;</span>
<span style="color: #00A000">+        } else {</span>
<span style="color: #00A000">+                /* should print that all is ok...*/</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if (g_ftdm_sngss7_data.cfg.mtpLinkSet[mtp3Link.linkSetId].ssf == 0) {</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtpLinkSet[mtp3Link.linkSetId].ssf = mtp3Link.ssf;</span>
<span style="color: #00A000">+        } else if (g_ftdm_sngss7_data.cfg.mtpLinkSet[mtp3Link.linkSetId].ssf != mtp3Link.ssf) {</span>
<span style="color: #00A000">+                SS7_ERROR("Trying to add an MTP3 Link to a Linkset with a different ssf: mtp3.id=%d, mtp3.name=%s, mtp3.ssf=%d, linkset.id=%d, linkset.ssf=%d\n",</span>
<span style="color: #00A000">+                                        mtp3Link.id, mtp3Link.name, mtp3Link.ssf,</span>
<span style="color: #00A000">+                                        g_ftdm_sngss7_data.cfg.mtpLinkSet[mtp3Link.linkSetId].id, g_ftdm_sngss7_data.cfg.mtpLinkSet[mtp3Link.linkSetId].ssf);</span>
<span style="color: #00A000">+                return FTDM_FAIL;</span>
<span style="color: #00A000">+        } else {</span>
<span style="color: #00A000">+                /* should print that all is ok...*/</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return FTDM_SUCCESS;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/******************************************************************************/</span>
<span style="color: #00A000">+static int ftmod_ss7_parse_mtp_linksets(ftdm_conf_node_t *mtp_linksets)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        ftdm_conf_node_t        *mtp_linkset = NULL;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* confirm that we are looking at mtp_linksets */</span>
<span style="color: #00A000">+        if (strcasecmp(mtp_linksets->name, "mtp_linksets")) {</span>
<span style="color: #00A000">+                SS7_ERROR("We're looking at \"%s\"...but we're supposed to be looking at \"mtp_linksets\"!\n",mtp_linksets->name);</span>
<span style="color: #00A000">+                return FTDM_FAIL;</span>
<span style="color: #00A000">+        } else {</span>
<span style="color: #00A000">+                SS7_DEBUG("Parsing \"mtp_linksets\"...\n");</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* extract the mtp_links */</span>
<span style="color: #00A000">+        mtp_linkset = mtp_linksets->child;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* run through all of the mtp_linksets found */</span>
<span style="color: #00A000">+        while (mtp_linkset != NULL) {</span>
<span style="color: #00A000">+                /* try to the parse mtp_linkset */</span>
<span style="color: #00A000">+                if (ftmod_ss7_parse_mtp_linkset(mtp_linkset)) {</span>
<span style="color: #00A000">+                        SS7_ERROR("Failed to parse \"mtp_linkset\"!\n");</span>
<span style="color: #00A000">+                        return FTDM_FAIL;</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                /* move on to the next linkset */</span>
<span style="color: #00A000">+                mtp_linkset = mtp_linkset->next;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        } /* while (mtp_linkset != NULL) */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return FTDM_SUCCESS;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/******************************************************************************/</span>
<span style="color: #00A000">+static int ftmod_ss7_parse_mtp_linkset(ftdm_conf_node_t *mtp_linkset)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        sng_link_set_t                         mtpLinkSet;</span>
<span style="color: #00A000">+        ftdm_conf_parameter_t        *parm = mtp_linkset->parameters;</span>
<span style="color: #00A000">+        int                                                 num_parms = mtp_linkset->n_parameters;</span>
<span style="color: #00A000">+        int                                                 i;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* initalize the mtpLinkSet structure */</span>
<span style="color: #00A000">+        memset(&mtpLinkSet, 0x0, sizeof(mtpLinkSet));</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* confirm that we are looking at mtp_linkset */</span>
<span style="color: #00A000">+        if (strcasecmp(mtp_linkset->name, "mtp_linkset")) {</span>
<span style="color: #00A000">+                SS7_ERROR("We're looking at \"%s\"...but we're supposed to be looking at \"mtp_linkset\"!\n",mtp_linkset->name);</span>
<span style="color: #00A000">+                return FTDM_FAIL;</span>
<span style="color: #00A000">+        } else {</span>
<span style="color: #00A000">+                SS7_DEBUG("Parsing \"mtp_linkset\"...\n");</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* extract all the information from the parameters */</span>
<span style="color: #00A000">+        for (i = 0; i < num_parms; i++) {</span>
<span style="color: #00A000">+        /**************************************************************************/</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                if (!strcasecmp(parm->var, "name")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        strcpy((char *)mtpLinkSet.name, parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtpLinkSet named = %s\n", mtpLinkSet.name);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "id")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        mtpLinkSet.id = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found mtpLinkSet id = %d\n", mtpLinkSet.id);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "apc")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        mtpLinkSet.apc = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found mtpLinkSet apc = %d\n", mtpLinkSet.apc);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "minActive")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        mtpLinkSet.minActive = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found mtpLinkSet minActive = %d\n", mtpLinkSet.minActive);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        SS7_ERROR("Found an invalid parameter \"%s\"!\n", parm->val);</span>
<span style="color: #00A000">+                        return FTDM_FAIL;</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                /* move to the next parmeter */</span>
<span style="color: #00A000">+                parm = parm + 1;</span>
<span style="color: #00A000">+        /**************************************************************************/</span>
<span style="color: #00A000">+        } /* for (i = 0; i < num_parms; i++) */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        ftmod_ss7_fill_in_mtpLinkSet(&mtpLinkSet);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* go through all the mtp3 links and fill in the apc */</span>
<span style="color: #00A000">+        i = 1;</span>
<span style="color: #00A000">+        while (g_ftdm_sngss7_data.cfg.mtp3Link[i].id != 0) {</span>
<span style="color: #00A000">+                if (g_ftdm_sngss7_data.cfg.mtp3Link[i].linkSetId == mtpLinkSet.id) {</span>
<span style="color: #00A000">+                        g_ftdm_sngss7_data.cfg.mtp3Link[i].apc = mtpLinkSet.apc;</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                i++;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
        return FTDM_SUCCESS;
}
<span style="color: #800080; font-weight: bold">@@ -813,6 +1269,7 @@ static int ftmod_ss7_parse_mtp_route(ftdm_conf_node_t *mtp_route)</span>
        int                                                 num_parms = mtp_route->n_parameters;
        int                                                 i;
<span style="color: #00A000">+        /* initalize the mtpRoute structure */</span>
        memset(&mtpRoute, 0x0, sizeof(mtpRoute));
        /* confirm that we are looking at an mtp_link */
<span style="color: #800080; font-weight: bold">@@ -824,119 +1281,120 @@ static int ftmod_ss7_parse_mtp_route(ftdm_conf_node_t *mtp_route)</span>
        }
        for (i = 0; i < num_parms; i++) {
<span style="color: #00A000">+        /**************************************************************************/</span>
<span style="color: #00A000">+</span>
                /* try to match the parameter to what we expect */
<span style="color: #A00000">-                /**********************************************************************/</span>
                if (!strcasecmp(parm->var, "name")) {
<span style="color: #A00000">-                        strncpy((char *)mtpRoute.name, parm->val, MAX_NAME_LEN-1);</span>
<span style="color: #A00000">-                        SS7_DEBUG("\tFound an \"mtp_route\" named = %s\n", mtpRoute.name);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        strcpy((char *)mtpRoute.name, parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtpRoute named = %s\n", mtpRoute.name);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "id")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        mtpRoute.id = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtpRoute id = %d\n", mtpRoute.id);</span>
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "dpc")) {
<span style="color: #00A000">+                /**********************************************************************/</span>
                        mtpRoute.dpc = atoi(parm->val);
<span style="color: #A00000">-                        SS7_DEBUG("\tFound mtpRoute->dpc = %d\n", mtpRoute.dpc);</span>
<span style="color: #A00000">-                /**********************************************************************/</span>
<span style="color: #A00000">-                } else if (!strcasecmp(parm->var, "mtp_linkset")) {</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                        /* find the linkset by it's name */</span>
<span style="color: #A00000">-                        int x = 1;</span>
<span style="color: #A00000">-                        while (g_ftdm_sngss7_data.cfg.mtpLinkSet[x].id != 0) {</span>
<span style="color: #A00000">-                                /* check if the name matches */</span>
<span style="color: #A00000">-                                if (!strcasecmp((char *)g_ftdm_sngss7_data.cfg.mtpLinkSet[x].name, parm->val)) {</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                                        /* now, harvest the required infomormation from the global structure */</span>
<span style="color: #A00000">-                                        mtpRoute.linkType                = g_ftdm_sngss7_data.cfg.mtpLinkSet[x].linkType;</span>
<span style="color: #A00000">-                                        mtpRoute.switchType                = g_ftdm_sngss7_data.cfg.mtpLinkSet[x].switchType;</span>
<span style="color: #A00000">-                                        mtpRoute.ssf                        = g_ftdm_sngss7_data.cfg.mtpLinkSet[x].ssf;</span>
<span style="color: #A00000">-                                        mtpRoute.linkSetId                = g_ftdm_sngss7_data.cfg.mtpLinkSet[x].id;</span>
<span style="color: #A00000">-                                        cmbLinkSetId++;</span>
<span style="color: #A00000">-                                        mtpRoute.cmbLinkSetId        = cmbLinkSetId;</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                                        /* update the linkset with the new cmbLinkSet value */</span>
<span style="color: #A00000">-                                        g_ftdm_sngss7_data.cfg.mtpLinkSet[x].numLinks++;</span>
<span style="color: #A00000">-                                        g_ftdm_sngss7_data.cfg.mtpLinkSet[x].links[g_ftdm_sngss7_data.cfg.mtpLinkSet[x].numLinks-1] = mtpRoute.cmbLinkSetId;</span>
<span style="color: #A00000">-                                        break;</span>
<span style="color: #A00000">-                                }</span>
<span style="color: #A00000">-                                x++;</span>
<span style="color: #A00000">-                        }</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                        /* check why we exited the wile loop ... and react accordingly */</span>
<span style="color: #A00000">-                        if (mtpRoute.cmbLinkSetId == 0) {</span>
<span style="color: #A00000">-                                SS7_ERROR("\tFailed to find the linkset = \"%s\"!\n", parm->val);</span>
<span style="color: #A00000">-                                return FTDM_FAIL;</span>
<span style="color: #A00000">-                        } else {</span>
<span style="color: #A00000">-                                SS7_DEBUG("\tFound mtp3_route->linkset = %s\n", parm->val);</span>
<span style="color: #A00000">-                        }</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtpRoute dpc = %d\n", mtpRoute.dpc);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "linksetId")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        mtpRoute.linkSetId = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtpRoute linkset = %s\n", parm->val);</span>
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "isSTP")) {
<span style="color: #00A000">+                /**********************************************************************/</span>
                        if (!strcasecmp(parm->val, "no")) {
                                mtpRoute.isSTP = 0;
<span style="color: #A00000">-                                SS7_DEBUG("\tFound mtpRoute->isSTP = no\n");</span>
<span style="color: #00A000">+                                SS7_DEBUG("Found an mtpRoute isSTP = no\n");</span>
                        } else if (!strcasecmp(parm->val, "yes")) {
                                mtpRoute.isSTP = 1;
<span style="color: #A00000">-                                SS7_DEBUG("\tFound mtpRoute->isSTP = yes\n");</span>
<span style="color: #00A000">+                                SS7_DEBUG("Found an mtpRoute isSTP = yes\n");</span>
                        } else {
<span style="color: #A00000">-                                SS7_ERROR("\tFound an invalid parameter for isSTP \"%s\"!\n", parm->val);</span>
<span style="color: #00A000">+                                SS7_ERROR("Found an invalid parameter for isSTP %s!\n", parm->val);</span>
                         return FTDM_FAIL;
                        }
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "mtp3.t6")) {
<span style="color: #00A000">+                /**********************************************************************/</span>
                        mtpRoute.t6 = atoi(parm->val);
<span style="color: #A00000">-                        SS7_DEBUG("\tFound mtp3 t6 = \"%d\"\n",mtpRoute.t6);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtp3 t6 = %d\n",mtpRoute.t6);</span>
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "mtp3.t8")) {
<span style="color: #00A000">+                /**********************************************************************/</span>
                        mtpRoute.t8 = atoi(parm->val);
<span style="color: #A00000">-                        SS7_DEBUG("\tFound mtp3 t8 = \"%d\"\n",mtpRoute.t8);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtp3 t8 = %d\n",mtpRoute.t8);</span>
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "mtp3.t10")) {
<span style="color: #00A000">+                /**********************************************************************/</span>
                        mtpRoute.t10 = atoi(parm->val);
<span style="color: #A00000">-                        SS7_DEBUG("\tFound mtp3 t10 = \"%d\"\n",mtpRoute.t10);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtp3 t10 = %d\n",mtpRoute.t10);</span>
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "mtp3.t11")) {
<span style="color: #00A000">+                /**********************************************************************/</span>
                        mtpRoute.t11 = atoi(parm->val);
<span style="color: #A00000">-                        SS7_DEBUG("\tFound mtp3 t11 = \"%d\"\n",mtpRoute.t11);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtp3 t11 = %d\n",mtpRoute.t11);</span>
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "mtp3.t15")) {
<span style="color: #00A000">+                /**********************************************************************/</span>
                        mtpRoute.t15 = atoi(parm->val);
<span style="color: #A00000">-                        SS7_DEBUG("\tFound mtp3 t15 = \"%d\"\n",mtpRoute.t15);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtp3 t15 = %d\n",mtpRoute.t15);</span>
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "mtp3.t16")) {
<span style="color: #00A000">+                /**********************************************************************/</span>
                        mtpRoute.t16 = atoi(parm->val);
<span style="color: #A00000">-                        SS7_DEBUG("\tFound mtp3 t16 = \"%d\"\n",mtpRoute.t16);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtp3 t16 = %d\n",mtpRoute.t16);</span>
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "mtp3.t18")) {
<span style="color: #00A000">+                /**********************************************************************/</span>
                        mtpRoute.t18 = atoi(parm->val);
<span style="color: #A00000">-                        SS7_DEBUG("\tFound mtp3 t18 = \"%d\"\n",mtpRoute.t18);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtp3 t18 = %d\n",mtpRoute.t18);</span>
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "mtp3.t19")) {
<span style="color: #00A000">+                /**********************************************************************/</span>
                        mtpRoute.t19 = atoi(parm->val);
<span style="color: #A00000">-                        SS7_DEBUG("\tFound mtp3 t19 = \"%d\"\n",mtpRoute.t19);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtp3 t19 = %d\n",mtpRoute.t19);</span>
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "mtp3.t21")) {
<span style="color: #00A000">+                /**********************************************************************/</span>
                        mtpRoute.t21 = atoi(parm->val);
<span style="color: #A00000">-                        SS7_DEBUG("\tFound mtp3 t21 = \"%d\"\n",mtpRoute.t21);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtp3 t21 = %d\n",mtpRoute.t21);</span>
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "mtp3.t25")) {
<span style="color: #00A000">+                /**********************************************************************/</span>
                        mtpRoute.t25 = atoi(parm->val);
<span style="color: #A00000">-                        SS7_DEBUG("\tFound mtp3 t25 = \"%d\"\n",mtpRoute.t25);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtp3 t25 = %d\n",mtpRoute.t25);</span>
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "mtp3.t26")) {
<span style="color: #00A000">+                /**********************************************************************/</span>
                        mtpRoute.t26 = atoi(parm->val);
<span style="color: #A00000">-                        SS7_DEBUG("\tFound mtp3 t26 = \"%d\"\n",mtpRoute.t26);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an mtp3 t26 = %d\n",mtpRoute.t26);</span>
                /**********************************************************************/
                } else {
<span style="color: #A00000">-                        SS7_ERROR("\tFound an invalid parameter \"%s\"!\n", parm->val);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        SS7_ERROR("Found an invalid parameter \"%s\"!\n", parm->val);</span>
                        return FTDM_FAIL;
<span style="color: #A00000">-</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
                }
                /* move to the next parameter */
                parm = parm + 1;
        }
<span style="color: #A00000">-        ftmod_ss7_fill_in_nsap(&mtpRoute);</span>
<span style="color: #00A000">+        /* pull up the linktype, switchtype, and SSF from the linkset */</span>
<span style="color: #00A000">+        mtpRoute.linkType = g_ftdm_sngss7_data.cfg.mtpLinkSet[mtpRoute.linkSetId].linkType;</span>
<span style="color: #00A000">+        mtpRoute.switchType = g_ftdm_sngss7_data.cfg.mtpLinkSet[mtpRoute.linkSetId].switchType;</span>
<span style="color: #00A000">+        mtpRoute.ssf = g_ftdm_sngss7_data.cfg.mtpLinkSet[mtpRoute.linkSetId].ssf;</span>
<span style="color: #A00000">-        ftmod_ss7_fill_in_mtp3_route(&mtpRoute);</span>
<span style="color: #00A000">+        /* fill in the rest of the values in the mtpRoute struct */</span>
<span style="color: #00A000">+        mtpRoute.nwId = mtpRoute.id;</span>
<span style="color: #00A000">+        mtpRoute.cmbLinkSetId = mtpRoute.id;</span>
<span style="color: #00A000">+        ftmod_ss7_fill_in_mtp3_route(&mtpRoute);</span>
<span style="color: #00A000">+        ftmod_ss7_fill_in_nsap(&mtpRoute);</span>
        return FTDM_SUCCESS;
}
<span style="color: #800080; font-weight: bold">@@ -979,10 +1437,9 @@ static int ftmod_ss7_parse_isup_interface(ftdm_conf_node_t *isup_interface)</span>
        ftdm_conf_parameter_t        *parm = isup_interface->parameters;
        int                                                num_parms = isup_interface->n_parameters;
        int                                                i;
<span style="color: #A00000">-        int                                                linkSetId;</span>
<span style="color: #A00000">-        int                                                flag_cld_nadi = 0;</span>
<span style="color: #A00000">-        int                                                flag_clg_nadi = 0;</span>
<span style="color: #00A000">+        int                                                ret;</span>
<span style="color: #00A000">+        /* initalize the isup intf and isap structure */</span>
        memset(&sng_isup, 0x0, sizeof(sng_isup));
        memset(&sng_isap, 0x0, sizeof(sng_isap));
<span style="color: #800080; font-weight: bold">@@ -996,56 +1453,30 @@ static int ftmod_ss7_parse_isup_interface(ftdm_conf_node_t *isup_interface)</span>
        for (i = 0; i < num_parms; i++) {
<span style="color: #00A000">+        /**************************************************************************/</span>
<span style="color: #00A000">+</span>
                /* try to match the parameter to what we expect */
<span style="color: #A00000">-                /**********************************************************************/</span>
                if (!strcasecmp(parm->var, "name")) {
<span style="color: #A00000">-                        strncpy((char *)sng_isup.name, parm->val, MAX_NAME_LEN-1);</span>
<span style="color: #A00000">-                        SS7_DEBUG("\tFound an \"isup_interface\" named = %s\n", sng_isup.name);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        strcpy((char *)sng_isup.name, parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an isup_interface named = %s\n", sng_isup.name);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "id")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        sng_isup.id = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an isup id = %d\n", sng_isup.id);</span>
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "spc")) {
<span style="color: #00A000">+                /**********************************************************************/</span>
                        sng_isup.spc = atoi(parm->val);
                        g_ftdm_sngss7_data.cfg.spc = sng_isup.spc;
<span style="color: #A00000">-                        SS7_DEBUG("\tFound SPC = %d\n", sng_isup.spc);</span>
<span style="color: #A00000">-                /**********************************************************************/</span>
<span style="color: #A00000">-                } else if (!strcasecmp(parm->var, "mtp_route")) {</span>
<span style="color: #A00000">-                        /* find the route by it's name */</span>
<span style="color: #A00000">-                        int x = 1;</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                        while (g_ftdm_sngss7_data.cfg.mtpRoute[x].id != 0) {</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                                /* check if the name matches */</span>
<span style="color: #A00000">-                                if (!strcasecmp((char *)g_ftdm_sngss7_data.cfg.mtpRoute[x].name, parm->val)) {</span>
<span style="color: #A00000">-                                        /* now, harvest the required information from the global structure */</span>
<span style="color: #A00000">-                                        sng_isup.mtpRouteId                = g_ftdm_sngss7_data.cfg.mtpRoute[x].id;</span>
<span style="color: #A00000">-                                        sng_isup.dpc                        = g_ftdm_sngss7_data.cfg.mtpRoute[x].dpc;</span>
<span style="color: #A00000">-                                        sng_isup.switchType                 = g_ftdm_sngss7_data.cfg.mtpRoute[x].switchType;</span>
<span style="color: #A00000">-                                        sng_isap.switchType                = g_ftdm_sngss7_data.cfg.mtpRoute[x].switchType;</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                                        /* find the NSAP corresponding to this switchType and SSF */</span>
<span style="color: #A00000">-                                        int z = 1;</span>
<span style="color: #A00000">-                                        while (g_ftdm_sngss7_data.cfg.nsap[z].id != 0) {</span>
<span style="color: #A00000">-                                                if ((g_ftdm_sngss7_data.cfg.nsap[z].linkType == g_ftdm_sngss7_data.cfg.mtpRoute[x].linkType) &&</span>
<span style="color: #A00000">-                                                        (g_ftdm_sngss7_data.cfg.nsap[z].switchType == g_ftdm_sngss7_data.cfg.mtpRoute[x].switchType) &&</span>
<span style="color: #A00000">-                                                        (g_ftdm_sngss7_data.cfg.nsap[z].ssf == g_ftdm_sngss7_data.cfg.mtpRoute[x].ssf)) {</span>
<span style="color: #A00000">-                                                                sng_isup.nwId         = g_ftdm_sngss7_data.cfg.nsap[z].nwId;</span>
<span style="color: #A00000">-                                                        /* we have a match so break out of this loop */</span>
<span style="color: #A00000">-                                                        break;</span>
<span style="color: #A00000">-                                                }</span>
<span style="color: #A00000">-                                                /* move on to the next one */</span>
<span style="color: #A00000">-                                                z++;</span>
<span style="color: #A00000">-                                        }</span>
<span style="color: #A00000">-                                        break;</span>
<span style="color: #A00000">-                                }</span>
<span style="color: #A00000">-                                x++;</span>
<span style="color: #A00000">-                        } /* while (g_ftdm_sngss7_data.cfg.mtpRoute[x].id != 0) */</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                        /* check why we exited the while loop ... and react accordingly */</span>
<span style="color: #A00000">-                        if (sng_isup.mtpRouteId == 0) {</span>
<span style="color: #A00000">-                                SS7_ERROR("\tFailed to find the MTP3 Route = \"%s\"!\n", parm->val);</span>
<span style="color: #A00000">-                                return FTDM_FAIL;</span>
<span style="color: #A00000">-                        } else {</span>
<span style="color: #A00000">-                                SS7_DEBUG("\tFound MTP3 Route = %s\n", parm->val);</span>
<span style="color: #A00000">-                        }</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an isup SPC = %d\n", sng_isup.spc);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "mtprouteId")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        sng_isup.mtpRouteId=atoi(parm->val);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an isup mptRouteId = %d\n", sng_isup.mtpRouteId);</span>
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "min_digits")) {
                        sng_isup.min_digits = atoi(parm->val);
<span style="color: #800080; font-weight: bold">@@ -1053,300 +1484,544 @@ static int ftmod_ss7_parse_isup_interface(ftdm_conf_node_t *isup_interface)</span>
                        SS7_DEBUG("\tFound min_digits = %d\n", sng_isup.min_digits);
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "ssf")) {
<span style="color: #A00000">-                        if (!strcasecmp(parm->val, "nat")) {</span>
<span style="color: #A00000">-                                sng_isup.ssf = SSF_NAT;</span>
<span style="color: #A00000">-                                sng_isap.ssf = SSF_NAT;</span>
<span style="color: #A00000">-                        } else if (!strcasecmp(parm->val, "int")) {</span>
<span style="color: #A00000">-                                sng_isup.ssf = SSF_INTL;</span>
<span style="color: #A00000">-                                sng_isap.ssf = SSF_INTL;</span>
<span style="color: #A00000">-                        } else if (!strcasecmp(parm->val, "spare")) {</span>
<span style="color: #A00000">-                                sng_isup.ssf = SSF_SPARE;</span>
<span style="color: #A00000">-                                sng_isap.ssf = SSF_SPARE;</span>
<span style="color: #A00000">-                        } else if (!strcasecmp(parm->val, "res")) {</span>
<span style="color: #A00000">-                                sng_isup.ssf = SSF_RES;</span>
<span style="color: #A00000">-                                sng_isap.ssf = SSF_RES;</span>
<span style="color: #A00000">-                        } else {</span>
<span style="color: #A00000">-                                SS7_ERROR("\tFound an invalid ssf of \"%s\"!\n", parm->val);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        ret = find_ssf_type_in_map(parm->val);</span>
<span style="color: #00A000">+                        if (ret == -1) {</span>
<span style="color: #00A000">+                                SS7_ERROR("Found an invalid isup ssf = %s\n", parm->var);</span>
                                return FTDM_FAIL;
<span style="color: #00A000">+                        } else {</span>
<span style="color: #00A000">+                                sng_isup.ssf = sng_ssf_type_map[ret].tril_type;</span>
<span style="color: #00A000">+                                sng_isap.ssf = sng_ssf_type_map[ret].tril_type;</span>
<span style="color: #00A000">+                                SS7_DEBUG("Found an isup ssf = %s\n", sng_ssf_type_map[ret].sng_type);</span>
                        }
                /**********************************************************************/
<span style="color: #A00000">-                } else if (!strcasecmp(parm->var, "license")) {</span>
<span style="color: #A00000">-                /**********************************************************************/</span>
<span style="color: #A00000">-                        strncpy(g_ftdm_sngss7_data.cfg.license, parm->val, MAX_PATH-1);</span>
<span style="color: #A00000">-                        strncpy(g_ftdm_sngss7_data.cfg.signature, parm->val, MAX_PATH-1);</span>
<span style="color: #A00000">-                        strcat(g_ftdm_sngss7_data.cfg.signature, ".sig");</span>
<span style="color: #A00000">-                        SS7_DEBUG("\tFound license file = %s\n", g_ftdm_sngss7_data.cfg.license);</span>
<span style="color: #A00000">-                        SS7_DEBUG("\tFound signature file = %s\n", g_ftdm_sngss7_data.cfg.signature);        </span>
<span style="color: #A00000">-                /**********************************************************************/</span>
                } else if (!strcasecmp(parm->var, "isup.t1")) {
<span style="color: #00A000">+                /**********************************************************************/</span>
                        sng_isap.t1 = atoi(parm->val);
<span style="color: #A00000">-                        SS7_DEBUG("\tFound isup t1 = \"%d\"\n",sng_isap.t1);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found isup t1 = %d\n",sng_isap.t1);</span>
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "isup.t2")) {
<span style="color: #00A000">+                /**********************************************************************/</span>
                        sng_isap.t2 = atoi(parm->val);
<span style="color: #A00000">-                        SS7_DEBUG("\tFound isup t2 = \"%d\"\n",sng_isap.t2);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found isup t2 = %d\n",sng_isap.t2);</span>
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "isup.t4")) {
<span style="color: #00A000">+                /**********************************************************************/</span>
                        sng_isup.t4 = atoi(parm->val);
<span style="color: #A00000">-                        SS7_DEBUG("\tFound isup t4 = \"%d\"\n",sng_isup.t4);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found isup t4 = %d\n",sng_isup.t4);</span>
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "isup.t5")) {
<span style="color: #00A000">+                /**********************************************************************/</span>
                        sng_isap.t5 = atoi(parm->val);
<span style="color: #A00000">-                        SS7_DEBUG("\tFound isup t5 = \"%d\"\n",sng_isap.t5);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found isup t5 = %d\n",sng_isap.t5);</span>
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "isup.t6")) {
<span style="color: #00A000">+                /**********************************************************************/</span>
                        sng_isap.t6 = atoi(parm->val);
<span style="color: #A00000">-                        SS7_DEBUG("\tFound isup t6 = \"%d\"\n",sng_isap.t6);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found isup t6 = %d\n",sng_isap.t6);</span>
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "isup.t7")) {
<span style="color: #00A000">+                /**********************************************************************/</span>
                        sng_isap.t7 = atoi(parm->val);
<span style="color: #A00000">-                        SS7_DEBUG("\tFound isup t7 = \"%d\"\n",sng_isap.t7);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found isup t7 = %d\n",sng_isap.t7);</span>
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "isup.t8")) {
<span style="color: #00A000">+                /**********************************************************************/</span>
                        sng_isap.t8 = atoi(parm->val);
<span style="color: #A00000">-                        SS7_DEBUG("\tFound isup t8 = \"%d\"\n",sng_isap.t8);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found isup t8 = %d\n",sng_isap.t8);</span>
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "isup.t9")) {
<span style="color: #00A000">+                /**********************************************************************/</span>
                        sng_isap.t9 = atoi(parm->val);
<span style="color: #A00000">-                        SS7_DEBUG("\tFound isup t9 = \"%d\"\n",sng_isap.t9);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found isup t9 = %d\n",sng_isap.t9);</span>
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "isup.t10")) {
<span style="color: #00A000">+                /**********************************************************************/</span>
                        sng_isup.t10 = atoi(parm->val);
<span style="color: #A00000">-                        SS7_DEBUG("\tFound isup t10 = \"%d\"\n",sng_isup.t10);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found isup t10 = %d\n",sng_isup.t10);</span>
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "isup.t11")) {
<span style="color: #00A000">+                /**********************************************************************/</span>
                        sng_isup.t11 = atoi(parm->val);
<span style="color: #A00000">-                        SS7_DEBUG("\tFound isup t11 = \"%d\"\n",sng_isup.t11);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found isup t11 = %d\n",sng_isup.t11);</span>
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "isup.t18")) {
<span style="color: #00A000">+                /**********************************************************************/</span>
                        sng_isup.t18 = atoi(parm->val);
<span style="color: #A00000">-                        SS7_DEBUG("\tFound isup t18 = \"%d\"\n",sng_isup.t18);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found isup t18 = %d\n",sng_isup.t18);</span>
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "isup.t19")) {
<span style="color: #00A000">+                /**********************************************************************/</span>
                        sng_isup.t19 = atoi(parm->val);
<span style="color: #A00000">-                        SS7_DEBUG("\tFound isup t19 = \"%d\"\n",sng_isup.t19);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found isup t19 = %d\n",sng_isup.t19);</span>
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "isup.t20")) {
<span style="color: #00A000">+                /**********************************************************************/</span>
                        sng_isup.t20 = atoi(parm->val);
<span style="color: #A00000">-                        SS7_DEBUG("\tFound isup t20 = \"%d\"\n",sng_isup.t20);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found isup t20 = %d\n",sng_isup.t20);</span>
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "isup.t21")) {
<span style="color: #00A000">+                /**********************************************************************/</span>
                        sng_isup.t21 = atoi(parm->val);
<span style="color: #A00000">-                        SS7_DEBUG("\tFound isup t21 = \"%d\"\n",sng_isup.t21);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found isup t21 = %d\n",sng_isup.t21);</span>
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "isup.t22")) {
<span style="color: #00A000">+                /**********************************************************************/</span>
                        sng_isup.t22 = atoi(parm->val);
<span style="color: #A00000">-                        SS7_DEBUG("\tFound isup t22 = \"%d\"\n",sng_isup.t22);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found isup t22 = %d\n",sng_isup.t22);</span>
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "isup.t23")) {
<span style="color: #00A000">+                /**********************************************************************/</span>
                        sng_isup.t23 = atoi(parm->val);
<span style="color: #A00000">-                        SS7_DEBUG("\tFound isup t23 = \"%d\"\n",sng_isup.t23);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found isup t23 = %d\n",sng_isup.t23);</span>
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "isup.t24")) {
<span style="color: #00A000">+                /**********************************************************************/</span>
                        sng_isup.t24 = atoi(parm->val);
<span style="color: #A00000">-                        SS7_DEBUG("\tFound isup t24 = \"%d\"\n",sng_isup.t24);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found isup t24 = %d\n",sng_isup.t24);</span>
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "isup.t25")) {
<span style="color: #00A000">+                /**********************************************************************/</span>
                        sng_isup.t25 = atoi(parm->val);
<span style="color: #A00000">-                        SS7_DEBUG("\tFound isup t25 = \"%d\"\n",sng_isup.t25);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found isup t25 = %d\n",sng_isup.t25);</span>
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "isup.t26")) {
<span style="color: #00A000">+                /**********************************************************************/</span>
                        sng_isup.t26 = atoi(parm->val);
<span style="color: #A00000">-                        SS7_DEBUG("\tFound isup t26 = \"%d\"\n",sng_isup.t26);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found isup t26 = %d\n",sng_isup.t26);</span>
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "isup.t28")) {
<span style="color: #00A000">+                /**********************************************************************/</span>
                        sng_isup.t28 = atoi(parm->val);
<span style="color: #A00000">-                        SS7_DEBUG("\tFound isup t28 = \"%d\"\n",sng_isup.t28);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found isup t28 = %d\n",sng_isup.t28);</span>
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "isup.t29")) {
<span style="color: #00A000">+                /**********************************************************************/</span>
                        sng_isup.t29 = atoi(parm->val);
<span style="color: #A00000">-                        SS7_DEBUG("\tFound isup t29 = \"%d\"\n",sng_isup.t29);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found isup t29 = %d\n",sng_isup.t29);</span>
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "isup.t30")) {
<span style="color: #00A000">+                /**********************************************************************/</span>
                        sng_isup.t30 = atoi(parm->val);
<span style="color: #A00000">-                        SS7_DEBUG("\tFound isup t30 = \"%d\"\n",sng_isup.t30);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found isup t30 = %d\n",sng_isup.t30);</span>
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "isup.t31")) {
<span style="color: #00A000">+                /**********************************************************************/</span>
                        sng_isap.t31 = atoi(parm->val);
<span style="color: #A00000">-                        SS7_DEBUG("\tFound isup t31 = \"%d\"\n",sng_isap.t31);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found isup t31 = %d\n",sng_isap.t31);</span>
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "isup.t32")) {
<span style="color: #00A000">+                /**********************************************************************/</span>
                        sng_isup.t32 = atoi(parm->val);
<span style="color: #A00000">-                        SS7_DEBUG("\tFound isup t32 = \"%d\"\n",sng_isup.t32);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found isup t32 = %d\n",sng_isup.t32);</span>
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "isup.t33")) {
<span style="color: #00A000">+                /**********************************************************************/</span>
                        sng_isap.t33 = atoi(parm->val);
<span style="color: #A00000">-                        SS7_DEBUG("\tFound isup t33 = \"%d\"\n",sng_isap.t33);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found isup t33 = %d\n",sng_isap.t33);</span>
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "isup.t34")) {
<span style="color: #A00000">-                        sng_isap.t34 = atoi(parm->val);</span>
<span style="color: #A00000">-                        SS7_DEBUG("\tFound isup t34 = \"%d\"\n",sng_isap.t34);</span>
                /**********************************************************************/
<span style="color: #A00000">-                } else if (!strcasecmp(parm->var, "isup.t35")) {</span>
<span style="color: #A00000">-                        sng_isup.t35 = atoi(parm->val);</span>
<span style="color: #A00000">-                        SS7_DEBUG("\tFound isup t35 = \"%d\"\n",sng_isup.t35);</span>
<span style="color: #00A000">+                        sng_isap.t34 = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found isup t34 = %d\n",sng_isap.t34);</span>
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "isup.t36")) {
<span style="color: #00A000">+                /**********************************************************************/</span>
                        sng_isap.t36 = atoi(parm->val);
<span style="color: #A00000">-                        SS7_DEBUG("\tFound isup t36 = \"%d\"\n",sng_isap.t36);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found isup t36 = %d\n",sng_isap.t36);</span>
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "isup.t37")) {
<span style="color: #00A000">+                /**********************************************************************/</span>
                        sng_isup.t37 = atoi(parm->val);
<span style="color: #A00000">-                        SS7_DEBUG("\tFound isup t37 = \"%d\"\n",sng_isup.t37);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found isup t37 = %d\n",sng_isup.t37);</span>
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "isup.t38")) {
<span style="color: #00A000">+                /**********************************************************************/</span>
                        sng_isup.t38 = atoi(parm->val);
<span style="color: #A00000">-                        SS7_DEBUG("\tFound isup t38 = \"%d\"\n",sng_isup.t38);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found isup t38 = %d\n",sng_isup.t38);</span>
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "isup.t39")) {
<span style="color: #00A000">+                /**********************************************************************/</span>
                        sng_isup.t39 = atoi(parm->val);
<span style="color: #A00000">-                        SS7_DEBUG("\tFound isup t39 = \"%d\"\n",sng_isup.t39);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found isup t39 = %d\n",sng_isup.t39);</span>
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "isup.tccr")) {
<span style="color: #00A000">+                /**********************************************************************/</span>
                        sng_isap.tccr = atoi(parm->val);
<span style="color: #A00000">-                        SS7_DEBUG("\tFound isup tccr = \"%d\"\n",sng_isap.tccr);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found isup tccr = %d\n",sng_isap.tccr);</span>
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "isup.tccrt")) {
<span style="color: #00A000">+                /**********************************************************************/</span>
                        sng_isap.tccrt = atoi(parm->val);
<span style="color: #A00000">-                        SS7_DEBUG("\tFound isup tccrt = \"%d\"\n",sng_isap.tccrt);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found isup tccrt = %d\n",sng_isap.tccrt);</span>
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "isup.tex")) {
<span style="color: #00A000">+                /**********************************************************************/</span>
                        sng_isap.tex = atoi(parm->val);
<span style="color: #A00000">-                        SS7_DEBUG("\tFound isup tex = \"%d\"\n",sng_isap.tex);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found isup tex = %d\n",sng_isap.tex);</span>
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "isup.tect")) {
<span style="color: #00A000">+                /**********************************************************************/</span>
                        sng_isap.tect = atoi(parm->val);
<span style="color: #A00000">-                        SS7_DEBUG("\tFound isup tect = \"%d\"\n",sng_isap.tect);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found isup tect = %d\n",sng_isap.tect);</span>
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "isup.tcrm")) {
<span style="color: #00A000">+                /**********************************************************************/</span>
                        sng_isap.tcrm = atoi(parm->val);
<span style="color: #A00000">-                        SS7_DEBUG("\tFound isup tcrm = \"%d\"\n",sng_isap.tcrm);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found isup tcrm = %d\n",sng_isap.tcrm);</span>
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "isup.tcra")) {
<span style="color: #00A000">+                /**********************************************************************/</span>
                        sng_isap.tcra = atoi(parm->val);
<span style="color: #A00000">-                        SS7_DEBUG("\tFound isup tcra = \"%d\"\n",sng_isap.tcra);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found isup tcra = %d\n",sng_isap.tcra);</span>
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "isup.tfgr")) {
<span style="color: #00A000">+                /**********************************************************************/</span>
                        sng_isup.tfgr = atoi(parm->val);
<span style="color: #A00000">-                        SS7_DEBUG("\tFound isup tfgr = \"%d\"\n",sng_isup.tfgr);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found isup tfgr = %d\n",sng_isup.tfgr);</span>
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "isup.trelrsp")) {
<span style="color: #00A000">+                /**********************************************************************/</span>
                        sng_isap.trelrsp = atoi(parm->val);
<span style="color: #A00000">-                        SS7_DEBUG("\tFound isup trelrsp = \"%d\"\n",sng_isap.trelrsp);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found isup trelrsp = %d\n",sng_isap.trelrsp);</span>
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "isup.tfnlrelrsp")) {
<span style="color: #00A000">+                /**********************************************************************/</span>
                        sng_isap.tfnlrelrsp = atoi(parm->val);
<span style="color: #A00000">-                        SS7_DEBUG("\tFound isup tfnlrelrsp = \"%d\"\n",sng_isap.tfnlrelrsp);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found isup tfnlrelrsp = %d\n",sng_isap.tfnlrelrsp);</span>
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "isup.tfnlrelrsp")) {
<span style="color: #00A000">+                /**********************************************************************/</span>
                        sng_isap.tfnlrelrsp = atoi(parm->val);
<span style="color: #A00000">-                        SS7_DEBUG("\tFound isup tfnlrelrsp = \"%d\"\n",sng_isap.tfnlrelrsp);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found isup tfnlrelrsp = %d\n",sng_isap.tfnlrelrsp);</span>
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "isup.tpause")) {
<span style="color: #00A000">+                /**********************************************************************/</span>
                        sng_isup.tpause = atoi(parm->val);
<span style="color: #A00000">-                        SS7_DEBUG("\tFound isup tpause = \"%d\"\n",sng_isup.tpause);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found isup tpause = %d\n",sng_isup.tpause);</span>
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "isup.tstaenq")) {
<span style="color: #00A000">+                /**********************************************************************/</span>
                        sng_isup.tstaenq = atoi(parm->val);
<span style="color: #A00000">-                        SS7_DEBUG("\tFound isup tstaenq = \"%d\"\n",sng_isup.tstaenq);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found isup tstaenq = %d\n",sng_isup.tstaenq);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        SS7_ERROR("Found an invalid parameter %s!\n", parm->val);</span>
<span style="color: #00A000">+                        return FTDM_FAIL;</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                /* move to the next parameter */</span>
<span style="color: #00A000">+                parm = parm + 1;</span>
<span style="color: #00A000">+        /**************************************************************************/</span>
<span style="color: #00A000">+        } /* for (i = 0; i < num_parms; i++) */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* default the interface to paused state */</span>
<span style="color: #00A000">+        sngss7_set_flag(&sng_isup, SNGSS7_PAUSED);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* trickle down the SPC to all sub entities */</span>
<span style="color: #00A000">+        int        linkSetId;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        linkSetId = g_ftdm_sngss7_data.cfg.mtpRoute[sng_isup.mtpRouteId].linkSetId;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        i = 1;</span>
<span style="color: #00A000">+        while (g_ftdm_sngss7_data.cfg.mtp3Link[i].id != 0) {</span>
<span style="color: #00A000">+                if (g_ftdm_sngss7_data.cfg.mtp3Link[i].linkSetId == linkSetId) {</span>
<span style="color: #00A000">+                        g_ftdm_sngss7_data.cfg.mtp3Link[i].spc = g_ftdm_sngss7_data.cfg.spc;</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                i++;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* pull values from the lower levels */</span>
<span style="color: #00A000">+        sng_isup.dpc = g_ftdm_sngss7_data.cfg.mtpRoute[sng_isup.mtpRouteId].dpc;</span>
<span style="color: #00A000">+        sng_isup.switchType = g_ftdm_sngss7_data.cfg.mtpRoute[sng_isup.mtpRouteId].switchType;</span>
<span style="color: #00A000">+        sng_isup.nwId = g_ftdm_sngss7_data.cfg.mtpRoute[sng_isup.mtpRouteId].nwId;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        sng_isap.switchType = g_ftdm_sngss7_data.cfg.mtpRoute[sng_isup.mtpRouteId].switchType;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        ftmod_ss7_fill_in_isap(&sng_isap);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        sng_isup.isap = sng_isap.id;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        ftmod_ss7_fill_in_isup_interface(&sng_isup);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* setup the self mtp3 route */</span>
<span style="color: #00A000">+        i = sng_isup.mtpRouteId;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if(ftmod_ss7_fill_in_self_route(sng_isup.spc,</span>
<span style="color: #00A000">+                                                                        g_ftdm_sngss7_data.cfg.mtpRoute[i].linkType,</span>
<span style="color: #00A000">+                                                                        g_ftdm_sngss7_data.cfg.mtpRoute[i].switchType,</span>
<span style="color: #00A000">+                                                                        g_ftdm_sngss7_data.cfg.mtpRoute[i].ssf)) {</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                SS7_ERROR("Failed to fill in self route structure!\n");</span>
<span style="color: #00A000">+                return FTDM_FAIL;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return FTDM_SUCCESS;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/******************************************************************************/</span>
<span style="color: #00A000">+static int ftmod_ss7_parse_cc_spans(ftdm_conf_node_t *cc_spans)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        ftdm_conf_node_t        *cc_span = NULL;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* confirm that we are looking at cc_spans */</span>
<span style="color: #00A000">+        if (strcasecmp(cc_spans->name, "cc_spans")) {</span>
<span style="color: #00A000">+                SS7_ERROR("We're looking at \"%s\"...but we're supposed to be looking at \"cc_spans\"!\n",cc_spans->name);</span>
<span style="color: #00A000">+                return FTDM_FAIL;</span>
<span style="color: #00A000">+        } else {</span>
<span style="color: #00A000">+                SS7_DEBUG("Parsing \"cc_spans\"...\n");</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* extract the cc_spans */</span>
<span style="color: #00A000">+        cc_span = cc_spans->child;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        while (cc_span != NULL) {</span>
<span style="color: #00A000">+                /* parse the found cc_span */</span>
<span style="color: #00A000">+                if (ftmod_ss7_parse_cc_span(cc_span)) {</span>
<span style="color: #00A000">+                        SS7_ERROR("Failed to parse \"cc_span\"\n");</span>
<span style="color: #00A000">+                        return FTDM_FAIL;</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                /* go to the next cc_span */</span>
<span style="color: #00A000">+                cc_span = cc_span->next;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return FTDM_SUCCESS;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/******************************************************************************/</span>
<span style="color: #00A000">+static int ftmod_ss7_parse_cc_span(ftdm_conf_node_t *cc_span)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        sng_ccSpan_t                        sng_ccSpan;</span>
<span style="color: #00A000">+        ftdm_conf_parameter_t        *parm = cc_span->parameters;</span>
<span style="color: #00A000">+        int                                                num_parms = cc_span->n_parameters;</span>
<span style="color: #00A000">+        int                                                flag_clg_nadi = 0;</span>
<span style="color: #00A000">+        int                                                flag_cld_nadi = 0;</span>
<span style="color: #00A000">+        int                                                i;</span>
<span style="color: #00A000">+        int                                                ret;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* initalize the ccSpan structure */</span>
<span style="color: #00A000">+        memset(&sng_ccSpan, 0x0, sizeof(sng_ccSpan));</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* confirm that we are looking at an mtp_link */</span>
<span style="color: #00A000">+        if (strcasecmp(cc_span->name, "cc_span")) {</span>
<span style="color: #00A000">+                SS7_ERROR("We're looking at \"%s\"...but we're supposed to be looking at \"cc_span\"!\n",cc_span->name);</span>
<span style="color: #00A000">+                return FTDM_FAIL;</span>
<span style="color: #00A000">+        } else {</span>
<span style="color: #00A000">+                SS7_DEBUG("Parsing \"cc_span\"...\n");</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        for (i = 0; i < num_parms; i++) {</span>
<span style="color: #00A000">+        /**************************************************************************/</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                /* try to match the parameter to what we expect */</span>
<span style="color: #00A000">+                if (!strcasecmp(parm->var, "name")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        strcpy((char *)sng_ccSpan.name, parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an ccSpan named = %s\n", sng_ccSpan.name);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "id")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        sng_ccSpan.id = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an ccSpan id = %d\n", sng_ccSpan.id);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "procid")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        sng_ccSpan.procId = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an ccSpan procId = %d\n", sng_ccSpan.procId);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "ch_map")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        strcpy(sng_ccSpan.ch_map, parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found channel map %s\n", sng_ccSpan.ch_map);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "typeCntrl")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        ret = find_cic_cntrl_in_map(parm->val);</span>
<span style="color: #00A000">+                        if (ret == -1) {</span>
<span style="color: #00A000">+                                SS7_ERROR("Found an invalid ccSpan typeCntrl = %s\n", parm->var);</span>
<span style="color: #00A000">+                                return FTDM_FAIL;</span>
<span style="color: #00A000">+                        } else {</span>
<span style="color: #00A000">+                                sng_ccSpan.typeCntrl = sng_cic_cntrl_type_map[ret].tril_type;</span>
<span style="color: #00A000">+                                SS7_DEBUG("Found an ccSpan typeCntrl = %s\n", sng_cic_cntrl_type_map[ret].sng_type);</span>
<span style="color: #00A000">+                        }</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "ssf")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        ret = find_ssf_type_in_map(parm->val);</span>
<span style="color: #00A000">+                        if (ret == -1) {</span>
<span style="color: #00A000">+                                SS7_ERROR("Found an invalid ccSpan ssf = %s\n", parm->var);</span>
<span style="color: #00A000">+                                return FTDM_FAIL;</span>
<span style="color: #00A000">+                        } else {</span>
<span style="color: #00A000">+                                sng_ccSpan.ssf = sng_ssf_type_map[ret].tril_type;</span>
<span style="color: #00A000">+                                SS7_DEBUG("Found an ccSpan ssf = %s\n", sng_ssf_type_map[ret].sng_type);</span>
<span style="color: #00A000">+                        }</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "switchType")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        ret = find_switch_type_in_map(parm->val);</span>
<span style="color: #00A000">+                        if (ret == -1) {</span>
<span style="color: #00A000">+                                SS7_ERROR("Found an invalid ccSpan switchType = %s\n", parm->var);</span>
<span style="color: #00A000">+                                return FTDM_FAIL;</span>
<span style="color: #00A000">+                        } else {</span>
<span style="color: #00A000">+                                sng_ccSpan.switchType = sng_switch_type_map[ret].tril_isup_type;</span>
<span style="color: #00A000">+                                SS7_DEBUG("Found an ccSpan switchType = %s\n", sng_switch_type_map[ret].sng_type);</span>
<span style="color: #00A000">+                        }</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "cicbase")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        sng_ccSpan.cicbase = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found a cicbase = %d\n", sng_ccSpan.cicbase);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "isup_interface")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        sng_ccSpan.isupInf = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found an isup_interface = %d\n",sng_ccSpan.isupInf);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "min_digits")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        sng_ccSpan.min_digits = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found a min_digits = %d\n",sng_ccSpan.min_digits);</span>
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "clg_nadi")) {
                /**********************************************************************/
                        /* throw the flag so that we know we got this optional parameter */
                        flag_clg_nadi = 1;
<span style="color: #A00000">-                        sng_isup.clg_nadi = atoi(parm->val);</span>
<span style="color: #A00000">-                        SS7_DEBUG("\tFound default CLG_NADI value = %d\n", sng_isup.clg_nadi);</span>
<span style="color: #00A000">+                        sng_ccSpan.clg_nadi = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found default CLG_NADI parm->value = %d\n", sng_ccSpan.clg_nadi);</span>
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "cld_nadi")) {
                /**********************************************************************/
                        /* throw the flag so that we know we got this optional parameter */
                        flag_cld_nadi = 1;
<span style="color: #A00000">-                        sng_isup.cld_nadi = atoi(parm->val);</span>
<span style="color: #A00000">-                        SS7_DEBUG("\tFound default CLD_NADI value = %d\n", sng_isup.cld_nadi);</span>
<span style="color: #00A000">+                        sng_ccSpan.cld_nadi = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found default CLD_NADI parm->value = %d\n", sng_ccSpan.cld_nadi);</span>
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "obci_bita")) {
                /**********************************************************************/
                        if (*parm->val == '1') {
<span style="color: #A00000">-                                sngss7_set_options(&sng_isup, SNGSS7_ACM_OBCI_BITA);</span>
<span style="color: #A00000">-                                SS7_DEBUG("\tFound Optional Backwards Indicator: Bit A (early media) enable option\n");</span>
<span style="color: #00A000">+                                sngss7_set_options(&sng_ccSpan, SNGSS7_ACM_OBCI_BITA);</span>
<span style="color: #00A000">+                                SS7_DEBUG("Found Optional Backwards Indicator: Bit A (early media) enable option\n");</span>
                        } else if (*parm->val == '0') {
<span style="color: #A00000">-                                sngss7_clear_options(&sng_isup, SNGSS7_ACM_OBCI_BITA);</span>
<span style="color: #A00000">-                                SS7_DEBUG("\tFound Optional Backwards Indicator: Bit A (early media) disable option\n");</span>
<span style="color: #00A000">+                                sngss7_clear_options(&sng_ccSpan, SNGSS7_ACM_OBCI_BITA);</span>
<span style="color: #00A000">+                                SS7_DEBUG("Found Optional Backwards Indicator: Bit A (early media) disable option\n");</span>
                        } else {
<span style="color: #A00000">-                                SS7_DEBUG("\tInvalid value for \"obci_bita\" option\n");</span>
<span style="color: #00A000">+                                SS7_DEBUG("Invalid parm->value for obci_bita option\n");</span>
                        }
                /**********************************************************************/
                } else if (!strcasecmp(parm->var, "lpa_on_cot")) {
                /**********************************************************************/
                        if (*parm->val == '1') {
<span style="color: #A00000">-                                sngss7_set_options(&sng_isup, SNGSS7_LPA_FOR_COT);</span>
<span style="color: #A00000">-                                SS7_DEBUG("\tFound Tx LPA on COT enable option\n");</span>
<span style="color: #00A000">+                                sngss7_set_options(&sng_ccSpan, SNGSS7_LPA_FOR_COT);</span>
<span style="color: #00A000">+                                SS7_DEBUG("Found Tx LPA on COT enable option\n");</span>
                        } else if (*parm->val == '0') {
<span style="color: #A00000">-                                sngss7_clear_options(&sng_isup, SNGSS7_LPA_FOR_COT);</span>
<span style="color: #A00000">-                                SS7_DEBUG("\tFound Tx LPA on COT disable option\n");</span>
<span style="color: #00A000">+                                sngss7_clear_options(&sng_ccSpan, SNGSS7_LPA_FOR_COT);</span>
<span style="color: #00A000">+                                SS7_DEBUG("Found Tx LPA on COT disable option\n");</span>
                        } else {
<span style="color: #A00000">-                                SS7_DEBUG("\tInvalid value for \"lpa_on_cot\" option\n");</span>
<span style="color: #00A000">+                                SS7_DEBUG("Invalid parm->value for lpa_on_cot option\n");</span>
                        }
                /**********************************************************************/
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "isup.t3")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        sng_ccSpan.t3 = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found isup t3 = %d\n", sng_ccSpan.t3);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "isup.t12")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        sng_ccSpan.t12 = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found isup t12 = %d\n", sng_ccSpan.t12);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "isup.t13")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        sng_ccSpan.t13 = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found isup t13 = %d\n", sng_ccSpan.t13);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "isup.t14")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        sng_ccSpan.t14 = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found isup t14 = %d\n", sng_ccSpan.t14);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "isup.t15")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        sng_ccSpan.t15 = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found isup t15 = %d\n", sng_ccSpan.t15);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "isup.t16")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        sng_ccSpan.t16 = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found isup t16 = %d\n", sng_ccSpan.t16);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "isup.t17")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        sng_ccSpan.t17 = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found isup t17 = %d\n", sng_ccSpan.t17);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "isup.t35")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        sng_ccSpan.t35 = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found isup t35 = %d\n",sng_ccSpan.t35);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } else if (!strcasecmp(parm->var, "isup.tval")) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        sng_ccSpan.tval = atoi(parm->val);</span>
<span style="color: #00A000">+                        SS7_DEBUG("Found isup tval = %d\n", sng_ccSpan.tval);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
                } else {
<span style="color: #A00000">-                        SS7_ERROR("\tFound an invalid parameter \"%s\"!\n", parm->val);</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        SS7_ERROR("Found an invalid parameter %s!\n", parm->var);</span>
                        return FTDM_FAIL;
<span style="color: #A00000">-</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
                }
                /* move to the next parameter */
                parm = parm + 1;
<span style="color: #A00000">-        }</span>
<span style="color: #00A000">+        /**************************************************************************/</span>
<span style="color: #00A000">+        } /* for (i = 0; i < num_parms; i++) */</span>
        /* check if the user filled in a nadi value by looking at flag */
        if (!flag_cld_nadi) {
                /* default the nadi value to national */
<span style="color: #A00000">-                sng_isup.cld_nadi = 0x03;</span>
<span style="color: #00A000">+                sng_ccSpan.cld_nadi = 0x03;</span>
        }
        if (!flag_clg_nadi) {
                /* default the nadi value to national */
<span style="color: #A00000">-                sng_isup.clg_nadi = 0x03;</span>
<span style="color: #00A000">+                sng_ccSpan.clg_nadi = 0x03;</span>
        }
<span style="color: #A00000">-        /* check if the user requested min_digits value */</span>
<span style="color: #A00000">-        if (sng_isup.min_digits == 0) {</span>
<span style="color: #A00000">-                /* default to 7 */</span>
<span style="color: #A00000">-                sng_isup.min_digits = 7;</span>
<span style="color: #A00000">-        }</span>
<span style="color: #A00000">-                </span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-        /* trickle down the SPC to all sub entities */</span>
<span style="color: #A00000">-        linkSetId = g_ftdm_sngss7_data.cfg.mtpRoute[sng_isup.mtpRouteId].linkSetId;</span>
<span style="color: #00A000">+        /* add this span to our global listing */</span>
<span style="color: #00A000">+        ftmod_ss7_fill_in_ccSpan(&sng_ccSpan);</span>
<span style="color: #A00000">-        i = 1;</span>
<span style="color: #A00000">-        while (g_ftdm_sngss7_data.cfg.mtpLink[i].id != 0) {</span>
<span style="color: #A00000">-                if (g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.linkSetId == linkSetId) {</span>
<span style="color: #A00000">-                        g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.spc = g_ftdm_sngss7_data.cfg.spc;</span>
<span style="color: #A00000">-                }</span>
<span style="color: #00A000">+        /* make sure the isup interface structure has something in it */</span>
<span style="color: #00A000">+        if (g_ftdm_sngss7_data.cfg.isupIntf[sng_ccSpan.isupInf].id == 0) {</span>
<span style="color: #00A000">+                /* fill in the id, so that we know it exists */</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.isupIntf[sng_ccSpan.isupInf].id = sng_ccSpan.isupInf;</span>
<span style="color: #A00000">-                i++;</span>
<span style="color: #00A000">+                /* default the status to PAUSED */</span>
<span style="color: #00A000">+                sngss7_set_flag(&g_ftdm_sngss7_data.cfg.isupIntf[sng_ccSpan.isupInf], SNGSS7_PAUSED);</span>
        }
<span style="color: #A00000">-        ftmod_ss7_fill_in_isap(&sng_isap);</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-        sng_isup.isap = sng_isap.id;</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-        ftmod_ss7_fill_in_isup_interface(&sng_isup);</span>
<span style="color: #A00000">-</span>
        return FTDM_SUCCESS;
}
/******************************************************************************/
<span style="color: #A00000">-static int ftmod_ss7_fill_in_mtpLink(sng_mtp_link_t *mtpLink)</span>
<span style="color: #00A000">+static int ftmod_ss7_fill_in_relay_channel(sng_relay_t *relay_channel)</span>
{
        int i;
<span style="color: #A00000">-        /* go through all the existing links and see if we find a match */</span>
<span style="color: #00A000">+        /* go through all the existing channels and see if we find a match */</span>
        i = 1;
<span style="color: #A00000">-        while (g_ftdm_sngss7_data.cfg.mtpLink[i].id != 0) {</span>
<span style="color: #A00000">-                if ((g_ftdm_sngss7_data.cfg.mtpLink[i].mtp1.span == mtpLink->mtp1.span) &&</span>
<span style="color: #A00000">-                        (g_ftdm_sngss7_data.cfg.mtpLink[i].mtp1.chan == mtpLink->mtp1.chan)) {</span>
<span style="color: #00A000">+        while (g_ftdm_sngss7_data.cfg.relay[i].id != 0) {</span>
<span style="color: #00A000">+                if ((g_ftdm_sngss7_data.cfg.relay[i].type == relay_channel->type) &&</span>
<span style="color: #00A000">+                        (g_ftdm_sngss7_data.cfg.relay[i].port == relay_channel->port) &&</span>
<span style="color: #00A000">+                        (g_ftdm_sngss7_data.cfg.relay[i].procId == relay_channel->procId) &&</span>
<span style="color: #00A000">+                        (!strcasecmp(g_ftdm_sngss7_data.cfg.relay[i].hostname, relay_channel->hostname))) {</span>
                        /* we have a match so break out of this loop */
                        break;
<span style="color: #800080; font-weight: bold">@@ -1355,179 +2030,273 @@ static int ftmod_ss7_fill_in_mtpLink(sng_mtp_link_t *mtpLink)</span>
                i++;
        }
<span style="color: #A00000">-        /* if the id value is 0 that means we didn't find the link */</span>
<span style="color: #A00000">-        if (g_ftdm_sngss7_data.cfg.mtpLink[i].id == 0) {</span>
<span style="color: #A00000">-                mtpLink->id = i;</span>
<span style="color: #A00000">-                SS7_DEBUG("found new mtpLink on span=%d, chan=%d, id = %d\n", </span>
<span style="color: #A00000">-                                        mtpLink->mtp1.span, </span>
<span style="color: #A00000">-                                        mtpLink->mtp1.chan, </span>
<span style="color: #A00000">-                                        mtpLink->id);</span>
<span style="color: #00A000">+                /* if the id value is 0 that means we didn't find the relay channel */</span>
<span style="color: #00A000">+        if (g_ftdm_sngss7_data.cfg.relay[i].id == 0) {</span>
<span style="color: #00A000">+                relay_channel->id = i;</span>
<span style="color: #00A000">+                SS7_DEBUG("found new relay channel on type:%d, hostname:%s, port:%d, procId:%d, id = %d\n",</span>
<span style="color: #00A000">+                                        relay_channel->type,</span>
<span style="color: #00A000">+                                        relay_channel->hostname,</span>
<span style="color: #00A000">+                                        relay_channel->port,</span>
<span style="color: #00A000">+                                        relay_channel->procId, </span>
<span style="color: #00A000">+                                        relay_channel->id);</span>
<span style="color: #00A000">+                sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_RY);</span>
        } else {
<span style="color: #A00000">-                mtpLink->id = i;</span>
<span style="color: #A00000">-                SS7_DEBUG("found existing mtpLink on span=%d, chan=%d, id = %d\n", </span>
<span style="color: #A00000">-                                        mtpLink->mtp1.span, </span>
<span style="color: #A00000">-                                        mtpLink->mtp1.chan, </span>
<span style="color: #A00000">-                                        mtpLink->id);</span>
<span style="color: #00A000">+                relay_channel->id = i;</span>
<span style="color: #00A000">+                SS7_DEBUG("found existing relay channel on type:%d, hostname:%s, port:%d, procId:%d, id = %d\n",</span>
<span style="color: #00A000">+                                        relay_channel->type,</span>
<span style="color: #00A000">+                                        relay_channel->hostname,</span>
<span style="color: #00A000">+                                        relay_channel->port,</span>
<span style="color: #00A000">+                                        relay_channel->procId, </span>
<span style="color: #00A000">+                                        relay_channel->id);</span>
        }
<span style="color: #A00000">-        /* fill in the information */</span>
<span style="color: #A00000">-        strncpy((char *)g_ftdm_sngss7_data.cfg.mtpLink[i].name, (char *)mtpLink->name, MAX_NAME_LEN-1);</span>
<span style="color: #00A000">+        g_ftdm_sngss7_data.cfg.relay[i].id                = relay_channel->id;</span>
<span style="color: #00A000">+        g_ftdm_sngss7_data.cfg.relay[i].type        = relay_channel->type;</span>
<span style="color: #00A000">+        g_ftdm_sngss7_data.cfg.relay[i].port        = relay_channel->port;</span>
<span style="color: #00A000">+        g_ftdm_sngss7_data.cfg.relay[i].procId        = relay_channel->procId;</span>
<span style="color: #00A000">+        strcpy(g_ftdm_sngss7_data.cfg.relay[i].hostname, relay_channel->hostname);</span>
<span style="color: #00A000">+        strcpy(g_ftdm_sngss7_data.cfg.relay[i].name, relay_channel->name);</span>
<span style="color: #A00000">-        g_ftdm_sngss7_data.cfg.mtpLink[i].id                                = mtpLink->id;</span>
<span style="color: #00A000">+        /* if this is THE listen channel grab the procId and use it */</span>
<span style="color: #00A000">+        if (relay_channel->type == LRY_CT_TCP_LISTEN) {</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.procId = relay_channel->procId;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #A00000">-        g_ftdm_sngss7_data.cfg.mtpLink[i].mtp1.span                 = mtpLink->mtp1.span;</span>
<span style="color: #A00000">-        g_ftdm_sngss7_data.cfg.mtpLink[i].mtp1.chan                 = mtpLink->mtp1.chan;</span>
<span style="color: #00A000">+        return FTDM_SUCCESS;</span>
<span style="color: #00A000">+}</span>
<span style="color: #A00000">-        g_ftdm_sngss7_data.cfg.mtpLink[i].mtp2.linkType                = mtpLink->mtp2.linkType;</span>
<span style="color: #A00000">-        g_ftdm_sngss7_data.cfg.mtpLink[i].mtp2.errorType        = mtpLink->mtp2.errorType;</span>
<span style="color: #A00000">-        g_ftdm_sngss7_data.cfg.mtpLink[i].mtp2.lssuLength        = mtpLink->mtp2.lssuLength;</span>
<span style="color: #A00000">-        g_ftdm_sngss7_data.cfg.mtpLink[i].mtp2.mtp1Id                = mtpLink->id;</span>
<span style="color: #00A000">+/******************************************************************************/</span>
<span style="color: #00A000">+static int ftmod_ss7_fill_in_mtp1_link(sng_mtp1_link_t *mtp1Link)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        int i = mtp1Link->id;</span>
<span style="color: #A00000">-        g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.priority                = mtpLink->mtp3.priority;</span>
<span style="color: #A00000">-        g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.linkType                = mtpLink->mtp3.linkType;</span>
<span style="color: #A00000">-        g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.switchType        = mtpLink->mtp3.switchType;</span>
<span style="color: #A00000">-        g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.apc                        = mtpLink->mtp3.apc;</span>
<span style="color: #A00000">-        g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.spc                        = g_ftdm_sngss7_data.cfg.spc;</span>
<span style="color: #A00000">-        g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.ssf                        = mtpLink->mtp3.ssf;</span>
<span style="color: #A00000">-        g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.slc                        = mtpLink->mtp3.slc;</span>
<span style="color: #A00000">-        g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.linkSetId        = mtpLink->mtp3.linkSetId;</span>
<span style="color: #A00000">-        g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.mtp2Id                = mtpLink->id;</span>
<span style="color: #00A000">+        /* check if this id value has been used already */</span>
<span style="color: #00A000">+        if (g_ftdm_sngss7_data.cfg.mtp1Link[i].id == 0) {</span>
<span style="color: #00A000">+                SS7_DEBUG("Found new MTP1 Link: id=%d, name=%s\n", mtp1Link->id, mtp1Link->name);</span>
<span style="color: #00A000">+                sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP1);</span>
<span style="color: #00A000">+        } else {</span>
<span style="color: #00A000">+                SS7_DEBUG("Found an existing MTP1 Link: id=%d, name=%s (old name=%s)\n", </span>
<span style="color: #00A000">+                                        mtp1Link->id, </span>
<span style="color: #00A000">+                                        mtp1Link->name,</span>
<span style="color: #00A000">+                                        g_ftdm_sngss7_data.cfg.mtp1Link[i].name);</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* copy over the values */</span>
<span style="color: #00A000">+        strcpy((char *)g_ftdm_sngss7_data.cfg.mtp1Link[i].name, (char *)mtp1Link->name);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        g_ftdm_sngss7_data.cfg.mtp1Link[i].id                = mtp1Link->id;</span>
<span style="color: #00A000">+        g_ftdm_sngss7_data.cfg.mtp1Link[i].span                = mtp1Link->span;</span>
<span style="color: #00A000">+        g_ftdm_sngss7_data.cfg.mtp1Link[i].chan                = mtp1Link->chan;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return FTDM_SUCCESS;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/******************************************************************************/</span>
<span style="color: #00A000">+static int ftmod_ss7_fill_in_mtp2_link(sng_mtp2_link_t *mtp2Link)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        int i = mtp2Link->id;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* check if this id value has been used already */</span>
<span style="color: #00A000">+        if (g_ftdm_sngss7_data.cfg.mtp2Link[i].id == 0) {</span>
<span style="color: #00A000">+                SS7_DEBUG("Found new MTP2 Link: id=%d, name=%s\n", mtp2Link->id, mtp2Link->name);</span>
<span style="color: #00A000">+                sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP2);</span>
<span style="color: #00A000">+        } else {</span>
<span style="color: #00A000">+                SS7_DEBUG("Found an existing MTP2 Link: id=%d, name=%s (old name=%s)\n", </span>
<span style="color: #00A000">+                                        mtp2Link->id, </span>
<span style="color: #00A000">+                                        mtp2Link->name,</span>
<span style="color: #00A000">+                                        g_ftdm_sngss7_data.cfg.mtp2Link[i].name);</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* copy over the values */</span>
<span style="color: #00A000">+        strcpy((char *)g_ftdm_sngss7_data.cfg.mtp2Link[i].name, (char *)mtp2Link->name);</span>
<span style="color: #A00000">-        if ( mtpLink->mtp2.t1 != 0 ) {</span>
<span style="color: #A00000">-                g_ftdm_sngss7_data.cfg.mtpLink[i].mtp2.t1                = mtpLink->mtp2.t1;</span>
<span style="color: #00A000">+        g_ftdm_sngss7_data.cfg.mtp2Link[i].id                        = mtp2Link->id;</span>
<span style="color: #00A000">+        g_ftdm_sngss7_data.cfg.mtp2Link[i].lssuLength        = mtp2Link->lssuLength;</span>
<span style="color: #00A000">+        g_ftdm_sngss7_data.cfg.mtp2Link[i].errorType        = mtp2Link->errorType;</span>
<span style="color: #00A000">+        g_ftdm_sngss7_data.cfg.mtp2Link[i].linkType                = mtp2Link->linkType;</span>
<span style="color: #00A000">+        g_ftdm_sngss7_data.cfg.mtp2Link[i].mtp1Id                = mtp2Link->mtp1Id;</span>
<span style="color: #00A000">+        g_ftdm_sngss7_data.cfg.mtp2Link[i].mtp1ProcId        = mtp2Link->mtp1ProcId;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if ( mtp2Link->t1 != 0 ) {</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtp2Link[i].t1                = mtp2Link->t1;</span>
        }else {
<span style="color: #A00000">-                g_ftdm_sngss7_data.cfg.mtpLink[i].mtp2.t1                = 500;</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtp2Link[i].t1                = 500;</span>
        }
<span style="color: #A00000">-        if ( mtpLink->mtp2.t2 != 0 ) {</span>
<span style="color: #A00000">-                g_ftdm_sngss7_data.cfg.mtpLink[i].mtp2.t2                = mtpLink->mtp2.t2;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if ( mtp2Link->t2 != 0 ) {</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtp2Link[i].t2                = mtp2Link->t2;</span>
        }else {
<span style="color: #A00000">-                g_ftdm_sngss7_data.cfg.mtpLink[i].mtp2.t2                = 250;</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtp2Link[i].t2                = 250;</span>
        }
<span style="color: #A00000">-        if ( mtpLink->mtp2.t3 != 0 ) {</span>
<span style="color: #A00000">-                g_ftdm_sngss7_data.cfg.mtpLink[i].mtp2.t3                = mtpLink->mtp2.t3;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if ( mtp2Link->t3 != 0 ) {</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtp2Link[i].t3                = mtp2Link->t3;</span>
        }else {
<span style="color: #A00000">-                g_ftdm_sngss7_data.cfg.mtpLink[i].mtp2.t3                = 20;</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtp2Link[i].t3                = 20;</span>
        }
<span style="color: #A00000">-        if ( mtpLink->mtp2.t4n != 0 ) {</span>
<span style="color: #A00000">-                g_ftdm_sngss7_data.cfg.mtpLink[i].mtp2.t4n                = mtpLink->mtp2.t4n;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if ( mtp2Link->t4n != 0 ) {</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtp2Link[i].t4n                = mtp2Link->t4n;</span>
        }else {
<span style="color: #A00000">-                g_ftdm_sngss7_data.cfg.mtpLink[i].mtp2.t4n                = 80;</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtp2Link[i].t4n                = 80;</span>
        }
<span style="color: #A00000">-        if ( mtpLink->mtp2.t4e != 0 ) {</span>
<span style="color: #A00000">-                g_ftdm_sngss7_data.cfg.mtpLink[i].mtp2.t4e                = mtpLink->mtp2.t4e;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if ( mtp2Link->t4e != 0 ) {</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtp2Link[i].t4e                = mtp2Link->t4e;</span>
        }else {
<span style="color: #A00000">-                g_ftdm_sngss7_data.cfg.mtpLink[i].mtp2.t4e                = 5;</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtp2Link[i].t4e                = 5;</span>
        }
<span style="color: #A00000">-        if ( mtpLink->mtp2.t5 != 0 ) {</span>
<span style="color: #A00000">-                g_ftdm_sngss7_data.cfg.mtpLink[i].mtp2.t5                = mtpLink->mtp2.t5;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if ( mtp2Link->t5 != 0 ) {</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtp2Link[i].t5                = mtp2Link->t5;</span>
        }else {
<span style="color: #A00000">-                g_ftdm_sngss7_data.cfg.mtpLink[i].mtp2.t5                = 1;</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtp2Link[i].t5                = 1;</span>
        }
<span style="color: #A00000">-        if ( mtpLink->mtp2.t6 != 0 ) {</span>
<span style="color: #A00000">-                g_ftdm_sngss7_data.cfg.mtpLink[i].mtp2.t6                = mtpLink->mtp2.t6;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if ( mtp2Link->t6 != 0 ) {</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtp2Link[i].t6                = mtp2Link->t6;</span>
        }else {
<span style="color: #A00000">-                g_ftdm_sngss7_data.cfg.mtpLink[i].mtp2.t6                = 60;</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtp2Link[i].t6                = 60;</span>
        }
<span style="color: #A00000">-        if ( mtpLink->mtp2.t7 != 0 ) {</span>
<span style="color: #A00000">-                g_ftdm_sngss7_data.cfg.mtpLink[i].mtp2.t7                = mtpLink->mtp2.t7;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if ( mtp2Link->t7 != 0 ) {</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtp2Link[i].t7                = mtp2Link->t7;</span>
        }else {
<span style="color: #A00000">-                g_ftdm_sngss7_data.cfg.mtpLink[i].mtp2.t7                = 40;</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtp2Link[i].t7                = 40;</span>
        }
<span style="color: #A00000">-        if (mtpLink->mtp3.t1 != 0) {</span>
<span style="color: #A00000">-                g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t1                = mtpLink->mtp3.t1;</span>
<span style="color: #A00000">-        } else { </span>
<span style="color: #A00000">-                g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t1                = 8;</span>
<span style="color: #00A000">+        return FTDM_SUCCESS;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/******************************************************************************/</span>
<span style="color: #00A000">+static int ftmod_ss7_fill_in_mtp3_link(sng_mtp3_link_t *mtp3Link)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        int i = mtp3Link->id;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* check if this id value has been used already */</span>
<span style="color: #00A000">+        if (g_ftdm_sngss7_data.cfg.mtp3Link[i].id == 0) {</span>
<span style="color: #00A000">+                SS7_DEBUG("Found new MTP3 Link: id=%d, name=%s\n", mtp3Link->id, mtp3Link->name);</span>
<span style="color: #00A000">+                sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP3);</span>
<span style="color: #00A000">+        } else {</span>
<span style="color: #00A000">+                SS7_DEBUG("Found an existing MTP3 Link: id=%d, name=%s (old name=%s)\n", </span>
<span style="color: #00A000">+                                        mtp3Link->id, </span>
<span style="color: #00A000">+                                        mtp3Link->name,</span>
<span style="color: #00A000">+                                        g_ftdm_sngss7_data.cfg.mtp3Link[i].name);</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* copy over the values */</span>
<span style="color: #00A000">+        strcpy((char *)g_ftdm_sngss7_data.cfg.mtp3Link[i].name, (char *)mtp3Link->name);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        g_ftdm_sngss7_data.cfg.mtp3Link[i].id                        = mtp3Link->id;</span>
<span style="color: #00A000">+        g_ftdm_sngss7_data.cfg.mtp3Link[i].priority                = mtp3Link->priority;</span>
<span style="color: #00A000">+        g_ftdm_sngss7_data.cfg.mtp3Link[i].linkType                = mtp3Link->linkType;</span>
<span style="color: #00A000">+        g_ftdm_sngss7_data.cfg.mtp3Link[i].switchType        = mtp3Link->switchType;</span>
<span style="color: #00A000">+        g_ftdm_sngss7_data.cfg.mtp3Link[i].apc                        = mtp3Link->apc;</span>
<span style="color: #00A000">+        g_ftdm_sngss7_data.cfg.mtp3Link[i].spc                        = mtp3Link->spc;        /* unknown at this time */</span>
<span style="color: #00A000">+        g_ftdm_sngss7_data.cfg.mtp3Link[i].ssf                        = mtp3Link->ssf;</span>
<span style="color: #00A000">+        g_ftdm_sngss7_data.cfg.mtp3Link[i].slc                        = mtp3Link->slc;</span>
<span style="color: #00A000">+        g_ftdm_sngss7_data.cfg.mtp3Link[i].linkSetId        = mtp3Link->linkSetId;</span>
<span style="color: #00A000">+        g_ftdm_sngss7_data.cfg.mtp3Link[i].mtp2Id                = mtp3Link->mtp2Id;</span>
<span style="color: #00A000">+        g_ftdm_sngss7_data.cfg.mtp3Link[i].mtp2ProcId        = mtp3Link->mtp2ProcId;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if (mtp3Link->t1 != 0) {</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtp3Link[i].t1                = mtp3Link->t1;</span>
<span style="color: #00A000">+        } else {</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtp3Link[i].t1                = 8;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        if (mtp3Link->t2 != 0) {</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtp3Link[i].t2                = mtp3Link->t2;</span>
<span style="color: #00A000">+        } else {</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtp3Link[i].t2                = 14;</span>
        }
<span style="color: #A00000">-        if (mtpLink->mtp3.t2 != 0) {</span>
<span style="color: #A00000">-                g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t2                = mtpLink->mtp3.t2;</span>
<span style="color: #00A000">+        if (mtp3Link->t3 != 0) {</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtp3Link[i].t3                = mtp3Link->t3;</span>
        } else {
<span style="color: #A00000">-                g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t2                = 14;</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtp3Link[i].t3                = 8;</span>
        }
<span style="color: #A00000">-        if (mtpLink->mtp3.t3 != 0) {</span>
<span style="color: #A00000">-                g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t3                = mtpLink->mtp3.t3;</span>
<span style="color: #00A000">+        if (mtp3Link->t4 != 0) {</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtp3Link[i].t4                = mtp3Link->t4;</span>
        } else {
<span style="color: #A00000">-                g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t3                = 8;</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtp3Link[i].t4                = 8;</span>
        }
<span style="color: #A00000">-        if (mtpLink->mtp3.t4 != 0) {</span>
<span style="color: #A00000">-                g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t4                = mtpLink->mtp3.t4;</span>
<span style="color: #00A000">+        if (mtp3Link->t5 != 0) {</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtp3Link[i].t5                = mtp3Link->t5;</span>
        } else {
<span style="color: #A00000">-                g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t4                = 8;</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtp3Link[i].t5                = 8;</span>
        }
<span style="color: #A00000">-        if (mtpLink->mtp3.t5 != 0) {</span>
<span style="color: #A00000">-                g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t5                = mtpLink->mtp3.t5;</span>
<span style="color: #00A000">+        if (mtp3Link->t7 != 0) {</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtp3Link[i].t7                = mtp3Link->t7;</span>
        } else {
<span style="color: #A00000">-                g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t5                = 8;</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtp3Link[i].t7                = 15;</span>
        }
<span style="color: #A00000">-        if (mtpLink->mtp3.t7 != 0) {</span>
<span style="color: #A00000">-                g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t7                = mtpLink->mtp3.t7;</span>
<span style="color: #00A000">+        if (mtp3Link->t12 != 0) {</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtp3Link[i].t12                = mtp3Link->t12;</span>
        } else {
<span style="color: #A00000">-                g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t7                = 15;</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtp3Link[i].t12                = 15;</span>
        }
<span style="color: #A00000">-        if (mtpLink->mtp3.t12 != 0) {</span>
<span style="color: #A00000">-                g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t12                = mtpLink->mtp3.t12;</span>
<span style="color: #00A000">+        if (mtp3Link->t13 != 0) {</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtp3Link[i].t13                = mtp3Link->t13;</span>
        } else {
<span style="color: #A00000">-                g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t12                = 15;</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtp3Link[i].t13                = 15;</span>
        }
<span style="color: #A00000">-        if (mtpLink->mtp3.t13 != 0) {</span>
<span style="color: #A00000">-                g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t13                = mtpLink->mtp3.t13;</span>
<span style="color: #00A000">+        if (mtp3Link->t14 != 0) {</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtp3Link[i].t14                = mtp3Link->t14;</span>
        } else {
<span style="color: #A00000">-                g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t13                = 15;</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtp3Link[i].t14                = 30;</span>
        }
<span style="color: #A00000">-        if (mtpLink->mtp3.t14 != 0) {</span>
<span style="color: #A00000">-                g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t14                = mtpLink->mtp3.t14;</span>
<span style="color: #00A000">+        if (mtp3Link->t17 != 0) {</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtp3Link[i].t17                = mtp3Link->t17;</span>
        } else {
<span style="color: #A00000">-                g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t14                = 30;</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtp3Link[i].t17                = 15;</span>
        }
<span style="color: #A00000">-        if (mtpLink->mtp3.t17 != 0) {</span>
<span style="color: #A00000">-                g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t17                = mtpLink->mtp3.t17;</span>
<span style="color: #00A000">+        if (mtp3Link->t22 != 0) {</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtp3Link[i].t22                = mtp3Link->t22;</span>
        } else {
<span style="color: #A00000">-                g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t17                = 15;</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtp3Link[i].t22                = 1800;</span>
        }
<span style="color: #A00000">-        if (mtpLink->mtp3.t22 != 0) {</span>
<span style="color: #A00000">-                g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t22                = mtpLink->mtp3.t22;</span>
<span style="color: #00A000">+        if (mtp3Link->t23 != 0) {</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtp3Link[i].t23                = mtp3Link->t23;</span>
        } else {
<span style="color: #A00000">-                g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t22                = 1800;</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtp3Link[i].t23                = 1800;</span>
        }
<span style="color: #A00000">-        if (mtpLink->mtp3.t23 != 0) {</span>
<span style="color: #A00000">-                g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t23                = mtpLink->mtp3.t23;</span>
<span style="color: #00A000">+        if (mtp3Link->t24 != 0) {</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtp3Link[i].t24                = mtp3Link->t24;</span>
        } else {
<span style="color: #A00000">-                g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t23                = 1800;</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtp3Link[i].t24                = 5;</span>
        }
<span style="color: #A00000">-        if (mtpLink->mtp3.t24 != 0) {</span>
<span style="color: #A00000">-                g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t24                = mtpLink->mtp3.t24;</span>
<span style="color: #00A000">+        if (mtp3Link->t31 != 0) {</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtp3Link[i].t31                = mtp3Link->t31;</span>
        } else {
<span style="color: #A00000">-                g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t24                = 5;</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtp3Link[i].t31                = 50;</span>
        }
<span style="color: #A00000">-        if (mtpLink->mtp3.t31 != 0) {</span>
<span style="color: #A00000">-                g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t31                = mtpLink->mtp3.t31;</span>
<span style="color: #00A000">+        if (mtp3Link->t32 != 0) {</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtp3Link[i].t32                = mtp3Link->t32;</span>
        } else {
<span style="color: #A00000">-                g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t31                = 50;</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtp3Link[i].t32                = 120;</span>
        }
<span style="color: #A00000">-        if (mtpLink->mtp3.t32 != 0) {</span>
<span style="color: #A00000">-                g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t32                = mtpLink->mtp3.t32;</span>
<span style="color: #00A000">+        if (mtp3Link->t33 != 0) {</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtp3Link[i].t33                = mtp3Link->t33;</span>
        } else {
<span style="color: #A00000">-                g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t32                = 120;</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtp3Link[i].t33                = 3000;</span>
        }
<span style="color: #A00000">-        if (mtpLink->mtp3.t33 != 0) {</span>
<span style="color: #A00000">-                g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t33                = mtpLink->mtp3.t33;</span>
<span style="color: #00A000">+        if (mtp3Link->t34 != 0) {</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtp3Link[i].t34                = mtp3Link->t34;</span>
        } else {
<span style="color: #A00000">-                g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t33                = 3000;</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtp3Link[i].t34                = 600;</span>
        }
<span style="color: #A00000">-        if (mtpLink->mtp3.t34 != 0) {</span>
<span style="color: #A00000">-                g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t34                = mtpLink->mtp3.t34;</span>
<span style="color: #00A000">+        if (mtp3Link->tbnd != 0) {</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtp3Link[i].tbnd                = mtp3Link->tbnd;</span>
        } else {
<span style="color: #A00000">-                g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t34                = 600;</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtp3Link[i].tbnd                = 30000;</span>
        }
<span style="color: #A00000">-        if (mtpLink->mtp3.tflc != 0) {</span>
<span style="color: #A00000">-                g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.tflc                = mtpLink->mtp3.tflc;</span>
<span style="color: #00A000">+        if (mtp3Link->tflc != 0) {</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtp3Link[i].tflc                = mtp3Link->tflc;</span>
        } else {
<span style="color: #A00000">-                g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.tflc                = 300;</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.mtp3Link[i].tflc                = 300;</span>
        }
<span style="color: #A00000">-        return (mtpLink->id);</span>
<span style="color: #00A000">+        return FTDM_SUCCESS;</span>
}
<span style="color: #A00000">-</span>
/******************************************************************************/
static int ftmod_ss7_fill_in_mtpLinkSet(sng_link_set_t *mtpLinkSet)
{
<span style="color: #800080; font-weight: bold">@@ -1537,9 +2306,6 @@ static int ftmod_ss7_fill_in_mtpLinkSet(sng_link_set_t *mtpLinkSet)</span>
        g_ftdm_sngss7_data.cfg.mtpLinkSet[i].id                        = mtpLinkSet->id;
        g_ftdm_sngss7_data.cfg.mtpLinkSet[i].apc                = mtpLinkSet->apc;
<span style="color: #A00000">-        g_ftdm_sngss7_data.cfg.mtpLinkSet[i].linkType        = mtpLinkSet->linkType;</span>
<span style="color: #A00000">-        g_ftdm_sngss7_data.cfg.mtpLinkSet[i].switchType        = mtpLinkSet->switchType;</span>
<span style="color: #A00000">-        g_ftdm_sngss7_data.cfg.mtpLinkSet[i].ssf                = mtpLinkSet->ssf;</span>
        /* these values are filled in as we find routes and start allocating cmbLinkSetIds */
        g_ftdm_sngss7_data.cfg.mtpLinkSet[i].minActive        = mtpLinkSet->minActive;
<span style="color: #800080; font-weight: bold">@@ -1550,28 +2316,25 @@ static int ftmod_ss7_fill_in_mtpLinkSet(sng_link_set_t *mtpLinkSet)</span>
/******************************************************************************/
static int ftmod_ss7_fill_in_mtp3_route(sng_route_t *mtp3_route)
{
<span style="color: #A00000">-        int i;</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-        /* go through all the existing routes and see if we find a match */</span>
<span style="color: #A00000">-        i = 1;</span>
<span style="color: #A00000">-        while (g_ftdm_sngss7_data.cfg.mtpRoute[i].id != 0) {</span>
<span style="color: #A00000">-                if (!strcasecmp(g_ftdm_sngss7_data.cfg.mtpRoute[i].name, mtp3_route->name)) {</span>
<span style="color: #A00000">-                        /* we have a match so break out of this loop */</span>
<span style="color: #A00000">-                        break;</span>
<span style="color: #A00000">-                }</span>
<span style="color: #A00000">-                /* move on to the next one */</span>
<span style="color: #A00000">-                i++;</span>
<span style="color: #A00000">-        }</span>
<span style="color: #00A000">+        int i = mtp3_route->id;</span>
<span style="color: #00A000">+        /* check if this id value has been used already */</span>
        if (g_ftdm_sngss7_data.cfg.mtpRoute[i].id == 0) {
<span style="color: #A00000">-                mtp3_route->id = i;</span>
<span style="color: #A00000">-                SS7_DEBUG("found new mtp3_route, id is = %d\n", mtp3_route->id);</span>
<span style="color: #00A000">+                SS7_DEBUG("Found new MTP3 Link: id=%d, name=%s\n", mtp3_route->id, mtp3_route->name);</span>
        } else {
<span style="color: #A00000">-                mtp3_route->id = i;</span>
<span style="color: #A00000">-                SS7_DEBUG("found existing mtp3_route, id is = %d\n", mtp3_route->id);</span>
<span style="color: #00A000">+                SS7_DEBUG("Found an existing MTP3 Link: id=%d, name=%s (old name=%s)\n", </span>
<span style="color: #00A000">+                                        mtp3_route->id, </span>
<span style="color: #00A000">+                                        mtp3_route->name,</span>
<span style="color: #00A000">+                                        g_ftdm_sngss7_data.cfg.mtpRoute[i].name);</span>
        }
<span style="color: #A00000">-        strncpy((char *)g_ftdm_sngss7_data.cfg.mtpRoute[i].name, (char *)mtp3_route->name, MAX_NAME_LEN-1);</span>
<span style="color: #00A000">+        /* fill in the cmbLinkSet in the linkset structure */</span>
<span style="color: #00A000">+        int tmp = g_ftdm_sngss7_data.cfg.mtpLinkSet[mtp3_route->linkSetId].numLinks;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        g_ftdm_sngss7_data.cfg.mtpLinkSet[mtp3_route->linkSetId].links[tmp] = mtp3_route->cmbLinkSetId;</span>
<span style="color: #00A000">+        g_ftdm_sngss7_data.cfg.mtpLinkSet[mtp3_route->linkSetId].numLinks++;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        strcpy((char *)g_ftdm_sngss7_data.cfg.mtpRoute[i].name, (char *)mtp3_route->name);</span>
        g_ftdm_sngss7_data.cfg.mtpRoute[i].id                        = mtp3_route->id;
        g_ftdm_sngss7_data.cfg.mtpRoute[i].dpc                        = mtp3_route->dpc;
<span style="color: #800080; font-weight: bold">@@ -1662,11 +2425,9 @@ static int ftmod_ss7_fill_in_nsap(sng_route_t *mtp3_route)</span>
        if (g_ftdm_sngss7_data.cfg.nsap[i].id == 0) {
                g_ftdm_sngss7_data.cfg.nsap[i].id = i;
<span style="color: #A00000">-                 mtp3_route->nwId = i;</span>
                SS7_DEBUG("found new mtp3_isup interface, id is = %d\n", g_ftdm_sngss7_data.cfg.nsap[i].id);
        } else {
                g_ftdm_sngss7_data.cfg.nsap[i].id = i;
<span style="color: #A00000">-                 mtp3_route->nwId = i;</span>
                SS7_DEBUG("found existing mtp3_isup interface, id is = %d\n", g_ftdm_sngss7_data.cfg.nsap[i].id);
        }
        
<span style="color: #800080; font-weight: bold">@@ -1683,26 +2444,17 @@ static int ftmod_ss7_fill_in_nsap(sng_route_t *mtp3_route)</span>
/******************************************************************************/
static int ftmod_ss7_fill_in_isup_interface(sng_isup_inf_t *sng_isup)
{
<span style="color: #A00000">-        int i;</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-        /* go through all the existing interfaces and see if we find a match */</span>
<span style="color: #A00000">-        i = 1;</span>
<span style="color: #A00000">-        while (g_ftdm_sngss7_data.cfg.isupIntf[i].id != 0) {</span>
<span style="color: #A00000">-                if (!strcasecmp(g_ftdm_sngss7_data.cfg.isupIntf[i].name, sng_isup->name)) {</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                        /* we have a match so break out of this loop */</span>
<span style="color: #A00000">-                        break;</span>
<span style="color: #A00000">-                }</span>
<span style="color: #A00000">-                /* move on to the next one */</span>
<span style="color: #A00000">-                i++;</span>
<span style="color: #A00000">-        }</span>
<span style="color: #00A000">+        int i = sng_isup->id;</span>
<span style="color: #00A000">+        /* check if this id value has been used already */</span>
        if (g_ftdm_sngss7_data.cfg.isupIntf[i].id == 0) {
<span style="color: #A00000">-                sng_isup->id = i;</span>
<span style="color: #A00000">-                SS7_DEBUG("found new isup interface, id is = %d\n", sng_isup->id);</span>
<span style="color: #00A000">+                SS7_DEBUG("Found new ISUP Interface: id=%d, name=%s\n", sng_isup->id, sng_isup->name);</span>
<span style="color: #00A000">+                sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_ISUP);</span>
        } else {
<span style="color: #A00000">-                sng_isup->id = i;</span>
<span style="color: #A00000">-                SS7_DEBUG("found existing isup interface, id is = %d\n", sng_isup->id);</span>
<span style="color: #00A000">+                SS7_DEBUG("Found an existing ISUP Interface: id=%d, name=%s (old name=%s)\n", </span>
<span style="color: #00A000">+                                        sng_isup->id, </span>
<span style="color: #00A000">+                                        sng_isup->name,</span>
<span style="color: #00A000">+                                        g_ftdm_sngss7_data.cfg.isupIntf[i].name);</span>
        }
        strncpy((char *)g_ftdm_sngss7_data.cfg.isupIntf[i].name, (char *)sng_isup->name, MAX_NAME_LEN-1);
<span style="color: #800080; font-weight: bold">@@ -1715,9 +2467,6 @@ static int ftmod_ss7_fill_in_isup_interface(sng_isup_inf_t *sng_isup)</span>
        g_ftdm_sngss7_data.cfg.isupIntf[i].switchType        = sng_isup->switchType;
        g_ftdm_sngss7_data.cfg.isupIntf[i].ssf                        = sng_isup->ssf;
        g_ftdm_sngss7_data.cfg.isupIntf[i].isap                        = sng_isup->isap;
<span style="color: #A00000">-        g_ftdm_sngss7_data.cfg.isupIntf[i].cld_nadi                = sng_isup->cld_nadi;</span>
<span style="color: #A00000">-        g_ftdm_sngss7_data.cfg.isupIntf[i].clg_nadi                = sng_isup->clg_nadi;</span>
<span style="color: #A00000">-        g_ftdm_sngss7_data.cfg.isupIntf[i].min_digits        = sng_isup->min_digits;</span>
        g_ftdm_sngss7_data.cfg.isupIntf[i].options                = sng_isup->options;
        if (sng_isup->t4 != 0) {
                g_ftdm_sngss7_data.cfg.isupIntf[i].t4                = sng_isup->t4;
<span style="color: #800080; font-weight: bold">@@ -1799,11 +2548,6 @@ static int ftmod_ss7_fill_in_isup_interface(sng_isup_inf_t *sng_isup)</span>
        } else {
                g_ftdm_sngss7_data.cfg.isupIntf[i].t32                = 30;
        }
<span style="color: #A00000">-        if (sng_isup->t35 != 0) {</span>
<span style="color: #A00000">-                g_ftdm_sngss7_data.cfg.isupIntf[i].t35                = sng_isup->t35;</span>
<span style="color: #A00000">-        } else {</span>
<span style="color: #A00000">-                g_ftdm_sngss7_data.cfg.isupIntf[i].t35                = 170;</span>
<span style="color: #A00000">-        }</span>
        if (sng_isup->t37 != 0) {
                g_ftdm_sngss7_data.cfg.isupIntf[i].t37                = sng_isup->t37;
        } else {
<span style="color: #800080; font-weight: bold">@@ -1857,10 +2601,10 @@ static int ftmod_ss7_fill_in_isap(sng_isap_t *sng_isap)</span>
        if (g_ftdm_sngss7_data.cfg.isap[i].id == 0) {
                sng_isap->id = i;
<span style="color: #A00000">-                SS7_DEBUG("found new isup to cc interface, id is = %d\n", g_ftdm_sngss7_data.cfg.isap[i].id);</span>
<span style="color: #00A000">+                SS7_DEBUG("found new isup to cc interface, id is = %d\n", sng_isap->id);</span>
        } else {
                sng_isap->id = i;
<span style="color: #A00000">-                SS7_DEBUG("found existing isup to cc interface, id is = %d\n", g_ftdm_sngss7_data.cfg.isap[i].id);</span>
<span style="color: #00A000">+                SS7_DEBUG("found existing isup to cc interface, id is = %d\n", sng_isap->id);</span>
        }
        g_ftdm_sngss7_data.cfg.isap[i].id                         = sng_isap->id;
<span style="color: #800080; font-weight: bold">@@ -2013,226 +2757,213 @@ static int ftmod_ss7_fill_in_self_route(int spc, int linkType, int switchType, i</span>
}
/******************************************************************************/
<span style="color: #A00000">-static int ftmod_ss7_fill_in_circuits(sng_isupCkt_t *isupCkt)</span>
<span style="color: #00A000">+static int ftmod_ss7_fill_in_ccSpan(sng_ccSpan_t *ccSpan)</span>
{
<span style="color: #A00000">-        sngss7_chan_data_t        *ss7_info = NULL;</span>
<span style="color: #A00000">-        ftdm_channel_t                *ftdmchan = NULL;</span>
        sng_timeslot_t                timeslot;
<span style="color: #A00000">-        int                                        count;</span>
<span style="color: #A00000">-        int                                        i;</span>
<span style="color: #00A000">+        sngss7_chan_data_t        *ss7_info = NULL;</span>
        int                                        x;
<span style="color: #00A000">+        int                                        count = 1;</span>
<span style="color: #A00000">-        count = 1;</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-        while (isupCkt->ch_map[0] != '\0') {</span>
<span style="color: #00A000">+        while (ccSpan->ch_map[0] != '\0') {</span>
<span style="color: #00A000">+        /**************************************************************************/</span>
<span style="color: #A00000">-                 /* pull out the next timeslot */</span>
<span style="color: #A00000">-                if (ftmod_ss7_next_timeslot(isupCkt->ch_map, &timeslot)) {</span>
<span style="color: #00A000">+                /* pull out the next timeslot */</span>
<span style="color: #00A000">+                if (ftmod_ss7_next_timeslot(ccSpan->ch_map, &timeslot)) {</span>
                        SS7_ERROR("Failed to parse the channel map!\n");
                        return FTDM_FAIL;
                }
<span style="color: #A00000">-                if ((timeslot.siglink) || (timeslot.gap)) {</span>
<span style="color: #A00000">-                        /* try to find the channel in the circuits structure*/</span>
<span style="color: #A00000">-                        x = 1;</span>
<span style="color: #A00000">-                        while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) {</span>
<span style="color: #A00000">-                                if ((g_ftdm_sngss7_data.cfg.isupCkt[x].chan == count) &&</span>
<span style="color: #A00000">-                                        (g_ftdm_sngss7_data.cfg.isupCkt[x].span == isupCkt->span->channels[1]->physical_span_id)) {</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                                        SS7_DEVEL_DEBUG("Circuit for span=%d, chan=%d is already exists...id=%d\n",</span>
<span style="color: #A00000">-                                                                isupCkt->span->channels[1]->physical_span_id,</span>
<span style="color: #A00000">-                                                                count,</span>
<span style="color: #A00000">-                                                                x);</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                                        /* we have a match so this circuit already exists in the structure */</span>
<span style="color: #A00000">-                                        break;</span>
<span style="color: #A00000">-                                }</span>
<span style="color: #A00000">-                                /* move to the next circuit */</span>
<span style="color: #A00000">-                                x++;</span>
<span style="color: #A00000">-                        } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) */</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                        /* check why we exited the while loop */</span>
<span style="color: #A00000">-                        if (g_ftdm_sngss7_data.cfg.isupCkt[x].id == 0) {</span>
<span style="color: #A00000">-                                SS7_DEVEL_DEBUG("Circuit for span=%d, chan=%d is new...id=%d\n",</span>
<span style="color: #A00000">-                                isupCkt->span->channels[1]->physical_span_id,</span>
<span style="color: #A00000">-                                count,</span>
<span style="color: #A00000">-                                x);</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                                /* prepare the global info sturcture */</span>
<span style="color: #A00000">-                                ss7_info = ftdm_calloc(1, sizeof(sngss7_chan_data_t));</span>
<span style="color: #A00000">-                                ss7_info->ftdmchan = NULL;</span>
<span style="color: #A00000">-                                ss7_info->circuit = &g_ftdm_sngss7_data.cfg.isupCkt[x];</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                                /* circuit is new so fill in the needed information */</span>
<span style="color: #A00000">-                                g_ftdm_sngss7_data.cfg.isupCkt[x].id                         = x;</span>
<span style="color: #A00000">-                                g_ftdm_sngss7_data.cfg.isupCkt[x].span                        = isupCkt->span->channels[1]->physical_span_id;</span>
<span style="color: #A00000">-                                g_ftdm_sngss7_data.cfg.isupCkt[x].chan                        = count;</span>
<span style="color: #A00000">-                                if (timeslot.siglink) {</span>
<span style="color: #A00000">-                                        g_ftdm_sngss7_data.cfg.isupCkt[x].type                = SIG;</span>
<span style="color: #A00000">-                                } else {</span>
<span style="color: #A00000">-                                        g_ftdm_sngss7_data.cfg.isupCkt[x].type                = HOLE;</span>
<span style="color: #A00000">-                                }</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                                if (timeslot.channel) {</span>
<span style="color: #A00000">-                                        g_ftdm_sngss7_data.cfg.isupCkt[x].cic                = isupCkt->cicbase;</span>
<span style="color: #A00000">-                                        isupCkt->cicbase++;</span>
<span style="color: #A00000">-                                } else {</span>
<span style="color: #A00000">-                                        g_ftdm_sngss7_data.cfg.isupCkt[x].cic                = 0;</span>
<span style="color: #A00000">-                                }</span>
<span style="color: #A00000">-                                g_ftdm_sngss7_data.cfg.isupCkt[x].infId                         = isupCkt->isupInf;</span>
<span style="color: #A00000">-                                g_ftdm_sngss7_data.cfg.isupCkt[x].typeCntrl         = isupCkt->typeCntrl;</span>
<span style="color: #A00000">-                                g_ftdm_sngss7_data.cfg.isupCkt[x].ssf                        = g_ftdm_sngss7_data.cfg.isupIntf[isupCkt->isupInf].ssf;</span>
<span style="color: #A00000">-                                g_ftdm_sngss7_data.cfg.isupCkt[x].obj                        = ss7_info;</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                        } /* if (g_ftdm_sngss7_data.cfg.isupCkt[x].id == 0) */</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                        /* increment the span channel count */</span>
<span style="color: #A00000">-                        count++;</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                } else { /* if ((timeslot.siglink) || (timeslot.gap)) */</span>
<span style="color: #A00000">-                        /* find the ftdm the channel structure for this channel*/</span>
<span style="color: #A00000">-                        i = 1;</span>
<span style="color: #A00000">-                        while (isupCkt->span->channels[i] != NULL) {</span>
<span style="color: #A00000">-                                if (isupCkt->span->channels[i]->physical_chan_id == timeslot.channel) {</span>
<span style="color: #A00000">-                                        break;</span>
<span style="color: #A00000">-                                }</span>
<span style="color: #A00000">-                                i++;</span>
<span style="color: #A00000">-                        } /* while (span->channels[i] != NULL) */</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                        if (isupCkt->span->channels[i] == NULL) {</span>
<span style="color: #A00000">-                                /* we weren't able to find the channel in the ftdm channels */</span>
<span style="color: #A00000">-                                SS7_ERROR("Unable to find the requested channel %d in the FreeTDM channels!\n", timeslot.channel);</span>
<span style="color: #A00000">-                                return FTDM_FAIL;</span>
<span style="color: #A00000">-                        } else {</span>
<span style="color: #A00000">-                                ftdmchan = isupCkt->span->channels[i];</span>
<span style="color: #A00000">-                        }</span>
<span style="color: #00A000">+                /* find the spot in master array for this circuit */</span>
<span style="color: #00A000">+                x = (ccSpan->procId * 1000) + count;</span>
<span style="color: #A00000">-                        /* try to find a match for the physical span and chan */</span>
<span style="color: #A00000">-                        x = 1;</span>
<span style="color: #A00000">-                        while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) {</span>
<span style="color: #A00000">-                                if ((g_ftdm_sngss7_data.cfg.isupCkt[x].chan == ftdmchan->physical_chan_id) && </span>
<span style="color: #A00000">-                                        (g_ftdm_sngss7_data.cfg.isupCkt[x].span == ftdmchan->physical_span_id)) {</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                                        /* we have a match so this circuit already exists in the structure */</span>
<span style="color: #A00000">-                                        break;</span>
<span style="color: #A00000">-                                }</span>
<span style="color: #A00000">-                                /* move to the next circuit */</span>
<span style="color: #A00000">-                                x++;</span>
<span style="color: #A00000">-                        } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) */</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                        /* check why we exited the while loop */</span>
<span style="color: #A00000">-                        if (g_ftdm_sngss7_data.cfg.isupCkt[x].id == 0) {</span>
<span style="color: #A00000">-                                SS7_DEVEL_DEBUG("Circuit for span=%d, chan=%d is new...id=%d\n",</span>
<span style="color: #A00000">-                                ftdmchan->physical_span_id,</span>
<span style="color: #A00000">-                                ftdmchan->physical_chan_id,</span>
<span style="color: #A00000">-                                x);</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                                /* prepare the global info sturcture */</span>
<span style="color: #A00000">-                                ss7_info = ftdm_calloc(1, sizeof(sngss7_chan_data_t));</span>
<span style="color: #A00000">-                                ss7_info->ftdmchan = ftdmchan;</span>
<span style="color: #A00000">-                                ss7_info->circuit = &g_ftdm_sngss7_data.cfg.isupCkt[x];</span>
<span style="color: #A00000">-                                ftdmchan->call_data = ss7_info;</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                                /* prepare the timer structures */</span>
<span style="color: #A00000">-                                ss7_info->t35.sched                        = ((sngss7_span_data_t *)isupCkt->span->signal_data)->sched;</span>
<span style="color: #A00000">-                                ss7_info->t35.counter                = 1;</span>
<span style="color: #A00000">-                                ss7_info->t35.beat                        = g_ftdm_sngss7_data.cfg.isupIntf[isupCkt->isupInf].t35*100; /* beat is in ms, t35 is in 100ms */</span>
<span style="color: #A00000">-                                ss7_info->t35.callback                = handle_isup_t35;</span>
<span style="color: #A00000">-                                ss7_info->t35.sngss7_info        = ss7_info;</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                                /* circuit is new so fill in the needed information */</span>
<span style="color: #A00000">-                                g_ftdm_sngss7_data.cfg.isupCkt[x].id                = x;</span>
<span style="color: #A00000">-                                g_ftdm_sngss7_data.cfg.isupCkt[x].span                = ftdmchan->physical_span_id;</span>
<span style="color: #A00000">-                                g_ftdm_sngss7_data.cfg.isupCkt[x].chan                = ftdmchan->physical_chan_id;</span>
<span style="color: #A00000">-                                g_ftdm_sngss7_data.cfg.isupCkt[x].type                = VOICE;</span>
<span style="color: #A00000">-                                g_ftdm_sngss7_data.cfg.isupCkt[x].cic                = isupCkt->cicbase;</span>
<span style="color: #A00000">-                                g_ftdm_sngss7_data.cfg.isupCkt[x].infId                = isupCkt->isupInf;</span>
<span style="color: #A00000">-                                g_ftdm_sngss7_data.cfg.isupCkt[x].typeCntrl        = isupCkt->typeCntrl;</span>
<span style="color: #A00000">-                                if (isupCkt->t3 == 0) {</span>
<span style="color: #A00000">-                                        g_ftdm_sngss7_data.cfg.isupCkt[x].t3        = 1200;</span>
<span style="color: #A00000">-                                } else {</span>
<span style="color: #A00000">-                                        g_ftdm_sngss7_data.cfg.isupCkt[x].t3        = isupCkt->t3;</span>
<span style="color: #A00000">-                                }</span>
<span style="color: #A00000">-                                if (isupCkt->t12 == 0) {</span>
<span style="color: #A00000">-                                        g_ftdm_sngss7_data.cfg.isupCkt[x].t12        = 300;</span>
<span style="color: #A00000">-                                } else {</span>
<span style="color: #A00000">-                                        g_ftdm_sngss7_data.cfg.isupCkt[x].t12        = isupCkt->t12;</span>
<span style="color: #A00000">-                                }</span>
<span style="color: #A00000">-                                if (isupCkt->t13 == 0) {</span>
<span style="color: #A00000">-                                        g_ftdm_sngss7_data.cfg.isupCkt[x].t13        = 3000;</span>
<span style="color: #A00000">-                                } else {</span>
<span style="color: #A00000">-                                        g_ftdm_sngss7_data.cfg.isupCkt[x].t13        = isupCkt->t13;</span>
<span style="color: #A00000">-                                }</span>
<span style="color: #A00000">-                                if (isupCkt->t14 == 0) {</span>
<span style="color: #A00000">-                                        g_ftdm_sngss7_data.cfg.isupCkt[x].t14        = 300;</span>
<span style="color: #A00000">-                                } else {</span>
<span style="color: #A00000">-                                        g_ftdm_sngss7_data.cfg.isupCkt[x].t14        = isupCkt->t14;</span>
<span style="color: #A00000">-                                }</span>
<span style="color: #A00000">-                                if (isupCkt->t15 == 0) {</span>
<span style="color: #A00000">-                                        g_ftdm_sngss7_data.cfg.isupCkt[x].t15        = 3000;</span>
<span style="color: #A00000">-                                } else {</span>
<span style="color: #A00000">-                                        g_ftdm_sngss7_data.cfg.isupCkt[x].t15        = isupCkt->t15;</span>
<span style="color: #A00000">-                                }</span>
<span style="color: #A00000">-                                if (isupCkt->t16 == 0) {</span>
<span style="color: #A00000">-                                        g_ftdm_sngss7_data.cfg.isupCkt[x].t16        = 300;</span>
<span style="color: #A00000">-                                } else {</span>
<span style="color: #A00000">-                                        g_ftdm_sngss7_data.cfg.isupCkt[x].t16        = isupCkt->t16;</span>
<span style="color: #A00000">-                                }</span>
<span style="color: #A00000">-                                if (isupCkt->t17 == 0) {</span>
<span style="color: #A00000">-                                        g_ftdm_sngss7_data.cfg.isupCkt[x].t17        = 3000;</span>
<span style="color: #A00000">-                                } else {</span>
<span style="color: #A00000">-                                        g_ftdm_sngss7_data.cfg.isupCkt[x].t17        = isupCkt->t17;</span>
<span style="color: #A00000">-                                }</span>
<span style="color: #A00000">-                                if (isupCkt->tval == 0) {</span>
<span style="color: #A00000">-                                        g_ftdm_sngss7_data.cfg.isupCkt[x].tval        = 10;</span>
<span style="color: #A00000">-                                } else {</span>
<span style="color: #A00000">-                                        g_ftdm_sngss7_data.cfg.isupCkt[x].tval        = isupCkt->tval;</span>
<span style="color: #A00000">-                                }</span>
<span style="color: #A00000">-                                g_ftdm_sngss7_data.cfg.isupCkt[x].obj                = ss7_info;</span>
<span style="color: #A00000">-                                g_ftdm_sngss7_data.cfg.isupCkt[x].ssf                = g_ftdm_sngss7_data.cfg.isupIntf[isupCkt->isupInf].ssf;</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                                /* increment the cicbase */</span>
<span style="color: #A00000">-                                isupCkt->cicbase++;</span>
<span style="color: #A00000">-                        } else { /* if (g_ftdm_sngss7_data.cfg.isupCkt[x].id == 0) */</span>
<span style="color: #A00000">-                                SS7_DEBUG("Circuit for span=%d, chan=%d is new...id=%d\n",</span>
<span style="color: #A00000">-                                                                        ftdmchan->physical_span_id,</span>
<span style="color: #A00000">-                                                                        ftdmchan->physical_chan_id,</span>
<span style="color: #A00000">-                                                                        x);</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                                /* for now make sure ss7_info is set to null */</span>
<span style="color: #A00000">-                                ss7_info = NULL;</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                                /* KONRAD FIX ME -> confirm that it is the same circuit */</span>
<span style="color: #A00000">-                        } /* if (g_ftdm_sngss7_data.cfg.isupCkt[x].id == 0) */</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                        /* increment the span channel count */</span>
<span style="color: #A00000">-                        count++;</span>
<span style="color: #A00000">-                } /* if ((timeslot.siglink) || (timeslot.gap)) */</span>
<span style="color: #A00000">-</span>
<span style="color: #A00000">-                if (ss7_info == NULL) {</span>
<span style="color: #A00000">-                        SS7_ERROR("KONRAD -> circuit was not configured !\n");</span>
<span style="color: #A00000">-                        return FTDM_FAIL;</span>
<span style="color: #00A000">+                /* check if this circuit has already been filled in */</span>
<span style="color: #00A000">+                if (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) {</span>
<span style="color: #00A000">+                        SS7_DEVEL_DEBUG("Filling in circuit that already exists...%d\n", x);</span>
                }
<span style="color: #A00000">-                if (ss7_info->ftdmchan == NULL) {</span>
<span style="color: #A00000">-                        SS7_INFO("Added span = %d, chan = %d, cic = %d, FTDM chan = %d, ISUP cirId = %d\n",</span>
<span style="color: #A00000">-                                                g_ftdm_sngss7_data.cfg.isupCkt[x].span,</span>
<span style="color: #A00000">-                                                g_ftdm_sngss7_data.cfg.isupCkt[x].chan,</span>
<span style="color: #A00000">-                                                g_ftdm_sngss7_data.cfg.isupCkt[x].cic,</span>
<span style="color: #A00000">-                                                0,</span>
<span style="color: #A00000">-                                                g_ftdm_sngss7_data.cfg.isupCkt[x].id);</span>
<span style="color: #00A000">+                /* prepare the global info sturcture */</span>
<span style="color: #00A000">+                ss7_info = ftdm_calloc(1, sizeof(sngss7_chan_data_t));</span>
<span style="color: #00A000">+                ss7_info->ftdmchan = NULL;</span>
<span style="color: #00A000">+                ss7_info->circuit = &g_ftdm_sngss7_data.cfg.isupCkt[x];</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.isupCkt[x].obj                        = ss7_info;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                /* fill in the rest of the global structure */</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.isupCkt[x].procId                 = ccSpan->procId;</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.isupCkt[x].id                         = x;</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.isupCkt[x].ccSpanId                = ccSpan->id;</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.isupCkt[x].span                        = 0;</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.isupCkt[x].chan                        = count;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                if (timeslot.siglink) {</span>
<span style="color: #00A000">+                        g_ftdm_sngss7_data.cfg.isupCkt[x].type                = SIG;</span>
<span style="color: #00A000">+                } else if (timeslot.gap) {</span>
<span style="color: #00A000">+                        g_ftdm_sngss7_data.cfg.isupCkt[x].type                = HOLE;</span>
                } else {
<span style="color: #A00000">-                        SS7_INFO("Added span = %d, chan = %d, cic = %d, FTDM chan = %d, ISUP cirId = %d\n",</span>
<span style="color: #A00000">-                                                g_ftdm_sngss7_data.cfg.isupCkt[x].span,</span>
<span style="color: #A00000">-                                                g_ftdm_sngss7_data.cfg.isupCkt[x].chan,</span>
<span style="color: #A00000">-                                                g_ftdm_sngss7_data.cfg.isupCkt[x].cic,</span>
<span style="color: #A00000">-                                                ss7_info->ftdmchan->chan_id,</span>
<span style="color: #A00000">-                                                g_ftdm_sngss7_data.cfg.isupCkt[x].id);</span>
<span style="color: #00A000">+                        g_ftdm_sngss7_data.cfg.isupCkt[x].type                = VOICE;</span>
<span style="color: #00A000">+                        </span>
<span style="color: #00A000">+                        /* throw the flag to indicate that we need to start call control */</span>
<span style="color: #00A000">+                        sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_CC);</span>
                }
<span style="color: #A00000">-        } /* while (ch_map[0] != '\0') */</span>
<span style="color: #00A000">+                if (timeslot.channel) {</span>
<span style="color: #00A000">+                        g_ftdm_sngss7_data.cfg.isupCkt[x].cic                = ccSpan->cicbase;</span>
<span style="color: #00A000">+                        ccSpan->cicbase++;</span>
<span style="color: #00A000">+                } else {</span>
<span style="color: #00A000">+                        g_ftdm_sngss7_data.cfg.isupCkt[x].cic                = 0;</span>
<span style="color: #00A000">+                }</span>
<span style="color: #A00000">-        return 0;</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.isupCkt[x].infId                         = ccSpan->isupInf;</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.isupCkt[x].typeCntrl         = ccSpan->typeCntrl;</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.isupCkt[x].ssf                        = ccSpan->ssf;</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.isupCkt[x].cld_nadi                = ccSpan->cld_nadi;</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.isupCkt[x].clg_nadi                = ccSpan->clg_nadi;</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.isupCkt[x].options                = ccSpan->options;</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.isupCkt[x].switchType        = ccSpan->switchType;</span>
<span style="color: #00A000">+                g_ftdm_sngss7_data.cfg.isupCkt[x].min_digits        = ccSpan->min_digits;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                if (ccSpan->t3 == 0) {</span>
<span style="color: #00A000">+                        g_ftdm_sngss7_data.cfg.isupCkt[x].t3                        = 1200;</span>
<span style="color: #00A000">+                } else {</span>
<span style="color: #00A000">+                        g_ftdm_sngss7_data.cfg.isupCkt[x].t3                        = ccSpan->t3;</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+                if (ccSpan->t12 == 0) {</span>
<span style="color: #00A000">+                        g_ftdm_sngss7_data.cfg.isupCkt[x].t12                = 300;</span>
<span style="color: #00A000">+                } else {</span>
<span style="color: #00A000">+                        g_ftdm_sngss7_data.cfg.isupCkt[x].t12                = ccSpan->t12;</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+                if (ccSpan->t13 == 0) {</span>
<span style="color: #00A000">+                        g_ftdm_sngss7_data.cfg.isupCkt[x].t13                = 3000;</span>
<span style="color: #00A000">+                } else {</span>
<span style="color: #00A000">+                        g_ftdm_sngss7_data.cfg.isupCkt[x].t13                = ccSpan->t13;</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+                if (ccSpan->t14 == 0) {</span>
<span style="color: #00A000">+                        g_ftdm_sngss7_data.cfg.isupCkt[x].t14                = 300;</span>
<span style="color: #00A000">+                } else {</span>
<span style="color: #00A000">+                        g_ftdm_sngss7_data.cfg.isupCkt[x].t14                = ccSpan->t14;</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+                if (ccSpan->t15 == 0) {</span>
<span style="color: #00A000">+                        g_ftdm_sngss7_data.cfg.isupCkt[x].t15                = 3000;</span>
<span style="color: #00A000">+                } else {</span>
<span style="color: #00A000">+                        g_ftdm_sngss7_data.cfg.isupCkt[x].t15                = ccSpan->t15;</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+                if (ccSpan->t16 == 0) {</span>
<span style="color: #00A000">+                        g_ftdm_sngss7_data.cfg.isupCkt[x].t16                = 300;</span>
<span style="color: #00A000">+                } else {</span>
<span style="color: #00A000">+                        g_ftdm_sngss7_data.cfg.isupCkt[x].t16                = ccSpan->t16;</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+                if (ccSpan->t17 == 0) {</span>
<span style="color: #00A000">+                        g_ftdm_sngss7_data.cfg.isupCkt[x].t17                = 3000;</span>
<span style="color: #00A000">+                } else {</span>
<span style="color: #00A000">+                        g_ftdm_sngss7_data.cfg.isupCkt[x].t17                = ccSpan->t17;</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+                if (ccSpan->t35 == 0) {</span>
<span style="color: #00A000">+                        g_ftdm_sngss7_data.cfg.isupCkt[x].t17                = 170;</span>
<span style="color: #00A000">+                } else {</span>
<span style="color: #00A000">+                        g_ftdm_sngss7_data.cfg.isupCkt[x].t17                = ccSpan->t35;</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+                if (ccSpan->tval == 0) {</span>
<span style="color: #00A000">+                        g_ftdm_sngss7_data.cfg.isupCkt[x].tval                = 10;</span>
<span style="color: #00A000">+                } else {</span>
<span style="color: #00A000">+                        g_ftdm_sngss7_data.cfg.isupCkt[x].tval                = ccSpan->tval;</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                SS7_INFO("Added procId=%d, spanId = %d, chan = %d, cic = %d, ISUP cirId = %d\n",</span>
<span style="color: #00A000">+                                        g_ftdm_sngss7_data.cfg.isupCkt[x].procId,</span>
<span style="color: #00A000">+                                        g_ftdm_sngss7_data.cfg.isupCkt[x].ccSpanId,</span>
<span style="color: #00A000">+                                        g_ftdm_sngss7_data.cfg.isupCkt[x].chan,</span>
<span style="color: #00A000">+                                        g_ftdm_sngss7_data.cfg.isupCkt[x].cic,</span>
<span style="color: #00A000">+                                        g_ftdm_sngss7_data.cfg.isupCkt[x].id);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                /* increment the span channel count */</span>
<span style="color: #00A000">+                count++;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /**************************************************************************/</span>
<span style="color: #00A000">+        } /* while (ccSpan->ch_map[0] != '\0') */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return FTDM_SUCCESS;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/******************************************************************************/</span>
<span style="color: #00A000">+static int ftmod_ss7_fill_in_circuits(sng_span_t *sngSpan)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        ftdm_channel_t                *ftdmchan = NULL;</span>
<span style="color: #00A000">+        ftdm_span_t                        *ftdmspan = sngSpan->span;</span>
<span style="color: #00A000">+        sng_isup_ckt_t                *isupCkt = NULL;</span>
<span style="color: #00A000">+        sngss7_chan_data_t        *ss7_info = NULL;</span>
<span style="color: #00A000">+        int                                        flag;</span>
<span style="color: #00A000">+        int                                        i;</span>
<span style="color: #00A000">+        int                                        x;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* go through all the channels on ftdm span */</span>
<span style="color: #00A000">+        for (i = 1; i < (ftdmspan->chan_count+1); i++) {</span>
<span style="color: #00A000">+        /**************************************************************************/</span>
<span style="color: #00A000">+                </span>
<span style="color: #00A000">+                /* extract the ftdmchan pointer */</span>
<span style="color: #00A000">+                ftdmchan = ftdmspan->channels[i];</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                /* find the equivalent channel in the global structure */</span>
<span style="color: #00A000">+                x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1;</span>
<span style="color: #00A000">+                flag = 0;</span>
<span style="color: #00A000">+                while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) {</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                        /* pull out the circuit to make it easier to work with */</span>
<span style="color: #00A000">+                        isupCkt = &g_ftdm_sngss7_data.cfg.isupCkt[x];</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                        /* if the ccSpanId's match fill in the span value...this is for sigs</span>
<span style="color: #00A000">+                         * because they will never have a channel that matches since they </span>
<span style="color: #00A000">+                         * have a ftdmchan at this time */</span>
<span style="color: #00A000">+                        if (sngSpan->ccSpanId == isupCkt->ccSpanId) {</span>
<span style="color: #00A000">+                                isupCkt->span = ftdmchan->physical_span_id;</span>
<span style="color: #00A000">+                        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                        /* check if the ccSpanId matches and the physical channel # match */</span>
<span style="color: #00A000">+                        if ((sngSpan->ccSpanId == isupCkt->ccSpanId) &&</span>
<span style="color: #00A000">+                                (ftdmchan->physical_chan_id == isupCkt->chan)) {</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                                /* we've found the channel in the ckt structure...raise the flag */</span>
<span style="color: #00A000">+                                flag = 1;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                                /* now get out of the loop */</span>
<span style="color: #00A000">+                                break;</span>
<span style="color: #00A000">+                        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                        /* move to the next ckt */</span>
<span style="color: #00A000">+                        x++;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                        /* check if we are outside of the range of possible indexes */</span>
<span style="color: #00A000">+                        if (x == ((g_ftdm_sngss7_data.cfg.procId + 1) * 1000)) {</span>
<span style="color: #00A000">+                                break;</span>
<span style="color: #00A000">+                        }</span>
<span style="color: #00A000">+                /**********************************************************************/</span>
<span style="color: #00A000">+                } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                /* check we found the ckt or not */</span>
<span style="color: #00A000">+                if (!flag) {</span>
<span style="color: #00A000">+                        SS7_ERROR_CHAN(ftdmchan, "Failed to find this channel in the global ckts!%s\n","");</span>
<span style="color: #00A000">+                        return FTDM_FAIL;</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                /* fill in the rest of the global sngss7_chan_data_t structure */</span>
<span style="color: #00A000">+                ss7_info = (sngss7_chan_data_t *)isupCkt->obj;</span>
<span style="color: #00A000">+                ss7_info->ftdmchan = ftdmchan;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                /* attach the sngss7_chan_data_t to the freetdm channel structure */</span>
<span style="color: #00A000">+                ftdmchan->call_data = ss7_info;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                /* prepare the timer structures */</span>
<span style="color: #00A000">+                ss7_info->t35.sched                        = ((sngss7_span_data_t *)(ftdmspan->signal_data))->sched;</span>
<span style="color: #00A000">+                ss7_info->t35.counter                = 1;</span>
<span style="color: #00A000">+                ss7_info->t35.beat                        = (isupCkt->t35) * 100; /* beat is in ms, t35 is in 100ms */</span>
<span style="color: #00A000">+                ss7_info->t35.callback                = handle_isup_t35;</span>
<span style="color: #00A000">+                ss7_info->t35.sngss7_info        = ss7_info;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /**************************************************************************/</span>
<span style="color: #00A000">+        } /* for (i == 1; i < ftdmspan->chan_count; i++) */</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return FTDM_SUCCESS;</span>
}
/******************************************************************************/
</pre></div>
<div class="highlight"><pre>committer: Anthony Minessale
comments:
fix || where it should be or in sql stmt that may cause stray records in the calls table
<span style="color: #000080; font-weight: bold">diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c</span>
<span style="color: #000080; font-weight: bold">index 4167b4a..35311c9 100644</span>
<span style="color: #A00000">--- a/src/switch_core_sqldb.c</span>
<span style="color: #00A000">+++ b/src/switch_core_sqldb.c</span>
<span style="color: #800080; font-weight: bold">@@ -1160,15 +1160,14 @@ static void core_event_handler(switch_event_t *event)</span>
        case SWITCH_EVENT_CHANNEL_DESTROY:
                {
                        const char *uuid = switch_event_get_header(event, "unique-id");
<span style="color: #A00000">-                        const char *sig = switch_event_get_header(event, "signal_bridge");</span>
                        
                        if (uuid) {
                                new_sql() = switch_mprintf("delete from channels where uuid='%q' and hostname='%q'",
                                                                                 uuid, switch_core_get_variable("hostname"));
<span style="color: #A00000">-                                if (switch_true(sig)) {</span>
<span style="color: #A00000">-                                        new_sql() = switch_mprintf("delete from calls where (caller_uuid='%q' || callee_uuid='%q') and hostname='%q'",</span>
<span style="color: #A00000">-                                                                                         uuid, uuid, switch_core_get_variable("hostname"));</span>
<span style="color: #A00000">-                                }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                                new_sql() = switch_mprintf("delete from calls where (caller_uuid='%q' or callee_uuid='%q') and hostname='%q'",</span>
<span style="color: #00A000">+                                                                                 uuid, uuid, switch_core_get_variable("hostname"));</span>
<span style="color: #00A000">+</span>
                        }
                }
                break;
<span style="color: #800080; font-weight: bold">@@ -1410,7 +1409,7 @@ static void core_event_handler(switch_event_t *event)</span>
                }
                break;
        case SWITCH_EVENT_CHANNEL_UNBRIDGE:
<span style="color: #A00000">-                new_sql() = switch_mprintf("delete from calls where caller_uuid='%s' and hostname='%q'",</span>
<span style="color: #00A000">+                new_sql() = switch_mprintf("delete from calls where (caller_uuid='%s' or callee_uuid='%q') and hostname='%q'",</span>
                                                                 switch_event_get_header_nil(event, "caller-unique-id"), switch_core_get_variable("hostname"));
                break;
        case SWITCH_EVENT_SHUTDOWN:
</pre></div>
<div class="highlight"><pre>committer: Marc Olivier Chouinard
comments:
mod_callcenter: Add error response for queue load and queue reload (FS-2988)
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c</span>
<span style="color: #000080; font-weight: bold">index d1de632..61305bb 100644</span>
<span style="color: #A00000">--- a/src/mod/applications/mod_callcenter/mod_callcenter.c</span>
<span style="color: #00A000">+++ b/src/mod/applications/mod_callcenter/mod_callcenter.c</span>
<span style="color: #800080; font-weight: bold">@@ -2625,8 +2625,10 @@ SWITCH_STANDARD_API(cc_config_api_function)</span>
                                cc_queue_t *queue = NULL;
                                if ((queue = get_queue(queue_name))) {
                                        queue_rwunlock(queue);
<span style="color: #00A000">+                                        stream->write_function(stream, "%s", "+OK\n");</span>
<span style="color: #00A000">+                                } else {</span>
<span style="color: #00A000">+                                        stream->write_function(stream, "%s", "-ERR Invalid Queue not found!\n");</span>
                                }
<span style="color: #A00000">-                                stream->write_function(stream, "%s", "+OK\n");</span>
                        }
                } else if (action && !strcasecmp(action, "unload")) {
                        if (argc-initial_argc < 1) {
<span style="color: #800080; font-weight: bold">@@ -2648,8 +2650,10 @@ SWITCH_STANDARD_API(cc_config_api_function)</span>
                                destroy_queue(queue_name, SWITCH_FALSE);
                                if ((queue = get_queue(queue_name))) {
                                        queue_rwunlock(queue);
<span style="color: #00A000">+                                        stream->write_function(stream, "%s", "+OK\n");</span>
<span style="color: #00A000">+                                } else {</span>
<span style="color: #00A000">+                                        stream->write_function(stream, "%s", "-ERR Invalid Queue not found!\n");</span>
                                }
<span style="color: #A00000">-                                stream->write_function(stream, "%s", "+OK\n");</span>
                        }
                } else if (action && !strcasecmp(action, "list")) {
                        if (argc-initial_argc < 1) {
<span style="color: #800080; font-weight: bold">@@ -2671,7 +2675,6 @@ SWITCH_STANDARD_API(cc_config_api_function)</span>
                                goto done;
                        } else {
                                const char *queue_name = argv[0 + initial_argc];
<span style="color: #A00000">-</span>
                                struct list_result cbt;
                                cbt.row_process = 0;
                                cbt.stream = stream;
</pre></div>
<div class="highlight"><pre>committer: Leon de Rooij
comments:
Merge branch 'master' of ssh://git.freeswitch.org/freeswitch
</pre></div>
<div class="highlight"><pre>committer: Raymond Chandler
comments:
Merge branch 'master' of fs-git:freeswitch
</pre></div>
<div class="highlight"><pre>committer: Raymond Chandler
comments:
TEST-002
<span style="color: #000080; font-weight: bold">diff --git a/conf/freeswitch.xml b/conf/freeswitch.xml</span>
<span style="color: #000080; font-weight: bold">index 5fc9402..6914128 100644</span>
<span style="color: #A00000">--- a/conf/freeswitch.xml</span>
<span style="color: #00A000">+++ b/conf/freeswitch.xml</span>
<span style="color: #800080; font-weight: bold">@@ -61,5 +61,4 @@</span>
<X-PRE-PROCESS cmd="include" data="lang/ru/*.xml"/>
</macros>
</section>
<span style="color: #A00000">-</span>
</document>
</pre></div>
<div class="highlight"><pre>committer: Daniel Swarbrick
comments:
partial implementation of channel list via snmp
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/event_handlers/mod_snmp/FREESWITCH-MIB b/src/mod/event_handlers/mod_snmp/FREESWITCH-MIB</span>
<span style="color: #000080; font-weight: bold">index 9584c8b..11c3999 100644</span>
<span style="color: #A00000">--- a/src/mod/event_handlers/mod_snmp/FREESWITCH-MIB</span>
<span style="color: #00A000">+++ b/src/mod/event_handlers/mod_snmp/FREESWITCH-MIB</span>
<span style="color: #800080; font-weight: bold">@@ -107,4 +107,88 @@ maxSessionsPerSecond OBJECT-TYPE</span>
"Maximum permissible sessions per second"
::= { systemStats 7 }
<span style="color: #00A000">+</span>
<span style="color: #00A000">+ChannelEntry ::= SEQUENCE {</span>
<span style="color: #00A000">+ chanUUID DisplayString,</span>
<span style="color: #00A000">+ chanDirection DisplayString,</span>
<span style="color: #00A000">+ chanCreated DisplayString,</span>
<span style="color: #00A000">+ chanName DisplayString,</span>
<span style="color: #00A000">+ chanState DisplayString,</span>
<span style="color: #00A000">+ chanCIDName DisplayString,</span>
<span style="color: #00A000">+ chanCIDNum DisplayString</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+channelList OBJECT-TYPE</span>
<span style="color: #00A000">+ SYNTAX SEQUENCE OF ChannelEntry</span>
<span style="color: #00A000">+ MAX-ACCESS not-accessible</span>
<span style="color: #00A000">+ STATUS current</span>
<span style="color: #00A000">+ DESCRIPTION</span>
<span style="color: #00A000">+ "A table containing a list of active channels"</span>
<span style="color: #00A000">+ ::= { core 9 }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+channelEntry OBJECT-TYPE</span>
<span style="color: #00A000">+ SYNTAX ChannelEntry</span>
<span style="color: #00A000">+ MAX-ACCESS not-accessible</span>
<span style="color: #00A000">+ STATUS current</span>
<span style="color: #00A000">+ DESCRIPTION</span>
<span style="color: #00A000">+ "A channel entry"</span>
<span style="color: #00A000">+ INDEX { chanIndex }</span>
<span style="color: #00A000">+ ::= { channelList 1 }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+chanUUID OBJECT-TYPE</span>
<span style="color: #00A000">+ SYNTAX DisplayString</span>
<span style="color: #00A000">+ MAX-ACCESS read-only</span>
<span style="color: #00A000">+ STATUS current</span>
<span style="color: #00A000">+ DESCRIPTION</span>
<span style="color: #00A000">+ "The channel UUID."</span>
<span style="color: #00A000">+ ::= { channelEntry 1 }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+chanDirection OBJECT-TYPE</span>
<span style="color: #00A000">+ SYNTAX DisplayString</span>
<span style="color: #00A000">+ MAX-ACCESS read-only</span>
<span style="color: #00A000">+ STATUS current</span>
<span style="color: #00A000">+ DESCRIPTION</span>
<span style="color: #00A000">+ "The channel direction."</span>
<span style="color: #00A000">+ ::= { channelEntry 2 }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+chanCreated OBJECT-TYPE</span>
<span style="color: #00A000">+ SYNTAX DisplayString</span>
<span style="color: #00A000">+ MAX-ACCESS read-only</span>
<span style="color: #00A000">+ STATUS current</span>
<span style="color: #00A000">+ DESCRIPTION</span>
<span style="color: #00A000">+ "Channel creation timestamp."</span>
<span style="color: #00A000">+ ::= { channelEntry 3 }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+chanName OBJECT-TYPE</span>
<span style="color: #00A000">+ SYNTAX DisplayString</span>
<span style="color: #00A000">+ MAX-ACCESS read-only</span>
<span style="color: #00A000">+ STATUS current</span>
<span style="color: #00A000">+ DESCRIPTION</span>
<span style="color: #00A000">+ "The channel name."</span>
<span style="color: #00A000">+ ::= { channelEntry 4 }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+chanState OBJECT-TYPE</span>
<span style="color: #00A000">+ SYNTAX DisplayString</span>
<span style="color: #00A000">+ MAX-ACCESS read-only</span>
<span style="color: #00A000">+ STATUS current</span>
<span style="color: #00A000">+ DESCRIPTION</span>
<span style="color: #00A000">+ "The channel state."</span>
<span style="color: #00A000">+ ::= { channelEntry 5 }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+chanCIDName OBJECT-TYPE</span>
<span style="color: #00A000">+ SYNTAX DisplayString</span>
<span style="color: #00A000">+ MAX-ACCESS read-only</span>
<span style="color: #00A000">+ STATUS current</span>
<span style="color: #00A000">+ DESCRIPTION</span>
<span style="color: #00A000">+ "The channel caller ID name."</span>
<span style="color: #00A000">+ ::= { channelEntry 6 }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+chanCIDNum OBJECT-TYPE</span>
<span style="color: #00A000">+ SYNTAX DisplayString</span>
<span style="color: #00A000">+ MAX-ACCESS read-only</span>
<span style="color: #00A000">+ STATUS current</span>
<span style="color: #00A000">+ DESCRIPTION</span>
<span style="color: #00A000">+ "The channel caller ID number."</span>
<span style="color: #00A000">+ ::= { channelEntry 7 }</span>
<span style="color: #00A000">+</span>
END
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/event_handlers/mod_snmp/mod_snmp.c b/src/mod/event_handlers/mod_snmp/mod_snmp.c</span>
<span style="color: #000080; font-weight: bold">index 56c7be1..d415d4f 100644</span>
<span style="color: #A00000">--- a/src/mod/event_handlers/mod_snmp/mod_snmp.c</span>
<span style="color: #00A000">+++ b/src/mod/event_handlers/mod_snmp/mod_snmp.c</span>
<span style="color: #800080; font-weight: bold">@@ -109,7 +109,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_snmp_load)</span>
         */
        netsnmp_ds_set_int(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_AGENTX_PING_INTERVAL, 2);
<span style="color: #A00000">-        init_subagent(); </span>
<span style="color: #00A000">+        init_subagent(pool);</span>
        init_snmp("mod_snmp");
        return status;
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/event_handlers/mod_snmp/subagent.c b/src/mod/event_handlers/mod_snmp/subagent.c</span>
<span style="color: #000080; font-weight: bold">index bad3dc6..7b9faa7 100644</span>
<span style="color: #A00000">--- a/src/mod/event_handlers/mod_snmp/subagent.c</span>
<span style="color: #00A000">+++ b/src/mod/event_handlers/mod_snmp/subagent.c</span>
<span style="color: #800080; font-weight: bold">@@ -36,27 +36,108 @@</span>
#include <net-snmp/agent/net-snmp-agent-includes.h>
#include "subagent.h"
<span style="color: #00A000">+netsnmp_table_registration_info *ch_table_info;</span>
<span style="color: #00A000">+netsnmp_tdata *ch_table;</span>
<span style="color: #00A000">+netsnmp_handler_registration *ch_reginfo;</span>
<span style="color: #00A000">+uint32_t idx;</span>
<span style="color: #A00000">-void init_subagent(void)</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+static int sql_count_callback(void *pArg, int argc, char **argv, char **columnNames)</span>
{
<span style="color: #A00000">-        static oid identity_oid[] = { 1,3,6,1,4,1,27880,1,1 };</span>
<span style="color: #A00000">-        static oid systemStats_oid[] = { 1,3,6,1,4,1,27880,1,2 };</span>
<span style="color: #00A000">+        uint32_t *count = (uint32_t *) pArg;</span>
<span style="color: #00A000">+        *count = atoi(argv[0]);</span>
<span style="color: #00A000">+        return 0;</span>
<span style="color: #00A000">+}</span>
<span style="color: #A00000">-        DEBUGMSGTL(("init_subagent", "Initializing\n"));</span>
<span style="color: #A00000">-        netsnmp_register_scalar_group(netsnmp_create_handler_registration("identity", handle_identity, identity_oid, OID_LENGTH(identity_oid), HANDLER_CAN_RONLY), 1, 2);</span>
<span style="color: #A00000">-        netsnmp_register_scalar_group(netsnmp_create_handler_registration("systemStats", handle_systemStats, systemStats_oid, OID_LENGTH(systemStats_oid), HANDLER_CAN_RONLY), 1, 7);</span>
<span style="color: #00A000">+static int channelList_callback(void *pArg, int argc, char **argv, char **columnNames)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        chan_entry_t *entry;</span>
<span style="color: #00A000">+        netsnmp_tdata_row *row;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        switch_zmalloc(entry, sizeof(chan_entry_t));</span>
<span style="color: #00A000">+        if (!entry)</span>
<span style="color: #00A000">+                return 0;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        row = netsnmp_tdata_create_row();</span>
<span style="color: #00A000">+        if (!row) {</span>
<span style="color: #00A000">+                switch_safe_free(entry);</span>
<span style="color: #00A000">+                return 0;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        row->data = entry;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        entry->idx = idx++;</span>
<span style="color: #00A000">+        strncpy(entry->uuid, argv[0], sizeof(entry->uuid));</span>
<span style="color: #00A000">+        strncpy(entry->direction, argv[1], sizeof(entry->direction));</span>
<span style="color: #00A000">+        strncpy(entry->created, argv[2], sizeof(entry->created));</span>
<span style="color: #00A000">+        strncpy(entry->name, argv[4], sizeof(entry->name));</span>
<span style="color: #00A000">+        strncpy(entry->state, argv[5], sizeof(entry->state));</span>
<span style="color: #00A000">+        strncpy(entry->cid_name, argv[6], sizeof(entry->cid_name));</span>
<span style="color: #00A000">+        strncpy(entry->cid_num, argv[7], sizeof(entry->cid_num));</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        netsnmp_tdata_row_add_index(row, ASN_INTEGER, &entry->idx, sizeof(entry->idx));</span>
<span style="color: #00A000">+        netsnmp_tdata_add_row(ch_table, row);</span>
<span style="color: #00A000">+        return 0;</span>
}
<span style="color: #A00000">-static int sql_count_callback(void *pArg, int argc, char **argv, char **columnNames)</span>
<span style="color: #00A000">+void channelList_free(netsnmp_cache *cache, void *magic)</span>
{
<span style="color: #A00000">-        uint32_t *count = (uint32_t *) pArg;</span>
<span style="color: #A00000">-        *count = atoi(argv[0]);</span>
<span style="color: #00A000">+        netsnmp_tdata_row *row = netsnmp_tdata_row_first(ch_table);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        /* Delete table rows one by one */</span>
<span style="color: #00A000">+        while (row) {</span>
<span style="color: #00A000">+                netsnmp_tdata_remove_and_delete_row(ch_table, row);</span>
<span style="color: #00A000">+                switch_safe_free(row->data);</span>
<span style="color: #00A000">+                row = netsnmp_tdata_row_first(ch_table);</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+int channelList_load(netsnmp_cache *cache, void *vmagic)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        switch_cache_db_handle_t *dbh;</span>
<span style="color: #00A000">+        char sql[1024] = "", hostname[256] = "";</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        channelList_free(cache, NULL);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if (switch_core_db_handle(&dbh) != SWITCH_STATUS_SUCCESS) {</span>
<span style="color: #00A000">+                return 0;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        idx = 1;</span>
<span style="color: #00A000">+        gethostname(hostname, sizeof(hostname));</span>
<span style="color: #00A000">+        sprintf(sql, "SELECT * FROM channels WHERE hostname='%s' ORDER BY created_epoch", hostname);</span>
<span style="color: #00A000">+        switch_cache_db_execute_sql_callback(dbh, sql, channelList_callback, NULL, NULL);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        switch_cache_db_release_db_handle(&dbh);</span>
<span style="color: #00A000">+</span>
        return 0;
}
<span style="color: #00A000">+void init_subagent(switch_memory_pool_t *pool)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        static oid identity_oid[] = { 1,3,6,1,4,1,27880,1,1 };</span>
<span style="color: #00A000">+        static oid systemStats_oid[] = { 1,3,6,1,4,1,27880,1,2 };</span>
<span style="color: #00A000">+        static oid channelList_oid[] = { 1,3,6,1,4,1,27880,1,9 };</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        DEBUGMSGTL(("init_subagent", "mod_snmp subagent initializing\n"));</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        netsnmp_register_scalar_group(netsnmp_create_handler_registration("identity", handle_identity, identity_oid, OID_LENGTH(identity_oid), HANDLER_CAN_RONLY), 1, 2);</span>
<span style="color: #00A000">+        netsnmp_register_scalar_group(netsnmp_create_handler_registration("systemStats", handle_systemStats, systemStats_oid, OID_LENGTH(systemStats_oid), HANDLER_CAN_RONLY), 1, 7);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        ch_table_info = switch_core_alloc(pool, sizeof(netsnmp_table_registration_info));</span>
<span style="color: #00A000">+        netsnmp_table_helper_add_index(ch_table_info, ASN_INTEGER);</span>
<span style="color: #00A000">+        ch_table_info->min_column = 1;</span>
<span style="color: #00A000">+        ch_table_info->max_column = 7;</span>
<span style="color: #00A000">+        ch_table = netsnmp_tdata_create_table("channelList", 0);</span>
<span style="color: #00A000">+        ch_reginfo = netsnmp_create_handler_registration("channelList", handle_channelList, channelList_oid, OID_LENGTH(channelList_oid), HANDLER_CAN_RONLY);</span>
<span style="color: #00A000">+        netsnmp_tdata_register(ch_reginfo, ch_table, ch_table_info);</span>
<span style="color: #00A000">+        netsnmp_inject_handler(ch_reginfo, netsnmp_get_cache_handler(5, channelList_load, channelList_free, channelList_oid, OID_LENGTH(channelList_oid)));</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
int handle_identity(netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *reqinfo, netsnmp_request_info *requests)
{
        netsnmp_request_info *request = NULL;
<span style="color: #800080; font-weight: bold">@@ -97,7 +178,7 @@ int handle_systemStats(netsnmp_mib_handler *handler, netsnmp_handler_registratio</span>
        netsnmp_request_info *request = NULL;
        oid subid;
        switch_time_t uptime;
<span style="color: #A00000">-        uint32_t int_val;</span>
<span style="color: #00A000">+        uint32_t int_val = 0;</span>
        switch(reqinfo->mode) {
        case MODE_GET:
<span style="color: #800080; font-weight: bold">@@ -160,6 +241,55 @@ int handle_systemStats(netsnmp_mib_handler *handler, netsnmp_handler_registratio</span>
}
<span style="color: #00A000">+int handle_channelList(netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *reqinfo, netsnmp_request_info *requests)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        netsnmp_request_info *request;</span>
<span style="color: #00A000">+        netsnmp_table_request_info *table_info;</span>
<span style="color: #00A000">+        chan_entry_t *entry;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        switch (reqinfo->mode) {</span>
<span style="color: #00A000">+        case MODE_GET:</span>
<span style="color: #00A000">+                for (request = requests; request; request = request->next) {</span>
<span style="color: #00A000">+                        table_info = netsnmp_extract_table_info(request);</span>
<span style="color: #00A000">+                        entry = (chan_entry_t *) netsnmp_tdata_extract_entry(request);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                        switch (table_info->colnum) {</span>
<span style="color: #00A000">+                        case CH_UUID:</span>
<span style="color: #00A000">+                                snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR, (u_char *) entry->uuid, strlen(entry->uuid));</span>
<span style="color: #00A000">+                                break;</span>
<span style="color: #00A000">+                        case CH_DIRECTION:</span>
<span style="color: #00A000">+                                snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR, (u_char *) entry->direction, strlen(entry->direction));</span>
<span style="color: #00A000">+                                break;</span>
<span style="color: #00A000">+                        case CH_CREATED:</span>
<span style="color: #00A000">+                                snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR, (u_char *) entry->created, strlen(entry->created));</span>
<span style="color: #00A000">+                                break;</span>
<span style="color: #00A000">+                        case CH_NAME:</span>
<span style="color: #00A000">+                                snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR, (u_char *) entry->name, strlen(entry->name));</span>
<span style="color: #00A000">+                                break;</span>
<span style="color: #00A000">+                        case CH_STATE:</span>
<span style="color: #00A000">+                                snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR, (u_char *) entry->state, strlen(entry->state));</span>
<span style="color: #00A000">+                                break;</span>
<span style="color: #00A000">+                        case CH_CID_NAME:</span>
<span style="color: #00A000">+                                snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR, (u_char *) entry->cid_name, strlen(entry->cid_name));</span>
<span style="color: #00A000">+                                break;</span>
<span style="color: #00A000">+                        case CH_CID_NUM:</span>
<span style="color: #00A000">+                                snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR, (u_char *) entry->cid_num, strlen(entry->cid_num));</span>
<span style="color: #00A000">+                                break;</span>
<span style="color: #00A000">+                        default:</span>
<span style="color: #00A000">+                                snmp_log(LOG_WARNING, "Unregistered OID-suffix requested (%d)\n", table_info->colnum);</span>
<span style="color: #00A000">+                                netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);</span>
<span style="color: #00A000">+                        }</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+                break;</span>
<span style="color: #00A000">+        default:</span>
<span style="color: #00A000">+                /* we should never get here, so this is a really bad error */</span>
<span style="color: #00A000">+                snmp_log(LOG_ERR, "Unknown mode (%d) in handle_foo\n", reqinfo->mode );</span>
<span style="color: #00A000">+                return SNMP_ERR_GENERR;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return SNMP_ERR_NOERROR;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
/* For Emacs:
* Local Variables:
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/event_handlers/mod_snmp/subagent.h b/src/mod/event_handlers/mod_snmp/subagent.h</span>
<span style="color: #000080; font-weight: bold">index 3315378..0070b2c 100644</span>
<span style="color: #A00000">--- a/src/mod/event_handlers/mod_snmp/subagent.h</span>
<span style="color: #00A000">+++ b/src/mod/event_handlers/mod_snmp/subagent.h</span>
<span style="color: #800080; font-weight: bold">@@ -14,9 +14,29 @@</span>
#define SS_SESSIONS_PER_SECOND                6
#define SS_MAX_SESSIONS_PER_SECOND        7
<span style="color: #00A000">+/* .1.3.6.1.4.1.27880.1.9 */</span>
<span style="color: #00A000">+#define CH_UUID                                1</span>
<span style="color: #00A000">+#define CH_DIRECTION                        2</span>
<span style="color: #00A000">+#define CH_CREATED                        3</span>
<span style="color: #00A000">+#define CH_NAME                                4</span>
<span style="color: #00A000">+#define CH_STATE                        5</span>
<span style="color: #00A000">+#define CH_CID_NAME                        6</span>
<span style="color: #00A000">+#define CH_CID_NUM                        7</span>
<span style="color: #A00000">-void init_subagent(void);</span>
<span style="color: #00A000">+typedef struct {</span>
<span style="color: #00A000">+        uint32_t idx;</span>
<span style="color: #00A000">+        char uuid[38];</span>
<span style="color: #00A000">+        char direction[32];</span>
<span style="color: #00A000">+        char created[128];</span>
<span style="color: #00A000">+        char name[1024];</span>
<span style="color: #00A000">+        char state[64];</span>
<span style="color: #00A000">+        char cid_name[1024];</span>
<span style="color: #00A000">+        char cid_num[256];</span>
<span style="color: #00A000">+} chan_entry_t;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+void init_subagent(switch_memory_pool_t *pool);</span>
Netsnmp_Node_Handler handle_identity;
Netsnmp_Node_Handler handle_systemStats;
<span style="color: #00A000">+Netsnmp_Node_Handler handle_channelList;</span>
#endif /* subagent_H */
</pre></div>
<div class="highlight"><pre>committer: Raymond Chandler
comments:
Merge branch 'master' of fs-git:freeswitch
</pre></div>
<div class="highlight"><pre>committer: Raymond Chandler
comments:
TEST-001
<span style="color: #000080; font-weight: bold">diff --git a/conf/freeswitch.xml b/conf/freeswitch.xml</span>
<span style="color: #000080; font-weight: bold">index 6ed99ef..5fc9402 100644</span>
<span style="color: #A00000">--- a/conf/freeswitch.xml</span>
<span style="color: #00A000">+++ b/conf/freeswitch.xml</span>
<span style="color: #800080; font-weight: bold">@@ -63,4 +63,3 @@</span>
</section>
</document>
<span style="color: #A00000">-</span>
</pre></div>
<div class="highlight"><pre>committer: Daniel Swarbrick
comments:
add support for getting current call count
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/event_handlers/mod_snmp/subagent.c b/src/mod/event_handlers/mod_snmp/subagent.c</span>
<span style="color: #000080; font-weight: bold">index 8f08baf..bad3dc6 100644</span>
<span style="color: #A00000">--- a/src/mod/event_handlers/mod_snmp/subagent.c</span>
<span style="color: #00A000">+++ b/src/mod/event_handlers/mod_snmp/subagent.c</span>
<span style="color: #800080; font-weight: bold">@@ -49,6 +49,14 @@ void init_subagent(void)</span>
}
<span style="color: #00A000">+static int sql_count_callback(void *pArg, int argc, char **argv, char **columnNames)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        uint32_t *count = (uint32_t *) pArg;</span>
<span style="color: #00A000">+        *count = atoi(argv[0]);</span>
<span style="color: #00A000">+        return 0;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
int handle_identity(netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *reqinfo, netsnmp_request_info *requests)
{
        netsnmp_request_info *request = NULL;
<span style="color: #800080; font-weight: bold">@@ -113,13 +121,20 @@ int handle_systemStats(netsnmp_mib_handler *handler, netsnmp_handler_registratio</span>
                        snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val));
                        break;
                case SS_CURRENT_CALLS:
<span style="color: #A00000">-                        /*</span>
<span style="color: #A00000">-                         * This is zero for now, since there is no convenient way to get total call</span>
<span style="color: #A00000">-                         * count (not to be confused with session count), without touching the</span>
<span style="color: #A00000">-                         * database.</span>
<span style="color: #A00000">-                         */</span>
<span style="color: #A00000">-                        int_val = 0;</span>
<span style="color: #00A000">+                        {</span>
<span style="color: #00A000">+                        switch_cache_db_handle_t *dbh;</span>
<span style="color: #00A000">+                        char sql[1024] = "", hostname[256] = "";</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                        if (switch_core_db_handle(&dbh) != SWITCH_STATUS_SUCCESS) {</span>
<span style="color: #00A000">+                                return SNMP_ERR_GENERR;</span>
<span style="color: #00A000">+                        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                        gethostname(hostname, sizeof(hostname));</span>
<span style="color: #00A000">+                        sprintf(sql, "SELECT COUNT(*) FROM calls WHERE hostname='%s'", hostname);</span>
<span style="color: #00A000">+                        switch_cache_db_execute_sql_callback(dbh, sql, sql_count_callback, &int_val, NULL);</span>
                        snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val));
<span style="color: #00A000">+                        switch_cache_db_release_db_handle(&dbh);</span>
<span style="color: #00A000">+                        }</span>
                        break;
                case SS_SESSIONS_PER_SECOND:
                        switch_core_session_ctl(SCSC_LAST_SPS, &int_val);
</pre></div>
<div class="highlight"><pre>committer: Raymond Chandler
comments:
test
<span style="color: #000080; font-weight: bold">diff --git a/conf/freeswitch.xml b/conf/freeswitch.xml</span>
<span style="color: #000080; font-weight: bold">index 80e7728..6ed99ef 100644</span>
<span style="color: #A00000">--- a/conf/freeswitch.xml</span>
<span style="color: #00A000">+++ b/conf/freeswitch.xml</span>
<span style="color: #800080; font-weight: bold">@@ -64,4 +64,3 @@</span>
</document>
<span style="color: #A00000">-</span>
</pre></div>
<div class="highlight"><pre>committer: Raymond Chandler
comments:
test
<span style="color: #000080; font-weight: bold">diff --git a/conf/freeswitch.xml b/conf/freeswitch.xml</span>
<span style="color: #000080; font-weight: bold">index 6ed99ef..80e7728 100644</span>
<span style="color: #A00000">--- a/conf/freeswitch.xml</span>
<span style="color: #00A000">+++ b/conf/freeswitch.xml</span>
<span style="color: #800080; font-weight: bold">@@ -64,3 +64,4 @@</span>
</document>
<span style="color: #00A000">+</span>
</pre></div>
<div class="highlight"><pre>committer: Raymond Chandler
comments:
test
<span style="color: #000080; font-weight: bold">diff --git a/conf/freeswitch.xml b/conf/freeswitch.xml</span>
<span style="color: #000080; font-weight: bold">index 5fc9402..6ed99ef 100644</span>
<span style="color: #A00000">--- a/conf/freeswitch.xml</span>
<span style="color: #00A000">+++ b/conf/freeswitch.xml</span>
<span style="color: #800080; font-weight: bold">@@ -63,3 +63,4 @@</span>
</section>
</document>
<span style="color: #00A000">+</span>
</pre></div>
<div class="highlight"><pre>committer: Raymond Chandler
comments:
test
<span style="color: #000080; font-weight: bold">diff --git a/conf/freeswitch.xml b/conf/freeswitch.xml</span>
<span style="color: #000080; font-weight: bold">index 6ed99ef..5fc9402 100644</span>
<span style="color: #A00000">--- a/conf/freeswitch.xml</span>
<span style="color: #00A000">+++ b/conf/freeswitch.xml</span>
<span style="color: #800080; font-weight: bold">@@ -63,4 +63,3 @@</span>
</section>
</document>
<span style="color: #A00000">-</span>
</pre></div>
<div class="highlight"><pre>committer: Raymond Chandler
comments:
test
<span style="color: #000080; font-weight: bold">diff --git a/conf/freeswitch.xml b/conf/freeswitch.xml</span>
<span style="color: #000080; font-weight: bold">index 80e7728..6ed99ef 100644</span>
<span style="color: #A00000">--- a/conf/freeswitch.xml</span>
<span style="color: #00A000">+++ b/conf/freeswitch.xml</span>
<span style="color: #800080; font-weight: bold">@@ -64,4 +64,3 @@</span>
</document>
<span style="color: #A00000">-</span>
</pre></div>
<div class="highlight"><pre>committer: Daniel Swarbrick
comments:
typo
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/event_handlers/mod_snmp/subagent.c b/src/mod/event_handlers/mod_snmp/subagent.c</span>
<span style="color: #000080; font-weight: bold">index 2da9ebe..8f08baf 100644</span>
<span style="color: #A00000">--- a/src/mod/event_handlers/mod_snmp/subagent.c</span>
<span style="color: #00A000">+++ b/src/mod/event_handlers/mod_snmp/subagent.c</span>
<span style="color: #800080; font-weight: bold">@@ -109,7 +109,7 @@ int handle_systemStats(netsnmp_mib_handler *handler, netsnmp_handler_registratio</span>
                        snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val));
                        break;
                case SS_MAX_SESSIONS:
<span style="color: #A00000">-                        switch_core_session_ctl(SCSC_MAX_SESSIONS, &int_val);;</span>
<span style="color: #00A000">+                        switch_core_session_ctl(SCSC_MAX_SESSIONS, &int_val);</span>
                        snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val));
                        break;
                case SS_CURRENT_CALLS:
</pre></div>
<div class="highlight"><pre>committer: David Yat Sin
comments:
Merge branch 'master' of git://git.freeswitch.org/freeswitch
</pre></div>
<div class="highlight"><pre>committer: Leon de Rooij
comments:
Merge branch 'master' of ssh://git.freeswitch.org/freeswitch
</pre></div>
<div class="highlight"><pre>committer: Leon de Rooij
comments:
enter
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/languages/mod_lua/mod_lua_extra.c b/src/mod/languages/mod_lua/mod_lua_extra.c</span>
<span style="color: #000080; font-weight: bold">index 38776f9..821cc60 100644</span>
<span style="color: #A00000">--- a/src/mod/languages/mod_lua/mod_lua_extra.c</span>
<span style="color: #00A000">+++ b/src/mod/languages/mod_lua/mod_lua_extra.c</span>
<span style="color: #800080; font-weight: bold">@@ -1,6 +1,8 @@</span>
using namespace LUA;
<span style="color: #A00000">-SWITCH_BEGIN_EXTERN_C void mod_lua_conjure_event(lua_State * L, switch_event_t *event, const char *name, int destroy_me)</span>
<span style="color: #00A000">+SWITCH_BEGIN_EXTERN_C</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+void mod_lua_conjure_event(lua_State * L, switch_event_t *event, const char *name, int destroy_me)</span>
{
        Event *result = new Event(event);
        SWIG_NewPointerObj(L, result, SWIGTYPE_p_Event, destroy_me);
</pre></div>
<div class="highlight"><pre>committer: Leon de Rooij
comments:
enter
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/languages/mod_lua/mod_lua_extra.h b/src/mod/languages/mod_lua/mod_lua_extra.h</span>
<span style="color: #000080; font-weight: bold">index b96adc3..3fca994 100644</span>
<span style="color: #A00000">--- a/src/mod/languages/mod_lua/mod_lua_extra.h</span>
<span style="color: #00A000">+++ b/src/mod/languages/mod_lua/mod_lua_extra.h</span>
<span style="color: #800080; font-weight: bold">@@ -1,6 +1,8 @@</span>
#ifndef MOD_LUA_EXTRA
#define MOD_LUA_EXTRA
<span style="color: #A00000">-SWITCH_BEGIN_EXTERN_C void mod_lua_conjure_event(lua_State * L, switch_event_t *event, const char *name, int destroy_me);</span>
<span style="color: #00A000">+SWITCH_BEGIN_EXTERN_C</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+void mod_lua_conjure_event(lua_State * L, switch_event_t *event, const char *name, int destroy_me);</span>
void mod_lua_conjure_stream(lua_State * L, switch_stream_handle_t *stream, const char *name, int destroy_me);
void mod_lua_conjure_session(lua_State * L, switch_core_session_t *session, const char *name, int destroy_me);
</pre></div>
<div class="highlight"><pre>committer: Luke Dashjr
comments:
MERGE: OpenMethods DTMF recognition via ASR modules
</pre></div>
<div class="highlight"><pre>committer: Luke Dashjr
comments:
MERGE: OpenMethods ASR enhancements: multiple concurrent grammars and dialplan access to start-input-timers
<span style="color: #000080; font-weight: bold">diff --cc src/mod/applications/mod_dptools/mod_dptools.c</span>
<span style="color: #000080; font-weight: bold">index 5a3be03,fe089a6..928a9b8</span>
<span style="color: #A00000">--- a/src/mod/applications/mod_dptools/mod_dptools.c</span>
<span style="color: #00A000">+++ b/src/mod/applications/mod_dptools/mod_dptools.c</span>
<span style="color: #800080; font-weight: bold">@@@ -95,181 -96,7 +96,181 @@@ SWITCH_STANDARD_DIALPLAN(inline_dialpla</span>
        return extension;
}
+struct action_binding {
+        char *realm;
+        char *input;
+        char *string;
+        char *value;
+        switch_core_session_t *session;
+};
+
+static switch_status_t digit_nomatch_action_callback(switch_ivr_dmachine_match_t *match)
+{
+        switch_core_session_t *session = (switch_core_session_t *) match->user_data;
+        switch_channel_t *channel = switch_core_session_get_channel(session);
+        char str[DMACHINE_MAX_DIGIT_LEN + 2];
+        switch_event_t *event;
+        switch_status_t status;
+
+        switch_channel_set_variable(channel, "last_non_matching_digits", match->match_digits);
+
+        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Digit NOT match binding [%s]\n",
+                                         switch_channel_get_name(channel), match->match_digits);
+
+        if (switch_event_create_plain(&event, SWITCH_EVENT_CHANNEL_DATA) == SWITCH_STATUS_SUCCESS) {
+                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "digits", match->match_digits);
+
+                if ((status = switch_core_session_queue_event(session, &event)) != SWITCH_STATUS_SUCCESS) {
+                        switch_event_destroy(&event);
+                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s event queue faiure.\n",
+                                                         switch_core_session_get_name(session));
+                }
+        }
+
+        /* send it back around flagged to skip the dmachine */
+        switch_snprintf(str, sizeof(str), "!%s", match->match_digits);
+        
+        switch_channel_queue_dtmf_string(channel, str);
+        
+        return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t digit_action_callback(switch_ivr_dmachine_match_t *match)
+{
+        struct action_binding *act = (struct action_binding *) match->user_data;
+        switch_event_t *event;
+        switch_status_t status;
+        int exec = 0;
+        char *string = act->string;
+        switch_channel_t *channel = switch_core_session_get_channel(act->session);
+
+        switch_channel_set_variable(channel, "last_matching_digits", match->match_digits);
+        
+        if (switch_event_create_plain(&event, SWITCH_EVENT_CHANNEL_DATA) == SWITCH_STATUS_SUCCESS) {
+                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(act->session), SWITCH_LOG_DEBUG, "%s Digit match binding [%s][%s]\n",
+                                                 switch_channel_get_name(channel), act->string, act->value);
+
+                if (!strncasecmp(string, "exec:", 5)) {
+                        string += 5;
+                        exec = 1;
+                }
+
+                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, string, act->value);
+                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "digits", match->match_digits);
+
+                if (exec) {
+                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "execute", exec == 2 ? "non-blocking" : "blocking");
+                }
+
+                if ((status = switch_core_session_queue_event(act->session, &event)) != SWITCH_STATUS_SUCCESS) {
+                        switch_event_destroy(&event);
+                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(act->session), SWITCH_LOG_WARNING, "%s event queue faiure.\n",
+                                                         switch_core_session_get_name(act->session));
+                }
+        }
+
+        if (exec) {
+                char *cmd = switch_core_session_sprintf(act->session, "%s::%s", string, act->value);
+                switch_ivr_broadcast_in_thread(act->session, cmd, SMF_ECHO_ALEG|SMF_HOLD_BLEG);
+        }
+        
+        return SWITCH_STATUS_SUCCESS;
+}
+
+#define CLEAR_DIGIT_ACTION_USAGE "<realm>|all"
+SWITCH_STANDARD_APP(clear_digit_action_function)
+{
+        //switch_channel_t *channel = switch_core_session_get_channel(session);
+        switch_ivr_dmachine_t *dmachine;
+        char *realm = (char *) data;
+
+        if ((dmachine = switch_core_session_get_dmachine(session))) {
+                if (zstr(realm) || !strcasecmp(realm, "all")) {
+                        switch_core_session_set_dmachine(session, NULL);
+                        switch_ivr_dmachine_destroy(&dmachine);
+                } else {
+                        switch_ivr_dmachine_clear_realm(dmachine, realm);
+                }
+        }
+}
+
+#define DIGIT_ACTION_SET_REALM_USAGE "<realm>"
+SWITCH_STANDARD_APP(digit_action_set_realm_function)
+{
+        switch_ivr_dmachine_t *dmachine;
+        char *realm = (char *) data;
+
+        if (zstr(data)) {
+                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Syntax Error, USAGE %s\n", DIGIT_ACTION_SET_REALM_USAGE);
+                return;
+        }
+        
+        if ((dmachine = switch_core_session_get_dmachine(session))) {
+                switch_ivr_dmachine_set_realm(dmachine, realm);
+        }
+
+}
+
+#define BIND_DIGIT_ACTION_USAGE "<realm>,<digits|~regex>,<string>,<value>"
+SWITCH_STANDARD_APP(bind_digit_action_function)
+{
+        switch_channel_t *channel = switch_core_session_get_channel(session);
+        switch_ivr_dmachine_t *dmachine;
+        char *mydata;
+        int argc = 0;
+        char *argv[4] = { 0 };
+        struct action_binding *act;
+
+        if (zstr(data)) {
+                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Syntax Error, USAGE %s\n", BIND_DIGIT_ACTION_USAGE);
+                return;
+        }
+
+        mydata = switch_core_session_strdup(session, data);
+
+        argc = switch_separate_string(mydata, ',', argv, (sizeof(argv) / sizeof(argv[0])));
+        
+        if (argc < 4 || zstr(argv[0]) || zstr(argv[1]) || zstr(argv[2]) || zstr(argv[3])) {
+                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Syntax Error, USAGE %s\n", BIND_DIGIT_ACTION_USAGE);
+                return;
+        }
+
+        
+        if (!(dmachine = switch_core_session_get_dmachine(session))) {
+                uint32_t digit_timeout = 1500;
+                uint32_t input_timeout = 0;
+                const char *var;
+                uint32_t tmp;
+
+                if ((var = switch_channel_get_variable(channel, "bind_digit_digit_timeout"))) {
+                        tmp = (uint32_t) atol(var);
+                        if (tmp < 0) tmp = 0;
+                        digit_timeout = tmp;
+                }
+                
+                if ((var = switch_channel_get_variable(channel, "bind_digit_input_timeout"))) {
+                        tmp = (uint32_t) atol(var);
+                        if (tmp < 0) tmp = 0;
+                        input_timeout = tmp;
+                }
+                
+                switch_ivr_dmachine_create(&dmachine, "DPTOOLS", NULL, digit_timeout, input_timeout, NULL, digit_nomatch_action_callback, session);
+                switch_core_session_set_dmachine(session, dmachine);
+        }
+
+        
+        act = switch_core_session_alloc(session, sizeof(*act));
+        act->realm = argv[0];
+        act->input = argv[1];
+        act->string = argv[2];
+        act->value = argv[3];
+        act->session = session;
+        
+        switch_ivr_dmachine_bind(dmachine, act->realm, act->input, 0, digit_action_callback, act);
+}
+
+
<span style="color: #A00000">- #define DETECT_SPEECH_SYNTAX "<mod_name> <gram_name> <gram_path> [<addr>] OR grammar <gram_name> [<path>] OR nogrammar <gram_name> OR pause OR resume OR stop OR param <name> <value>"</span>
<span style="color: #00A000">+ #define DETECT_SPEECH_SYNTAX "<mod_name> <gram_name> <gram_path> [<addr>] OR grammar <gram_name> [<path>] OR nogrammar <gram_name> OR grammaron/grammaroff <gram_name> OR grammarsalloff OR pause OR resume OR start_input_timers OR stop OR param <name> <value>"</span>
SWITCH_STANDARD_APP(detect_speech_function)
{
        char *argv[4];
</pre></div>
<div class="highlight"><pre>committer: Luke Dashjr
comments:
MERGE: DTMF recognition via ASR modules (implemented in UniMRCP)
<span style="color: #000080; font-weight: bold">diff --git a/src/include/switch_core.h b/src/include/switch_core.h</span>
<span style="color: #000080; font-weight: bold">index 26a048c..a3d74e9 100644</span>
<span style="color: #A00000">--- a/src/include/switch_core.h</span>
<span style="color: #00A000">+++ b/src/include/switch_core.h</span>
<span style="color: #800080; font-weight: bold">@@ -1715,6 +1715,15 @@ SWITCH_DECLARE(switch_status_t) switch_core_asr_close(switch_asr_handle_t *ah, s</span>
SWITCH_DECLARE(switch_status_t) switch_core_asr_feed(switch_asr_handle_t *ah, void *data, unsigned int len, switch_asr_flag_t *flags);
/*!
<span style="color: #00A000">+ \brief Feed DTMF to an asr handle</span>
<span style="color: #00A000">+ \param ah the handle to feed data to</span>
<span style="color: #00A000">+ \param dtmf a string of DTMF digits</span>
<span style="color: #00A000">+ \param flags flags to influence behaviour</span>
<span style="color: #00A000">+ \return SWITCH_STATUS_SUCCESS</span>
<span style="color: #00A000">+*/</span>
<span style="color: #00A000">+SWITCH_DECLARE(switch_status_t) switch_core_asr_feed_dtmf(switch_asr_handle_t *ah, const switch_dtmf_t *dtmf, switch_asr_flag_t *flags);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/*!</span>
\brief Check an asr handle for results
\param ah the handle to check
\param flags flags to influence behaviour
<span style="color: #000080; font-weight: bold">diff --git a/src/include/switch_module_interfaces.h b/src/include/switch_module_interfaces.h</span>
<span style="color: #000080; font-weight: bold">index e0119b4..8303af7 100644</span>
<span style="color: #A00000">--- a/src/include/switch_module_interfaces.h</span>
<span style="color: #00A000">+++ b/src/include/switch_module_interfaces.h</span>
<span style="color: #800080; font-weight: bold">@@ -400,6 +400,8 @@ struct switch_asr_interface {</span>
        switch_status_t (*asr_disable_grammar) (switch_asr_handle_t *ah, const char *name);
        /*! function to disable all grammars to the asr interface */
        switch_status_t (*asr_disable_all_grammars) (switch_asr_handle_t *ah);
<span style="color: #00A000">+        /*! function to feed DTMF to the ASR */</span>
<span style="color: #00A000">+        switch_status_t (*asr_feed_dtmf) (switch_asr_handle_t *ah, const switch_dtmf_t *dtmf, switch_asr_flag_t *flags);</span>
};
/*! an abstract representation of an asr speech interface. */
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c b/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c</span>
<span style="color: #000080; font-weight: bold">index b9cecd1..b3679cf 100644</span>
<span style="color: #A00000">--- a/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c</span>
<span style="color: #00A000">+++ b/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c</span>
<span style="color: #800080; font-weight: bold">@@ -49,6 +49,7 @@</span>
#include "mrcp_resource_loader.h"
#include "mpf_engine.h"
#include "mpf_codec_manager.h"
<span style="color: #00A000">+#include "mpf_dtmf_generator.h"</span>
#include "mpf_rtp_termination_factory.h"
#include "mrcp_sofiasip_client_agent.h"
#include "mrcp_unirtsp_client_agent.h"
<span style="color: #800080; font-weight: bold">@@ -442,6 +443,12 @@ struct recognizer_data {</span>
        int start_of_input;
        /** true, if input timers have started */
        int timers_started;
<span style="color: #00A000">+        /** UniMRCP mpf stream */</span>
<span style="color: #00A000">+        mpf_audio_stream_t *unimrcp_stream;</span>
<span style="color: #00A000">+        /** DTMF generator */</span>
<span style="color: #00A000">+        mpf_dtmf_generator_t *dtmf_generator;</span>
<span style="color: #00A000">+        /** true, if presently transmitting DTMF */</span>
<span style="color: #00A000">+        char dtmf_generator_active;</span>
};
typedef struct recognizer_data recognizer_data_t;
<span style="color: #800080; font-weight: bold">@@ -457,6 +464,7 @@ static switch_status_t recog_asr_disable_grammar(switch_asr_handle_t *ah, const</span>
static switch_status_t recog_asr_disable_all_grammars(switch_asr_handle_t *ah);
static switch_status_t recog_asr_close(switch_asr_handle_t *ah, switch_asr_flag_t *flags);
static switch_status_t recog_asr_feed(switch_asr_handle_t *ah, void *data, unsigned int len, switch_asr_flag_t *flags);
<span style="color: #00A000">+static switch_status_t recog_asr_feed_dtmf(switch_asr_handle_t *ah, const switch_dtmf_t *dtmf, switch_asr_flag_t *flags);</span>
#if 0
static switch_status_t recog_asr_start(switch_asr_handle_t *ah, const char *name);
#endif
<span style="color: #800080; font-weight: bold">@@ -472,6 +480,7 @@ static void recog_asr_float_param(switch_asr_handle_t *ah, char *param, double v</span>
/* recognizer's interface for UniMRCP */
static apt_bool_t recog_message_handler(const mrcp_app_message_t *app_message);
static apt_bool_t recog_on_message_receive(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message);
<span style="color: #00A000">+static apt_bool_t recog_stream_open(mpf_audio_stream_t *stream, mpf_codec_t *codec);</span>
static apt_bool_t recog_stream_read(mpf_audio_stream_t *stream, mpf_frame_t *frame);
/* recognizer specific speech_channel_funcs */
<span style="color: #800080; font-weight: bold">@@ -3114,6 +3123,9 @@ static switch_status_t recog_asr_close(switch_asr_handle_t *ah, switch_asr_flag_</span>
        speech_channel_destroy(schannel);
        switch_core_hash_destroy(&r->grammars);
        switch_core_hash_destroy(&r->enabled_grammars);
<span style="color: #00A000">+        if (r->dtmf_generator) {</span>
<span style="color: #00A000">+                mpf_dtmf_generator_destroy(r->dtmf_generator);</span>
<span style="color: #00A000">+        }</span>
        /* this lets FreeSWITCH's speech_thread know the handle is closed */
        switch_set_flag(ah, SWITCH_ASR_FLAG_CLOSED);
<span style="color: #800080; font-weight: bold">@@ -3134,6 +3146,39 @@ static switch_status_t recog_asr_feed(switch_asr_handle_t *ah, void *data, unsig</span>
        return speech_channel_write(schannel, data, &slen);
}
<span style="color: #00A000">+/**</span>
<span style="color: #00A000">+ * Process asr_feed_dtmf request from FreeSWITCH</span>
<span style="color: #00A000">+ *</span>
<span style="color: #00A000">+ * @param ah the FreeSWITCH speech recognition handle</span>
<span style="color: #00A000">+ * @return SWITCH_STATUS_SUCCESS if successful </span>
<span style="color: #00A000">+ */</span>
<span style="color: #00A000">+static switch_status_t recog_asr_feed_dtmf(switch_asr_handle_t *ah, const switch_dtmf_t *dtmf, switch_asr_flag_t *flags)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        speech_channel_t *schannel = (speech_channel_t *) ah->private_info;</span>
<span style="color: #00A000">+        recognizer_data_t *r = (recognizer_data_t *) schannel->data;</span>
<span style="color: #00A000">+        char digits[2];</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if (!r->dtmf_generator) {</span>
<span style="color: #00A000">+                if (!r->unimrcp_stream) {</span>
<span style="color: #00A000">+                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "(%s) Cannot queue DTMF: No UniMRCP stream object open\n", schannel->name);</span>
<span style="color: #00A000">+                        return SWITCH_STATUS_FALSE;</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+                r->dtmf_generator = mpf_dtmf_generator_create(r->unimrcp_stream, schannel->unimrcp_session->pool);</span>
<span style="color: #00A000">+                if (!r->dtmf_generator) {</span>
<span style="color: #00A000">+                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "(%s) Cannot queue DTMF: Failed to create DTMF generator\n", schannel->name);</span>
<span style="color: #00A000">+                        return SWITCH_STATUS_FALSE;</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        digits[0] = dtmf->digit;</span>
<span style="color: #00A000">+        digits[1] = '\0';</span>
<span style="color: #00A000">+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) Queued DTMF: %s\n", schannel->name, digits);</span>
<span style="color: #00A000">+        mpf_dtmf_generator_enqueue(r->dtmf_generator, digits);</span>
<span style="color: #00A000">+        r->dtmf_generator_active = 1;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return SWITCH_STATUS_SUCCESS;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
#if 0
/**
* Process asr_start request from FreeSWITCH
<span style="color: #800080; font-weight: bold">@@ -3380,6 +3425,23 @@ static apt_bool_t recog_on_message_receive(mrcp_application_t *application, mrcp</span>
}
/**
<span style="color: #00A000">+ * UniMRCP callback requesting open for speech recognition</span>
<span style="color: #00A000">+ *</span>
<span style="color: #00A000">+ * @param stream the UniMRCP stream</span>
<span style="color: #00A000">+ * @param codec the codec</span>
<span style="color: #00A000">+ * @return TRUE</span>
<span style="color: #00A000">+ */</span>
<span style="color: #00A000">+static apt_bool_t recog_stream_open(mpf_audio_stream_t *stream, mpf_codec_t *codec)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        speech_channel_t *schannel = (speech_channel_t *) stream->obj;</span>
<span style="color: #00A000">+        recognizer_data_t *r = (recognizer_data_t *) schannel->data;</span>
<span style="color: #00A000">+        </span>
<span style="color: #00A000">+        r->unimrcp_stream = stream;</span>
<span style="color: #00A000">+        </span>
<span style="color: #00A000">+        return TRUE;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/**</span>
* UniMRCP callback requesting next frame for speech recognition
*
* @param stream the UniMRCP stream
<span style="color: #800080; font-weight: bold">@@ -3389,6 +3451,7 @@ static apt_bool_t recog_on_message_receive(mrcp_application_t *application, mrcp</span>
static apt_bool_t recog_stream_read(mpf_audio_stream_t *stream, mpf_frame_t *frame)
{
        speech_channel_t *schannel = (speech_channel_t *) stream->obj;
<span style="color: #00A000">+        recognizer_data_t *r = (recognizer_data_t *) schannel->data;</span>
        switch_size_t to_read = frame->codec_frame.size;
        /* grab the data. pad it if there isn't enough */
<span style="color: #800080; font-weight: bold">@@ -3398,6 +3461,13 @@ static apt_bool_t recog_stream_read(mpf_audio_stream_t *stream, mpf_frame_t *fra</span>
                }
                frame->type |= MEDIA_FRAME_TYPE_AUDIO;
        }
<span style="color: #00A000">+        </span>
<span style="color: #00A000">+        if (r->dtmf_generator_active) {</span>
<span style="color: #00A000">+                if (!mpf_dtmf_generator_put_frame(r->dtmf_generator, frame)) {</span>
<span style="color: #00A000">+                        if (!mpf_dtmf_generator_sending(r->dtmf_generator))</span>
<span style="color: #00A000">+                                r->dtmf_generator_active = 0;</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+        }</span>
        return TRUE;
}
<span style="color: #800080; font-weight: bold">@@ -3421,6 +3491,7 @@ static switch_status_t recog_load(switch_loadable_module_interface_t *module_int</span>
        asr_interface->asr_disable_all_grammars = recog_asr_disable_all_grammars;
        asr_interface->asr_close = recog_asr_close;
        asr_interface->asr_feed = recog_asr_feed;
<span style="color: #00A000">+        asr_interface->asr_feed_dtmf = recog_asr_feed_dtmf;</span>
#if 0
        asr_interface->asr_start = recog_asr_start;
#endif
<span style="color: #800080; font-weight: bold">@@ -3443,7 +3514,7 @@ static switch_status_t recog_load(switch_loadable_module_interface_t *module_int</span>
        globals.recog.dispatcher.on_channel_remove = speech_on_channel_remove;
        globals.recog.dispatcher.on_message_receive = recog_on_message_receive;
        globals.recog.audio_stream_vtable.destroy = NULL;
<span style="color: #A00000">-        globals.recog.audio_stream_vtable.open_rx = NULL;</span>
<span style="color: #00A000">+        globals.recog.audio_stream_vtable.open_rx = recog_stream_open;</span>
        globals.recog.audio_stream_vtable.close_rx = NULL;
        globals.recog.audio_stream_vtable.read_frame = recog_stream_read;
        globals.recog.audio_stream_vtable.open_tx = NULL;
<span style="color: #000080; font-weight: bold">diff --git a/src/switch_core_asr.c b/src/switch_core_asr.c</span>
<span style="color: #000080; font-weight: bold">index 691011a..7f231ef 100644</span>
<span style="color: #A00000">--- a/src/switch_core_asr.c</span>
<span style="color: #00A000">+++ b/src/switch_core_asr.c</span>
<span style="color: #800080; font-weight: bold">@@ -239,6 +239,19 @@ SWITCH_DECLARE(switch_status_t) switch_core_asr_feed(switch_asr_handle_t *ah, vo</span>
        return ah->asr_interface->asr_feed(ah, data, len, flags);
}
<span style="color: #00A000">+SWITCH_DECLARE(switch_status_t) switch_core_asr_feed_dtmf(switch_asr_handle_t *ah, const switch_dtmf_t *dtmf, switch_asr_flag_t *flags)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        switch_status_t status = SWITCH_STATUS_SUCCESS;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        switch_assert(ah != NULL);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if (ah->asr_interface->asr_feed_dtmf) {</span>
<span style="color: #00A000">+                status = ah->asr_interface->asr_feed_dtmf(ah, dtmf, flags);</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return status;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
SWITCH_DECLARE(switch_status_t) switch_core_asr_check_results(switch_asr_handle_t *ah, switch_asr_flag_t *flags)
{
        switch_assert(ah != NULL);
<span style="color: #000080; font-weight: bold">diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c</span>
<span style="color: #000080; font-weight: bold">index 66cd369..5df7af3 100644</span>
<span style="color: #A00000">--- a/src/switch_ivr_async.c</span>
<span style="color: #00A000">+++ b/src/switch_ivr_async.c</span>
<span style="color: #800080; font-weight: bold">@@ -2660,6 +2660,20 @@ static switch_bool_t speech_callback(switch_media_bug_t *bug, void *user_data, s</span>
        return SWITCH_TRUE;
}
<span style="color: #00A000">+static switch_status_t speech_on_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf, switch_dtmf_direction_t direction)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        switch_channel_t *channel = switch_core_session_get_channel(session);</span>
<span style="color: #00A000">+        struct speech_thread_handle *sth = switch_channel_get_private(channel, SWITCH_SPEECH_KEY);</span>
<span style="color: #00A000">+        switch_status_t status = SWITCH_STATUS_SUCCESS;</span>
<span style="color: #00A000">+        switch_asr_flag_t flags = SWITCH_ASR_FLAG_NONE;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if (switch_core_asr_feed_dtmf(sth->ah, dtmf, &flags) != SWITCH_STATUS_SUCCESS) {</span>
<span style="color: #00A000">+                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error Feeding DTMF\n");</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return status;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
SWITCH_DECLARE(switch_status_t) switch_ivr_stop_detect_speech(switch_core_session_t *session)
{
        switch_channel_t *channel = switch_core_session_get_channel(session);
<span style="color: #800080; font-weight: bold">@@ -2875,6 +2889,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech(switch_core_session_t *</span>
                return status;
        }
<span style="color: #00A000">+        if ((status = switch_core_event_hook_add_recv_dtmf(session, speech_on_dtmf)) != SWITCH_STATUS_SUCCESS) {</span>
<span style="color: #00A000">+                switch_ivr_stop_detect_speech(session);</span>
<span style="color: #00A000">+                return status;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
        switch_channel_set_private(channel, SWITCH_SPEECH_KEY, sth);
        return SWITCH_STATUS_SUCCESS;
</pre></div>
<div class="highlight"><pre>committer: Luke Dashjr
comments:
MERGE: expose ASR start_input_timers to dialplan via IVR and mod_dptools
<span style="color: #000080; font-weight: bold">diff --cc src/mod/applications/mod_dptools/mod_dptools.c</span>
<span style="color: #000080; font-weight: bold">index f573661,2f49630..fe089a6</span>
<span style="color: #A00000">--- a/src/mod/applications/mod_dptools/mod_dptools.c</span>
<span style="color: #00A000">+++ b/src/mod/applications/mod_dptools/mod_dptools.c</span>
<span style="color: #800080; font-weight: bold">@@@ -96,7 -96,7 +96,7 @@@ SWITCH_STANDARD_DIALPLAN(inline_dialpla</span>
        return extension;
}
<span style="color: #A00000">- #define DETECT_SPEECH_SYNTAX "<mod_name> <gram_name> <gram_path> [<addr>] OR grammar <gram_name> [<path>] OR nogrammar <gram_name> OR grammaron/grammaroff <gram_name> OR grammarsalloff OR pause OR resume OR stop OR param <name> <value>"</span>
-#define DETECT_SPEECH_SYNTAX "<mod_name> <gram_name> <gram_path> [<addr>] OR grammar <gram_name> [<path>] OR pause OR resume OR start_input_timers"
<span style="color: #00A000">++#define DETECT_SPEECH_SYNTAX "<mod_name> <gram_name> <gram_path> [<addr>] OR grammar <gram_name> [<path>] OR nogrammar <gram_name> OR grammaron/grammaroff <gram_name> OR grammarsalloff OR pause OR resume OR start_input_timers OR stop OR param <name> <value>"</span>
SWITCH_STANDARD_APP(detect_speech_function)
{
        char *argv[4];
</pre></div>
<div class="highlight"><pre>committer: Luke Dashjr
comments:
MERGE: document all of detect_speech's valid syntax
<span style="color: #000080; font-weight: bold">diff --cc src/mod/applications/mod_dptools/mod_dptools.c</span>
<span style="color: #000080; font-weight: bold">index e942bc6,6d014fa..f573661</span>
<span style="color: #A00000">--- a/src/mod/applications/mod_dptools/mod_dptools.c</span>
<span style="color: #00A000">+++ b/src/mod/applications/mod_dptools/mod_dptools.c</span>
<span style="color: #800080; font-weight: bold">@@@ -96,7 -96,7 +96,7 @@@ SWITCH_STANDARD_DIALPLAN(inline_dialpla</span>
        return extension;
}
<span style="color: #A00000">- #define DETECT_SPEECH_SYNTAX "<mod_name> <gram_name> <gram_path> [<addr>] OR grammar <gram_name> [<path>] OR pause OR resume OR grammaron/grammaroff <gram_name> OR grammarsalloff"</span>
-#define DETECT_SPEECH_SYNTAX "<mod_name> <gram_name> <gram_path> [<addr>] OR grammar <gram_name> [<path>] OR nogrammar <gram_name> OR pause OR resume OR stop OR param <name> <value>"
<span style="color: #00A000">++#define DETECT_SPEECH_SYNTAX "<mod_name> <gram_name> <gram_path> [<addr>] OR grammar <gram_name> [<path>] OR nogrammar <gram_name> OR grammaron/grammaroff <gram_name> OR grammarsalloff OR pause OR resume OR stop OR param <name> <value>"</span>
SWITCH_STANDARD_APP(detect_speech_function)
{
        char *argv[4];
</pre></div>
<div class="highlight"><pre>committer: Luke Dashjr
comments:
expose ASR enable/disable grammar (and disable all grammars) to dialplan via mod_dptools
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c</span>
<span style="color: #000080; font-weight: bold">index 5a1b8c5..e942bc6 100755</span>
<span style="color: #A00000">--- a/src/mod/applications/mod_dptools/mod_dptools.c</span>
<span style="color: #00A000">+++ b/src/mod/applications/mod_dptools/mod_dptools.c</span>
<span style="color: #800080; font-weight: bold">@@ -28,6 +28,7 @@</span>
* Michael Murdock <mike at mmurdock dot org>
* Neal Horman <neal at wanlink dot com>
* Bret McDanel <trixter AT 0xdecafbad dot com>
<span style="color: #00A000">+ * Luke Dashjr <luke@openmethods.com> (OpenMethods, LLC)</span>
*
* mod_dptools.c -- Raw Audio File Streaming Application Module
*
<span style="color: #800080; font-weight: bold">@@ -95,7 +96,7 @@ SWITCH_STANDARD_DIALPLAN(inline_dialplan_hunt)</span>
        return extension;
}
<span style="color: #A00000">-#define DETECT_SPEECH_SYNTAX "<mod_name> <gram_name> <gram_path> [<addr>] OR grammar <gram_name> [<path>] OR pause OR resume"</span>
<span style="color: #00A000">+#define DETECT_SPEECH_SYNTAX "<mod_name> <gram_name> <gram_path> [<addr>] OR grammar <gram_name> [<path>] OR pause OR resume OR grammaron/grammaroff <gram_name> OR grammarsalloff"</span>
SWITCH_STANDARD_APP(detect_speech_function)
{
        char *argv[4];
<span style="color: #800080; font-weight: bold">@@ -108,6 +109,12 @@ SWITCH_STANDARD_APP(detect_speech_function)</span>
                        switch_ivr_detect_speech_load_grammar(session, argv[1], argv[2]);
                } else if (!strcasecmp(argv[0], "nogrammar")) {
                        switch_ivr_detect_speech_unload_grammar(session, argv[1]);
<span style="color: #00A000">+                } else if (!strcasecmp(argv[0], "grammaron")) {</span>
<span style="color: #00A000">+                        switch_ivr_detect_speech_enable_grammar(session, argv[1]);</span>
<span style="color: #00A000">+                } else if (!strcasecmp(argv[0], "grammaroff")) {</span>
<span style="color: #00A000">+                        switch_ivr_detect_speech_disable_grammar(session, argv[1]);</span>
<span style="color: #00A000">+                } else if (!strcasecmp(argv[0], "grammarsalloff")) {</span>
<span style="color: #00A000">+                        switch_ivr_detect_speech_disable_all_grammars(session);</span>
                } else if (!strcasecmp(argv[0], "pause")) {
                        switch_ivr_pause_detect_speech(session);
                } else if (!strcasecmp(argv[0], "resume")) {
</pre></div>
<div class="highlight"><pre>committer: Luke Dashjr
comments:
switch_ivr interfaces to enable/disable grammar: switch_ivr_detect_speech_enable_grammar, switch_ivr_detect_speech_disable_grammar, and switch_ivr_detect_speech_disable_all_grammars
<span style="color: #000080; font-weight: bold">diff --git a/src/include/switch_ivr.h b/src/include/switch_ivr.h</span>
<span style="color: #000080; font-weight: bold">index 40ba1dc..8641766 100644</span>
<span style="color: #A00000">--- a/src/include/switch_ivr.h</span>
<span style="color: #00A000">+++ b/src/include/switch_ivr.h</span>
<span style="color: #800080; font-weight: bold">@@ -26,6 +26,7 @@</span>
* Anthony Minessale II <anthm@freeswitch.org>
* Neal Horman <neal at wanlink dot com>
* Bret McDanel <trixter AT 0xdecafbad dot com>
<span style="color: #00A000">+ * Luke Dashjr <luke@openmethods.com> (OpenMethods, LLC)</span>
*
* switch_ivr.h -- IVR Library
*
<span style="color: #800080; font-weight: bold">@@ -198,6 +199,29 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_load_grammar(switch_cor</span>
*/
SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_unload_grammar(switch_core_session_t *session, const char *name);
<span style="color: #00A000">+/*!</span>
<span style="color: #00A000">+ \brief Enable a grammar on a background speech detection handle</span>
<span style="color: #00A000">+ \param session The session to change the grammar on</span>
<span style="color: #00A000">+ \param name the grammar name</span>
<span style="color: #00A000">+ \return SWITCH_STATUS_SUCCESS if all is well</span>
<span style="color: #00A000">+*/</span>
<span style="color: #00A000">+SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_enable_grammar(switch_core_session_t *session, const char *name);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/*!</span>
<span style="color: #00A000">+ \brief Disable a grammar on a background speech detection handle</span>
<span style="color: #00A000">+ \param session The session to change the grammar on</span>
<span style="color: #00A000">+ \param name the grammar name</span>
<span style="color: #00A000">+ \return SWITCH_STATUS_SUCCESS if all is well</span>
<span style="color: #00A000">+*/</span>
<span style="color: #00A000">+SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_disable_grammar(switch_core_session_t *session, const char *name);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/*!</span>
<span style="color: #00A000">+ \brief Disable all grammars on a background speech detection handle</span>
<span style="color: #00A000">+ \param session The session to change the grammar on</span>
<span style="color: #00A000">+ \return SWITCH_STATUS_SUCCESS if all is well</span>
<span style="color: #00A000">+*/</span>
<span style="color: #00A000">+SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_disable_all_grammars(switch_core_session_t *session);</span>
<span style="color: #00A000">+</span>
SWITCH_DECLARE(switch_status_t) switch_ivr_set_param_detect_speech(switch_core_session_t *session, const char *name, const char *val);
/*!
<span style="color: #000080; font-weight: bold">diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c</span>
<span style="color: #000080; font-weight: bold">index 4fe5732..672750a 100644</span>
<span style="color: #A00000">--- a/src/switch_ivr_async.c</span>
<span style="color: #00A000">+++ b/src/switch_ivr_async.c</span>
<span style="color: #800080; font-weight: bold">@@ -26,6 +26,7 @@</span>
* Anthony Minessale II <anthm@freeswitch.org>
* Michael Jerris <mike@jerris.com>
* Bret McDanel <bret AT 0xdecafbad dot com>
<span style="color: #00A000">+ * Luke Dashjr <luke@openmethods.com> (OpenMethods, LLC)</span>
*
* switch_ivr_async.c -- IVR Library (async operations)
*
<span style="color: #800080; font-weight: bold">@@ -2745,6 +2746,57 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_unload_grammar(switch_c</span>
        return SWITCH_STATUS_FALSE;
}
<span style="color: #00A000">+SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_enable_grammar(switch_core_session_t *session, const char *name)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        switch_channel_t *channel = switch_core_session_get_channel(session);</span>
<span style="color: #00A000">+        switch_asr_flag_t flags = SWITCH_ASR_FLAG_NONE;</span>
<span style="color: #00A000">+        struct speech_thread_handle *sth = switch_channel_get_private(channel, SWITCH_SPEECH_KEY);</span>
<span style="color: #00A000">+        switch_status_t status;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if (sth) {</span>
<span style="color: #00A000">+                if ((status = switch_core_asr_enable_grammar(sth->ah, name)) != SWITCH_STATUS_SUCCESS) {</span>
<span style="color: #00A000">+                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Error enabling Grammar\n");</span>
<span style="color: #00A000">+                        switch_core_asr_close(sth->ah, &flags);</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+                return status;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        return SWITCH_STATUS_FALSE;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_disable_grammar(switch_core_session_t *session, const char *name)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        switch_channel_t *channel = switch_core_session_get_channel(session);</span>
<span style="color: #00A000">+        switch_asr_flag_t flags = SWITCH_ASR_FLAG_NONE;</span>
<span style="color: #00A000">+        struct speech_thread_handle *sth = switch_channel_get_private(channel, SWITCH_SPEECH_KEY);</span>
<span style="color: #00A000">+        switch_status_t status;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if (sth) {</span>
<span style="color: #00A000">+                if ((status = switch_core_asr_disable_grammar(sth->ah, name)) != SWITCH_STATUS_SUCCESS) {</span>
<span style="color: #00A000">+                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Error disabling Grammar\n");</span>
<span style="color: #00A000">+                        switch_core_asr_close(sth->ah, &flags);</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+                return status;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        return SWITCH_STATUS_FALSE;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_disable_all_grammars(switch_core_session_t *session)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        switch_channel_t *channel = switch_core_session_get_channel(session);</span>
<span style="color: #00A000">+        switch_asr_flag_t flags = SWITCH_ASR_FLAG_NONE;</span>
<span style="color: #00A000">+        struct speech_thread_handle *sth = switch_channel_get_private(channel, SWITCH_SPEECH_KEY);</span>
<span style="color: #00A000">+        switch_status_t status;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if (sth) {</span>
<span style="color: #00A000">+                if ((status = switch_core_asr_disable_all_grammars(sth->ah)) != SWITCH_STATUS_SUCCESS) {</span>
<span style="color: #00A000">+                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Error disabling all Grammars\n");</span>
<span style="color: #00A000">+                        switch_core_asr_close(sth->ah, &flags);</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+                return status;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        return SWITCH_STATUS_FALSE;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech(switch_core_session_t *session,
                                                                                                                 const char *mod_name,
                                                                                                                 const char *grammar, const char *name, const char *dest, switch_asr_handle_t *ah)
</pre></div>
<div class="highlight"><pre>committer: Luke Dashjr
comments:
Implement UniMRCP asr_enable_grammar, asr_disable_grammar, and asr_disable_all_grammars which allow for multiple grammar recognition
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c b/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c</span>
<span style="color: #000080; font-weight: bold">index a27ddf0..b9cecd1 100644</span>
<span style="color: #A00000">--- a/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c</span>
<span style="color: #00A000">+++ b/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c</span>
<span style="color: #800080; font-weight: bold">@@ -434,8 +434,8 @@ static const char *grammar_type_to_mime(grammar_type_t type, profile_t *profile)</span>
struct recognizer_data {
        /** the available grammars */
        switch_hash_t *grammars;
<span style="color: #A00000">-        /** the last grammar used (for pause/resume) */</span>
<span style="color: #A00000">-        grammar_t *last_grammar;</span>
<span style="color: #00A000">+        /** the enabled grammars */</span>
<span style="color: #00A000">+        switch_hash_t *enabled_grammars;</span>
        /** recognize result */
        char *result;
        /** true, if voice has started */
<span style="color: #800080; font-weight: bold">@@ -452,6 +452,9 @@ static switch_status_t recog_shutdown();</span>
static switch_status_t recog_asr_open(switch_asr_handle_t *ah, const char *codec, int rate, const char *dest, switch_asr_flag_t *flags);
static switch_status_t recog_asr_load_grammar(switch_asr_handle_t *ah, const char *grammar, const char *name);
static switch_status_t recog_asr_unload_grammar(switch_asr_handle_t *ah, const char *name);
<span style="color: #00A000">+static switch_status_t recog_asr_enable_grammar(switch_asr_handle_t *ah, const char *name);</span>
<span style="color: #00A000">+static switch_status_t recog_asr_disable_grammar(switch_asr_handle_t *ah, const char *name);</span>
<span style="color: #00A000">+static switch_status_t recog_asr_disable_all_grammars(switch_asr_handle_t *ah);</span>
static switch_status_t recog_asr_close(switch_asr_handle_t *ah, switch_asr_flag_t *flags);
static switch_status_t recog_asr_feed(switch_asr_handle_t *ah, void *data, unsigned int len, switch_asr_flag_t *flags);
#if 0
<span style="color: #800080; font-weight: bold">@@ -472,9 +475,12 @@ static apt_bool_t recog_on_message_receive(mrcp_application_t *application, mrcp</span>
static apt_bool_t recog_stream_read(mpf_audio_stream_t *stream, mpf_frame_t *frame);
/* recognizer specific speech_channel_funcs */
<span style="color: #A00000">-static switch_status_t recog_channel_start(speech_channel_t *schannel, const char *name);</span>
<span style="color: #00A000">+static switch_status_t recog_channel_start(speech_channel_t *schannel);</span>
static switch_status_t recog_channel_load_grammar(speech_channel_t *schannel, const char *name, grammar_type_t type, const char *data);
static switch_status_t recog_channel_unload_grammar(speech_channel_t *schannel, const char *name);
<span style="color: #00A000">+static switch_status_t recog_channel_enable_grammar(speech_channel_t *schannel, const char *name);</span>
<span style="color: #00A000">+static switch_status_t recog_channel_disable_grammar(speech_channel_t *schannel, const char *name);</span>
<span style="color: #00A000">+static switch_status_t recog_channel_disable_all_grammars(speech_channel_t *schannel);</span>
static switch_status_t recog_channel_check_results(speech_channel_t *schannel);
static switch_status_t recog_channel_set_start_of_input(speech_channel_t *schannel);
static switch_status_t recog_channel_start_input_timers(speech_channel_t *schannel);
<span style="color: #800080; font-weight: bold">@@ -2056,19 +2062,24 @@ static const char *grammar_type_to_mime(grammar_type_t type, profile_t *profile)</span>
* Start RECOGNIZE request
*
* @param schannel the channel to start
<span style="color: #A00000">- * @param name the name of the grammar to use or NULL if to reuse the last grammar</span>
* @return SWITCH_STATUS_SUCCESS if successful
*/
<span style="color: #A00000">-static switch_status_t recog_channel_start(speech_channel_t *schannel, const char *name)</span>
<span style="color: #00A000">+static switch_status_t recog_channel_start(speech_channel_t *schannel)</span>
{
        switch_status_t status = SWITCH_STATUS_SUCCESS;
<span style="color: #00A000">+        switch_hash_index_t *egk;</span>
        mrcp_message_t *mrcp_message;
        mrcp_recog_header_t *recog_header;
        mrcp_generic_header_t *generic_header;
        recognizer_data_t *r;
        char *start_input_timers;
        const char *mime_type;
<span style="color: #A00000">-        grammar_t *grammar = NULL;</span>
<span style="color: #00A000">+        char *key;</span>
<span style="color: #00A000">+        switch_size_t len;</span>
<span style="color: #00A000">+        grammar_t *grammar;</span>
<span style="color: #00A000">+        switch_size_t grammar_uri_count = 0;</span>
<span style="color: #00A000">+        switch_size_t grammar_uri_list_len = 0;</span>
<span style="color: #00A000">+        char *grammar_uri_list = NULL;</span>
        switch_mutex_lock(schannel->mutex);
        if (schannel->state != SPEECH_CHANNEL_READY) {
<span style="color: #800080; font-weight: bold">@@ -2089,21 +2100,55 @@ static switch_status_t recog_channel_start(speech_channel_t *schannel, const cha</span>
        start_input_timers = (char *) switch_core_hash_find(schannel->params, "start-input-timers");
        r->timers_started = zstr(start_input_timers) || strcasecmp(start_input_timers, "false");
<span style="color: #A00000">-        /* get the cached grammar */</span>
<span style="color: #A00000">-        if (zstr(name)) {</span>
<span style="color: #A00000">-                grammar = r->last_grammar;</span>
<span style="color: #A00000">-        } else {</span>
<span style="color: #A00000">-                grammar = (grammar_t *) switch_core_hash_find(r->grammars, name);</span>
<span style="color: #A00000">-                r->last_grammar = grammar;</span>
<span style="color: #A00000">-        }</span>
<span style="color: #A00000">-        if (grammar == NULL) {</span>
<span style="color: #A00000">-                if (name) {</span>
<span style="color: #A00000">-                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "(%s) Undefined grammar, %s\n", schannel->name, name);</span>
<span style="color: #A00000">-                } else {</span>
<span style="color: #A00000">-                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "(%s) No grammar specified\n", schannel->name);</span>
<span style="color: #00A000">+        /* count enabled grammars */</span>
<span style="color: #00A000">+        for (egk = switch_hash_first(NULL, r->enabled_grammars); egk; egk = switch_hash_next(egk)) {</span>
<span style="color: #00A000">+                // NOTE: This postponed type check is necessary to allow a non-URI-list grammar to execute alone</span>
<span style="color: #00A000">+                if (grammar_uri_count == 1 && grammar->type != GRAMMAR_TYPE_URI)</span>
<span style="color: #00A000">+                        goto no_grammar_alone;</span>
<span style="color: #00A000">+                ++grammar_uri_count;</span>
<span style="color: #00A000">+                switch_hash_this(egk, (void *) &key, NULL, (void *) &grammar);</span>
<span style="color: #00A000">+                if (grammar->type != GRAMMAR_TYPE_URI && grammar_uri_count != 1) {</span>
<span style="color: #00A000">+                 no_grammar_alone:</span>
<span style="color: #00A000">+                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "(%s) Grammar '%s' can only be used alone (not a URI list)\n", schannel->name, key);</span>
<span style="color: #00A000">+                        status = SWITCH_STATUS_FALSE;</span>
<span style="color: #00A000">+                        goto done;</span>
                }
<span style="color: #00A000">+                len = strlen(grammar->data);</span>
<span style="color: #00A000">+                if (!len)</span>
<span style="color: #00A000">+                        continue;</span>
<span style="color: #00A000">+                grammar_uri_list_len += len;</span>
<span style="color: #00A000">+                if (grammar->data[len - 1] != '\n')</span>
<span style="color: #00A000">+                        grammar_uri_list_len += 2;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        switch (grammar_uri_count) {</span>
<span style="color: #00A000">+        case 0:</span>
<span style="color: #00A000">+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "(%s) No grammar specified\n", schannel->name);</span>
                status = SWITCH_STATUS_FALSE;
                goto done;
<span style="color: #00A000">+        case 1:</span>
<span style="color: #00A000">+                /* grammar should already be the unique grammar */</span>
<span style="color: #00A000">+                break;</span>
<span style="color: #00A000">+        default:</span>
<span style="color: #00A000">+                /* get the enabled grammars list */</span>
<span style="color: #00A000">+                grammar_uri_list = switch_core_alloc(schannel->memory_pool, grammar_uri_list_len + 1);</span>
<span style="color: #00A000">+                grammar_uri_list_len = 0;</span>
<span style="color: #00A000">+                for (egk = switch_hash_first(NULL, r->enabled_grammars); egk; egk = switch_hash_next(egk)) {</span>
<span style="color: #00A000">+                        switch_hash_this(egk, (void *) &key, NULL, (void *) &grammar);</span>
<span style="color: #00A000">+                        len = strlen(grammar->data);</span>
<span style="color: #00A000">+                        if (!len)</span>
<span style="color: #00A000">+                                continue;</span>
<span style="color: #00A000">+                        memcpy(&(grammar_uri_list[grammar_uri_list_len]), grammar->data, len);</span>
<span style="color: #00A000">+                        grammar_uri_list_len += len;</span>
<span style="color: #00A000">+                        if (grammar_uri_list[grammar_uri_list_len - 1] != '\n')</span>
<span style="color: #00A000">+                        {</span>
<span style="color: #00A000">+                                grammar_uri_list_len += 2;</span>
<span style="color: #00A000">+                                grammar_uri_list[grammar_uri_list_len - 2] = '\r';</span>
<span style="color: #00A000">+                                grammar_uri_list[grammar_uri_list_len - 1] = '\n';</span>
<span style="color: #00A000">+                        }</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+                grammar_uri_list[grammar_uri_list_len++] = '\0';</span>
<span style="color: #00A000">+                grammar = NULL;</span>
        }
        /* create MRCP message */
<span style="color: #800080; font-weight: bold">@@ -2121,7 +2166,7 @@ static switch_status_t recog_channel_start(speech_channel_t *schannel, const cha</span>
        }
        /* set Content-Type */
<span style="color: #A00000">-        mime_type = grammar_type_to_mime(grammar->type, schannel->profile);</span>
<span style="color: #00A000">+        mime_type = grammar_type_to_mime(grammar ? grammar->type : GRAMMAR_TYPE_URI, schannel->profile);</span>
        if (zstr(mime_type)) {
                status = SWITCH_STATUS_FALSE;
                goto done;
<span style="color: #800080; font-weight: bold">@@ -2130,7 +2175,7 @@ static switch_status_t recog_channel_start(speech_channel_t *schannel, const cha</span>
        mrcp_generic_header_property_add(mrcp_message, GENERIC_HEADER_CONTENT_TYPE);
        /* set Content-ID for inline grammars */
<span style="color: #A00000">-        if (grammar->type != GRAMMAR_TYPE_URI) {</span>
<span style="color: #00A000">+        if (grammar && grammar->type != GRAMMAR_TYPE_URI) {</span>
                apt_string_assign(&generic_header->content_id, grammar->name, mrcp_message->pool);
                mrcp_generic_header_property_add(mrcp_message, GENERIC_HEADER_CONTENT_ID);
        }
<span style="color: #800080; font-weight: bold">@@ -2152,7 +2197,7 @@ static switch_status_t recog_channel_start(speech_channel_t *schannel, const cha</span>
        recog_channel_set_params(schannel, mrcp_message, generic_header, recog_header);
        /* set message body */
<span style="color: #A00000">-        apt_string_assign(&mrcp_message->body, grammar->data, mrcp_message->pool);</span>
<span style="color: #00A000">+        apt_string_assign(&mrcp_message->body, grammar ? grammar->data : grammar_uri_list, mrcp_message->pool);</span>
        /* Empty audio queue and send RECOGNIZE to MRCP server */
        audio_queue_clear(schannel->audio_queue);
<span style="color: #800080; font-weight: bold">@@ -2287,6 +2332,7 @@ static switch_status_t recog_channel_unload_grammar(speech_channel_t *schannel,</span>
        } else {
                recognizer_data_t *r = (recognizer_data_t *) schannel->data;
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) Unloading grammar %s\n", schannel->name, grammar_name);
<span style="color: #00A000">+                switch_core_hash_delete(r->enabled_grammars, grammar_name);</span>
                switch_core_hash_delete(r->grammars, grammar_name);
        }
<span style="color: #800080; font-weight: bold">@@ -2294,6 +2340,77 @@ static switch_status_t recog_channel_unload_grammar(speech_channel_t *schannel,</span>
}
/**
<span style="color: #00A000">+ * Enable speech recognition grammar</span>
<span style="color: #00A000">+ *</span>
<span style="color: #00A000">+ * @param schannel the recognizer channel</span>
<span style="color: #00A000">+ * @param grammar_name the name of the grammar to enable</span>
<span style="color: #00A000">+ * @return SWITCH_STATUS_SUCCESS if successful</span>
<span style="color: #00A000">+ */</span>
<span style="color: #00A000">+static switch_status_t recog_channel_enable_grammar(speech_channel_t *schannel, const char *grammar_name)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        switch_status_t status = SWITCH_STATUS_SUCCESS;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if (zstr(grammar_name)) {</span>
<span style="color: #00A000">+                status = SWITCH_STATUS_FALSE;</span>
<span style="color: #00A000">+        } else {</span>
<span style="color: #00A000">+                recognizer_data_t *r = (recognizer_data_t *) schannel->data;</span>
<span style="color: #00A000">+                grammar_t *grammar;</span>
<span style="color: #00A000">+                grammar = (grammar_t *) switch_core_hash_find(r->grammars, grammar_name);</span>
<span style="color: #00A000">+                if (grammar == NULL)</span>
<span style="color: #00A000">+                {</span>
<span style="color: #00A000">+                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "(%s) Undefined grammar, %s\n", schannel->name, grammar_name);</span>
<span style="color: #00A000">+                        status = SWITCH_STATUS_FALSE;</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+                else {</span>
<span style="color: #00A000">+                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) Enabling grammar %s\n", schannel->name, grammar_name);</span>
<span style="color: #00A000">+                        switch_core_hash_insert(r->enabled_grammars, grammar_name, grammar);</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return status;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/**</span>
<span style="color: #00A000">+ * Disable speech recognition grammar</span>
<span style="color: #00A000">+ *</span>
<span style="color: #00A000">+ * @param schannel the recognizer channel</span>
<span style="color: #00A000">+ * @param grammar_name the name of the grammar to disable</span>
<span style="color: #00A000">+ * @return SWITCH_STATUS_SUCCESS if successful</span>
<span style="color: #00A000">+ */</span>
<span style="color: #00A000">+static switch_status_t recog_channel_disable_grammar(speech_channel_t *schannel, const char *grammar_name)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        switch_status_t status = SWITCH_STATUS_SUCCESS;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if (zstr(grammar_name)) {</span>
<span style="color: #00A000">+                status = SWITCH_STATUS_FALSE;</span>
<span style="color: #00A000">+        } else {</span>
<span style="color: #00A000">+                recognizer_data_t *r = (recognizer_data_t *) schannel->data;</span>
<span style="color: #00A000">+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) Disabling grammar %s\n", schannel->name, grammar_name);</span>
<span style="color: #00A000">+                switch_core_hash_delete(r->enabled_grammars, grammar_name);</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return status;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/**</span>
<span style="color: #00A000">+ * Disable all speech recognition grammars</span>
<span style="color: #00A000">+ *</span>
<span style="color: #00A000">+ * @param schannel the recognizer channel</span>
<span style="color: #00A000">+ * @return SWITCH_STATUS_SUCCESS if successful</span>
<span style="color: #00A000">+ */</span>
<span style="color: #00A000">+static switch_status_t recog_channel_disable_all_grammars(speech_channel_t *schannel)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        switch_status_t status = SWITCH_STATUS_SUCCESS;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        recognizer_data_t *r = (recognizer_data_t *) schannel->data;</span>
<span style="color: #00A000">+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) Disabling all grammars\n", schannel->name);</span>
<span style="color: #00A000">+        switch_core_hash_destroy(&r->enabled_grammars);</span>
<span style="color: #00A000">+        switch_core_hash_init(&r->enabled_grammars, schannel->memory_pool);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return status;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/**</span>
* Check if recognition is complete
*
* @return SWITCH_STATUS_SUCCESS if results available or start of input
<span style="color: #800080; font-weight: bold">@@ -2740,6 +2857,7 @@ static switch_status_t recog_asr_open(switch_asr_handle_t *ah, const char *codec</span>
        schannel->data = r;
        memset(r, 0, sizeof(recognizer_data_t));
        switch_core_hash_init(&r->grammars, ah->memory_pool);
<span style="color: #00A000">+        switch_core_hash_init(&r->enabled_grammars, ah->memory_pool);</span>
        /* Open the channel */
        if (zstr(profile_name)) {
<span style="color: #800080; font-weight: bold">@@ -2892,7 +3010,17 @@ static switch_status_t recog_asr_load_grammar(switch_asr_handle_t *ah, const cha</span>
        start_recognize = (char *) switch_core_hash_find(schannel->params, "start-recognize");
        if (zstr(start_recognize) || strcasecmp(start_recognize, "false"))
<span style="color: #A00000">-                status = recog_channel_start(schannel, name);</span>
<span style="color: #00A000">+        {</span>
<span style="color: #00A000">+                if (recog_channel_disable_all_grammars(schannel) != SWITCH_STATUS_SUCCESS) {</span>
<span style="color: #00A000">+                        status = SWITCH_STATUS_FALSE;</span>
<span style="color: #00A000">+                        goto done;</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+                if (recog_channel_enable_grammar(schannel, name) != SWITCH_STATUS_SUCCESS) {</span>
<span style="color: #00A000">+                        status = SWITCH_STATUS_FALSE;</span>
<span style="color: #00A000">+                        goto done;</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+                status = recog_channel_start(schannel);</span>
<span style="color: #00A000">+        }</span>
done:
<span style="color: #800080; font-weight: bold">@@ -2921,6 +3049,57 @@ static switch_status_t recog_asr_unload_grammar(switch_asr_handle_t *ah, const c</span>
}
/**
<span style="color: #00A000">+ * Process asr_enable_grammar request from FreeSWITCH.</span>
<span style="color: #00A000">+ *</span>
<span style="color: #00A000">+ * FreeSWITCH sends this request to enable recognition on this grammar.</span>
<span style="color: #00A000">+ * @param ah the FreeSWITCH speech recognition handle</span>
<span style="color: #00A000">+ * @param name the grammar name.</span>
<span style="color: #00A000">+ */</span>
<span style="color: #00A000">+static switch_status_t recog_asr_enable_grammar(switch_asr_handle_t *ah, const char *name)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        switch_status_t status = SWITCH_STATUS_SUCCESS;</span>
<span style="color: #00A000">+        speech_channel_t *schannel = (speech_channel_t *) ah->private_info;</span>
<span style="color: #00A000">+        if (zstr(name) || speech_channel_stop(schannel) != SWITCH_STATUS_SUCCESS || recog_channel_enable_grammar(schannel, name) != SWITCH_STATUS_SUCCESS) {</span>
<span style="color: #00A000">+                status = SWITCH_STATUS_FALSE;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        return status;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/**</span>
<span style="color: #00A000">+ * Process asr_disable_grammar request from FreeSWITCH.</span>
<span style="color: #00A000">+ *</span>
<span style="color: #00A000">+ * FreeSWITCH sends this request to disable recognition on this grammar.</span>
<span style="color: #00A000">+ * @param ah the FreeSWITCH speech recognition handle</span>
<span style="color: #00A000">+ * @param name the grammar name.</span>
<span style="color: #00A000">+ */</span>
<span style="color: #00A000">+static switch_status_t recog_asr_disable_grammar(switch_asr_handle_t *ah, const char *name)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        switch_status_t status = SWITCH_STATUS_SUCCESS;</span>
<span style="color: #00A000">+        speech_channel_t *schannel = (speech_channel_t *) ah->private_info;</span>
<span style="color: #00A000">+        if (zstr(name) || speech_channel_stop(schannel) != SWITCH_STATUS_SUCCESS || recog_channel_disable_grammar(schannel, name) != SWITCH_STATUS_SUCCESS) {</span>
<span style="color: #00A000">+                status = SWITCH_STATUS_FALSE;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        return status;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/**</span>
<span style="color: #00A000">+ * Process asr_disable_all_grammars request from FreeSWITCH.</span>
<span style="color: #00A000">+ *</span>
<span style="color: #00A000">+ * FreeSWITCH sends this request to disable recognition of all grammars.</span>
<span style="color: #00A000">+ * @param ah the FreeSWITCH speech recognition handle</span>
<span style="color: #00A000">+ * @param name the grammar name.</span>
<span style="color: #00A000">+ */</span>
<span style="color: #00A000">+static switch_status_t recog_asr_disable_all_grammars(switch_asr_handle_t *ah)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        switch_status_t status = SWITCH_STATUS_SUCCESS;</span>
<span style="color: #00A000">+        speech_channel_t *schannel = (speech_channel_t *) ah->private_info;</span>
<span style="color: #00A000">+        if (speech_channel_stop(schannel) != SWITCH_STATUS_SUCCESS || recog_channel_disable_all_grammars(schannel) != SWITCH_STATUS_SUCCESS) {</span>
<span style="color: #00A000">+                status = SWITCH_STATUS_FALSE;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        return status;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/**</span>
* Process asr_close request from FreeSWITCH
*
* @param ah the FreeSWITCH speech recognition handle
<span style="color: #800080; font-weight: bold">@@ -2934,6 +3113,7 @@ static switch_status_t recog_asr_close(switch_asr_handle_t *ah, switch_asr_flag_</span>
        speech_channel_stop(schannel);
        speech_channel_destroy(schannel);
        switch_core_hash_destroy(&r->grammars);
<span style="color: #00A000">+        switch_core_hash_destroy(&r->enabled_grammars);</span>
        /* this lets FreeSWITCH's speech_thread know the handle is closed */
        switch_set_flag(ah, SWITCH_ASR_FLAG_CLOSED);
<span style="color: #800080; font-weight: bold">@@ -2958,14 +3138,13 @@ static switch_status_t recog_asr_feed(switch_asr_handle_t *ah, void *data, unsig</span>
/**
* Process asr_start request from FreeSWITCH
* @param ah the FreeSWITCH speech recognition handle
<span style="color: #A00000">- * @param name name of the grammar to use</span>
* @return SWITCH_STATUS_SUCCESS if successful
*/
<span style="color: #A00000">-static switch_status_t recog_asr_start(switch_asr_handle_t *ah, const char *name)</span>
<span style="color: #00A000">+static switch_status_t recog_asr_start(switch_asr_handle_t *ah)</span>
{
        switch_status_t status;
        speech_channel_t *schannel = (speech_channel_t *) ah->private_info;
<span style="color: #A00000">-        status = recog_channel_start(schannel, name);</span>
<span style="color: #00A000">+        status = recog_channel_start(schannel);</span>
        return status;
}
#endif
<span style="color: #800080; font-weight: bold">@@ -2978,7 +3157,7 @@ static switch_status_t recog_asr_start(switch_asr_handle_t *ah, const char *name</span>
static switch_status_t recog_asr_resume(switch_asr_handle_t *ah)
{
        speech_channel_t *schannel = (speech_channel_t *) ah->private_info;
<span style="color: #A00000">-        return recog_channel_start(schannel, NULL);</span>
<span style="color: #00A000">+        return recog_channel_start(schannel);</span>
}
/**
<span style="color: #800080; font-weight: bold">@@ -3237,6 +3416,9 @@ static switch_status_t recog_load(switch_loadable_module_interface_t *module_int</span>
        asr_interface->asr_open = recog_asr_open;
        asr_interface->asr_load_grammar = recog_asr_load_grammar;
        asr_interface->asr_unload_grammar = recog_asr_unload_grammar;
<span style="color: #00A000">+        asr_interface->asr_enable_grammar = recog_asr_enable_grammar;</span>
<span style="color: #00A000">+        asr_interface->asr_disable_grammar = recog_asr_disable_grammar;</span>
<span style="color: #00A000">+        asr_interface->asr_disable_all_grammars = recog_asr_disable_all_grammars;</span>
        asr_interface->asr_close = recog_asr_close;
        asr_interface->asr_feed = recog_asr_feed;
#if 0
</pre></div>
<div class="highlight"><pre>committer: Luke Dashjr
comments:
switch_core_asr interfaces for enable_grammar, disable_grammar, and disable_all_grammars
<span style="color: #000080; font-weight: bold">diff --git a/src/include/switch_core.h b/src/include/switch_core.h</span>
<span style="color: #000080; font-weight: bold">index 650ffc1..26a048c 100644</span>
<span style="color: #A00000">--- a/src/include/switch_core.h</span>
<span style="color: #00A000">+++ b/src/include/switch_core.h</span>
<span style="color: #800080; font-weight: bold">@@ -24,6 +24,7 @@</span>
* Contributor(s):
*
* Anthony Minessale II <anthm@freeswitch.org>
<span style="color: #00A000">+ * Luke Dashjr <luke@openmethods.com> (OpenMethods, LLC)</span>
*
*
* switch_core.h -- Core Library
<span style="color: #800080; font-weight: bold">@@ -1748,6 +1749,29 @@ SWITCH_DECLARE(switch_status_t) switch_core_asr_load_grammar(switch_asr_handle_t</span>
SWITCH_DECLARE(switch_status_t) switch_core_asr_unload_grammar(switch_asr_handle_t *ah, const char *name);
/*!
<span style="color: #00A000">+ \brief Enable a grammar from an asr handle</span>
<span style="color: #00A000">+ \param ah the handle to enable the grammar from</span>
<span style="color: #00A000">+ \param name the name of the grammar to enable</span>
<span style="color: #00A000">+ \return SWITCH_STATUS_SUCCESS</span>
<span style="color: #00A000">+*/</span>
<span style="color: #00A000">+SWITCH_DECLARE(switch_status_t) switch_core_asr_enable_grammar(switch_asr_handle_t *ah, const char *name);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/*!</span>
<span style="color: #00A000">+ \brief Disable a grammar from an asr handle</span>
<span style="color: #00A000">+ \param ah the handle to disable the grammar from</span>
<span style="color: #00A000">+ \param name the name of the grammar to disable</span>
<span style="color: #00A000">+ \return SWITCH_STATUS_SUCCESS</span>
<span style="color: #00A000">+*/</span>
<span style="color: #00A000">+SWITCH_DECLARE(switch_status_t) switch_core_asr_disable_grammar(switch_asr_handle_t *ah, const char *name);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/*!</span>
<span style="color: #00A000">+ \brief Disable all grammars from an asr handle</span>
<span style="color: #00A000">+ \param ah the handle to disable the grammars from</span>
<span style="color: #00A000">+ \return SWITCH_STATUS_SUCCESS</span>
<span style="color: #00A000">+*/</span>
<span style="color: #00A000">+SWITCH_DECLARE(switch_status_t) switch_core_asr_disable_all_grammars(switch_asr_handle_t *ah);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/*!</span>
\brief Pause detection on an asr handle
\param ah the handle to pause
\return SWITCH_STATUS_SUCCESS
<span style="color: #000080; font-weight: bold">diff --git a/src/include/switch_module_interfaces.h b/src/include/switch_module_interfaces.h</span>
<span style="color: #000080; font-weight: bold">index 078b83d..e0119b4 100644</span>
<span style="color: #A00000">--- a/src/include/switch_module_interfaces.h</span>
<span style="color: #00A000">+++ b/src/include/switch_module_interfaces.h</span>
<span style="color: #800080; font-weight: bold">@@ -24,6 +24,7 @@</span>
* Contributor(s):
*
* Anthony Minessale II <anthm@freeswitch.org>
<span style="color: #00A000">+ * Luke Dashjr <luke@openmethods.com> (OpenMethods, LLC)</span>
*
*
* switch_module_interfaces.h -- Module Interface Definitions
<span style="color: #800080; font-weight: bold">@@ -393,6 +394,12 @@ struct switch_asr_interface {</span>
        switch_mutex_t *reflock;
        switch_loadable_module_interface_t *parent;
        struct switch_asr_interface *next;
<span style="color: #00A000">+        /*! function to enable a grammar to the asr interface */</span>
<span style="color: #00A000">+        switch_status_t (*asr_enable_grammar) (switch_asr_handle_t *ah, const char *name);</span>
<span style="color: #00A000">+        /*! function to disable a grammar to the asr interface */</span>
<span style="color: #00A000">+        switch_status_t (*asr_disable_grammar) (switch_asr_handle_t *ah, const char *name);</span>
<span style="color: #00A000">+        /*! function to disable all grammars to the asr interface */</span>
<span style="color: #00A000">+        switch_status_t (*asr_disable_all_grammars) (switch_asr_handle_t *ah);</span>
};
/*! an abstract representation of an asr speech interface. */
<span style="color: #000080; font-weight: bold">diff --git a/src/switch_core_asr.c b/src/switch_core_asr.c</span>
<span style="color: #000080; font-weight: bold">index fa4446e..691011a 100644</span>
<span style="color: #A00000">--- a/src/switch_core_asr.c</span>
<span style="color: #00A000">+++ b/src/switch_core_asr.c</span>
<span style="color: #800080; font-weight: bold">@@ -27,6 +27,7 @@</span>
* Michael Jerris <mike@jerris.com>
* Paul D. Tinsley <pdt at jackhammer.org>
* Christopher M. Rienzo <chris@rienzo.net>
<span style="color: #00A000">+ * Luke Dashjr <luke@openmethods.com> (OpenMethods, LLC)</span>
*
*
* switch_core_asr.c -- Main Core Library (Speech Detection Interface)
<span style="color: #800080; font-weight: bold">@@ -160,6 +161,45 @@ SWITCH_DECLARE(switch_status_t) switch_core_asr_unload_grammar(switch_asr_handle</span>
        return status;
}
<span style="color: #00A000">+SWITCH_DECLARE(switch_status_t) switch_core_asr_enable_grammar(switch_asr_handle_t *ah, const char *name)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        switch_status_t status = SWITCH_STATUS_FALSE;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        switch_assert(ah != NULL);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if (ah->asr_interface->asr_enable_grammar) {</span>
<span style="color: #00A000">+                status = ah->asr_interface->asr_enable_grammar(ah, name);</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return status;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+SWITCH_DECLARE(switch_status_t) switch_core_asr_disable_grammar(switch_asr_handle_t *ah, const char *name)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        switch_status_t status = SWITCH_STATUS_FALSE;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        switch_assert(ah != NULL);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if (ah->asr_interface->asr_disable_grammar) {</span>
<span style="color: #00A000">+                status = ah->asr_interface->asr_disable_grammar(ah, name);</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return status;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+SWITCH_DECLARE(switch_status_t) switch_core_asr_disable_all_grammars(switch_asr_handle_t *ah)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        switch_status_t status = SWITCH_STATUS_FALSE;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        switch_assert(ah != NULL);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if (ah->asr_interface->asr_disable_all_grammars) {</span>
<span style="color: #00A000">+                status = ah->asr_interface->asr_disable_all_grammars(ah);</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return status;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
SWITCH_DECLARE(switch_status_t) switch_core_asr_pause(switch_asr_handle_t *ah)
{
        switch_assert(ah != NULL);
</pre></div>
<div class="highlight"><pre>committer: Luke Dashjr
comments:
Allow loading grammars without sending RECOGNIZE with start-recognize=false parameter
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c b/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c</span>
<span style="color: #000080; font-weight: bold">index 41c0ccd..a27ddf0 100644</span>
<span style="color: #A00000">--- a/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c</span>
<span style="color: #00A000">+++ b/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c</span>
<span style="color: #800080; font-weight: bold">@@ -26,6 +26,7 @@</span>
*
* Brian West <brian@freeswitch.org>
* Christopher M. Rienzo <chris@rienzo.net>
<span style="color: #00A000">+ * Luke Dashjr <luke@openmethods.com> (OpenMethods, LLC)</span>
*
* mod_unimrcp.c -- UniMRCP module (MRCP client)
*
<span style="color: #800080; font-weight: bold">@@ -2451,6 +2452,8 @@ static switch_status_t recog_channel_set_params(speech_channel_t *schannel, mrcp</span>
                        if (id) {
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) \"%s\": \"%s\"\n", schannel->name, param_name, param_val);
                                recog_channel_set_header(schannel, id->id, param_val, msg, recog_hdr);
<span style="color: #00A000">+                        } else if (!strcasecmp(param_name, "start-recognize")) {</span>
<span style="color: #00A000">+                                // This parameter is used internally only, not in MRCP headers</span>
                        } else {
                                /* this is probably a vendor-specific MRCP param */
                                apt_str_t apt_param_name = { 0 };
<span style="color: #800080; font-weight: bold">@@ -2782,6 +2785,7 @@ static switch_status_t recog_asr_load_grammar(switch_asr_handle_t *ah, const cha</span>
        speech_channel_t *schannel = (speech_channel_t *) ah->private_info;
        const char *grammar_data = NULL;
        char *grammar_file_data = NULL;
<span style="color: #00A000">+        char *start_recognize;</span>
        switch_file_t *grammar_file = NULL;
        switch_size_t grammar_file_size = 0, to_read = 0;
        grammar_type_t type = GRAMMAR_TYPE_UNKNOWN;
<span style="color: #800080; font-weight: bold">@@ -2886,7 +2890,9 @@ static switch_status_t recog_asr_load_grammar(switch_asr_handle_t *ah, const cha</span>
                goto done;
        }
<span style="color: #A00000">-        status = recog_channel_start(schannel, name);</span>
<span style="color: #00A000">+        start_recognize = (char *) switch_core_hash_find(schannel->params, "start-recognize");</span>
<span style="color: #00A000">+        if (zstr(start_recognize) || strcasecmp(start_recognize, "false"))</span>
<span style="color: #00A000">+                status = recog_channel_start(schannel, name);</span>
done:
</pre></div>
<div class="highlight"><pre>committer: Luke Dashjr
comments:
document all of detect_speech's valid syntax
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c</span>
<span style="color: #000080; font-weight: bold">index 5a1b8c5..6d014fa 100755</span>
<span style="color: #A00000">--- a/src/mod/applications/mod_dptools/mod_dptools.c</span>
<span style="color: #00A000">+++ b/src/mod/applications/mod_dptools/mod_dptools.c</span>
<span style="color: #800080; font-weight: bold">@@ -28,6 +28,7 @@</span>
* Michael Murdock <mike at mmurdock dot org>
* Neal Horman <neal at wanlink dot com>
* Bret McDanel <trixter AT 0xdecafbad dot com>
<span style="color: #00A000">+ * Luke Dashjr <luke@openmethods.com> (OpenMethods, LLC)</span>
*
* mod_dptools.c -- Raw Audio File Streaming Application Module
*
<span style="color: #800080; font-weight: bold">@@ -95,7 +96,7 @@ SWITCH_STANDARD_DIALPLAN(inline_dialplan_hunt)</span>
        return extension;
}
<span style="color: #A00000">-#define DETECT_SPEECH_SYNTAX "<mod_name> <gram_name> <gram_path> [<addr>] OR grammar <gram_name> [<path>] OR pause OR resume"</span>
<span style="color: #00A000">+#define DETECT_SPEECH_SYNTAX "<mod_name> <gram_name> <gram_path> [<addr>] OR grammar <gram_name> [<path>] OR nogrammar <gram_name> OR pause OR resume OR stop OR param <name> <value>"</span>
SWITCH_STANDARD_APP(detect_speech_function)
{
        char *argv[4];
</pre></div>
<div class="highlight"><pre>committer: Luke Dashjr
comments:
expose ASR start_input_timers to dialplan via mod_dptools
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c</span>
<span style="color: #000080; font-weight: bold">index 5a1b8c5..2f49630 100755</span>
<span style="color: #A00000">--- a/src/mod/applications/mod_dptools/mod_dptools.c</span>
<span style="color: #00A000">+++ b/src/mod/applications/mod_dptools/mod_dptools.c</span>
<span style="color: #800080; font-weight: bold">@@ -28,6 +28,7 @@</span>
* Michael Murdock <mike at mmurdock dot org>
* Neal Horman <neal at wanlink dot com>
* Bret McDanel <trixter AT 0xdecafbad dot com>
<span style="color: #00A000">+ * Luke Dashjr <luke@openmethods.com> (OpenMethods, LLC)</span>
*
* mod_dptools.c -- Raw Audio File Streaming Application Module
*
<span style="color: #800080; font-weight: bold">@@ -95,7 +96,7 @@ SWITCH_STANDARD_DIALPLAN(inline_dialplan_hunt)</span>
        return extension;
}
<span style="color: #A00000">-#define DETECT_SPEECH_SYNTAX "<mod_name> <gram_name> <gram_path> [<addr>] OR grammar <gram_name> [<path>] OR pause OR resume"</span>
<span style="color: #00A000">+#define DETECT_SPEECH_SYNTAX "<mod_name> <gram_name> <gram_path> [<addr>] OR grammar <gram_name> [<path>] OR pause OR resume OR start_input_timers"</span>
SWITCH_STANDARD_APP(detect_speech_function)
{
        char *argv[4];
<span style="color: #800080; font-weight: bold">@@ -116,6 +117,8 @@ SWITCH_STANDARD_APP(detect_speech_function)</span>
                        switch_ivr_stop_detect_speech(session);
                } else if (!strcasecmp(argv[0], "param")) {
                        switch_ivr_set_param_detect_speech(session, argv[1], argv[2]);
<span style="color: #00A000">+                } else if (!strcasecmp(argv[0], "start_input_timers")) {</span>
<span style="color: #00A000">+                        switch_ivr_detect_speech_start_input_timers(session);</span>
                } else if (argc >= 3) {
                        switch_ivr_detect_speech(session, argv[0], argv[1], argv[2], argv[3], NULL);
                }
</pre></div>
<div class="highlight"><pre>committer: Luke Dashjr
comments:
expose ASR start_input_timers on the IVR abstraction level
<span style="color: #000080; font-weight: bold">diff --git a/src/include/switch_ivr.h b/src/include/switch_ivr.h</span>
<span style="color: #000080; font-weight: bold">index 40ba1dc..692ad8d 100644</span>
<span style="color: #A00000">--- a/src/include/switch_ivr.h</span>
<span style="color: #00A000">+++ b/src/include/switch_ivr.h</span>
<span style="color: #800080; font-weight: bold">@@ -26,6 +26,7 @@</span>
* Anthony Minessale II <anthm@freeswitch.org>
* Neal Horman <neal at wanlink dot com>
* Bret McDanel <trixter AT 0xdecafbad dot com>
<span style="color: #00A000">+ * Luke Dashjr <luke@openmethods.com> (OpenMethods, LLC)</span>
*
* switch_ivr.h -- IVR Library
*
<span style="color: #800080; font-weight: bold">@@ -201,6 +202,13 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_unload_grammar(switch_c</span>
SWITCH_DECLARE(switch_status_t) switch_ivr_set_param_detect_speech(switch_core_session_t *session, const char *name, const char *val);
/*!
<span style="color: #00A000">+ \brief Start input timers on a background speech detection handle</span>
<span style="color: #00A000">+ \param session The session to start the timers on</span>
<span style="color: #00A000">+ \return SWITCH_STATUS_SUCCESS if all is well</span>
<span style="color: #00A000">+*/</span>
<span style="color: #00A000">+SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_start_input_timers(switch_core_session_t *session);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+/*!</span>
\brief Record a session to disk
\param session the session to record
\param file the path to the file
<span style="color: #000080; font-weight: bold">diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c</span>
<span style="color: #000080; font-weight: bold">index 4fe5732..ae23d0a 100644</span>
<span style="color: #A00000">--- a/src/switch_ivr_async.c</span>
<span style="color: #00A000">+++ b/src/switch_ivr_async.c</span>
<span style="color: #800080; font-weight: bold">@@ -26,6 +26,7 @@</span>
* Anthony Minessale II <anthm@freeswitch.org>
* Michael Jerris <mike@jerris.com>
* Bret McDanel <bret AT 0xdecafbad dot com>
<span style="color: #00A000">+ * Luke Dashjr <luke@openmethods.com> (OpenMethods, LLC)</span>
*
* switch_ivr_async.c -- IVR Library (async operations)
*
<span style="color: #800080; font-weight: bold">@@ -2728,6 +2729,18 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_set_param_detect_speech(switch_core_s</span>
        return status;
}
<span style="color: #00A000">+SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_start_input_timers(switch_core_session_t *session)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        switch_channel_t *channel = switch_core_session_get_channel(session);</span>
<span style="color: #00A000">+        struct speech_thread_handle *sth = switch_channel_get_private(channel, SWITCH_SPEECH_KEY);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if (sth) {</span>
<span style="color: #00A000">+                switch_core_asr_start_input_timers(sth->ah);</span>
<span style="color: #00A000">+                return SWITCH_STATUS_SUCCESS;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+        return SWITCH_STATUS_FALSE;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_unload_grammar(switch_core_session_t *session, const char *name)
{
        switch_channel_t *channel = switch_core_session_get_channel(session);
</pre></div>
========================================================================<pre>
Summary of changes:
Freeswitch.2010.sln | 24 +-
build/modules.conf.in | 1 +
conf/autoload_configs/cdr_pg_csv.conf.xml | 35 +-
conf/autoload_configs/modules.conf.xml | 1 +
conf/autoload_configs/switch.conf.xml | 4 +
conf/freeswitch.xml | 3 -
fscomm/widgets/codecwidget.cpp | 2 +
libs/esl/fs_cli.c | 44 +-
libs/freetdm/Makefile.am | 3 +-
libs/freetdm/configure.ac | 2 +-
libs/freetdm/mod_freetdm/mod_freetdm.c | 75 +-
libs/freetdm/msvc/testboost/testboost.2010.vcxproj | 6 +-
.../msvc/testboost/testsangomaboost.2010.vcxproj | 6 +-
libs/freetdm/src/ftdm_io.c | 10 +-
.../ftmod_sangoma_boost.2010.vcxproj | 12 +-
.../ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c | 19 +-
.../ftmod_sangoma_isdn_stack_hndl.c | 25 +-
.../ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c | 568 +++--
.../ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c | 448 +++-
.../ftmod_sangoma_ss7/ftmod_sangoma_ss7_cntrl.c | 374 +++-
.../ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c | 94 +-
.../ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_in.c | 82 +-
.../ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c | 125 +-
.../ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c | 286 ++-
.../ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h | 333 ++-
.../ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c | 17 +-
.../ftmod_sangoma_ss7/ftmod_sangoma_ss7_relay.c | 318 +++
.../ftmod_sangoma_ss7/ftmod_sangoma_ss7_sta.c | 106 +-
.../ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c | 267 ++-
.../ftmod_sangoma_ss7/ftmod_sangoma_ss7_timers.c | 2 +-
.../ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c | 2794 +++++++++++++-------
.../ftmod/ftmod_wanpipe/ftmod_wanpipe.2010.vcxproj | 8 +-
libs/ilbc/src/iLBC_decode.c | 2 +
libs/openzap/mod_openzap/mod_openzap.c | 34 +-
libs/portaudio/build/msvc/portaudio.2010.vcxproj | 136 +-
.../sofia/libsofia_sip_ua_static.2010.vcxproj | 6 +
src/include/private/switch_core_pvt.h | 1 +
src/include/switch_core.h | 36 +
src/include/switch_cpp.h | 4 +
src/include/switch_ivr.h | 31 +
src/include/switch_module_interfaces.h | 9 +
src/include/switch_nat.h | 2 +-
.../applications/mod_callcenter/mod_callcenter.c | 9 +-
src/mod/applications/mod_commands/mod_commands.c | 47 +-
.../applications/mod_conference/mod_conference.c | 1 +
src/mod/applications/mod_dptools/mod_dptools.c | 36 +-
src/mod/applications/mod_fsk/mod_fsk.c | 4 +-
src/mod/applications/mod_redis/mod_redis.c | 10 +-
src/mod/applications/mod_spy/mod_spy.c | 6 +-
src/mod/applications/mod_voicemail/mod_voicemail.c | 16 +-
src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c | 364 +++-
src/mod/codecs/mod_opus/Makefile | 28 +
.../{mod_celt/mod_celt.c => mod_opus/mod_opus.c} | 153 +-
.../mod_dialplan_asterisk/mod_dialplan_asterisk.c | 6 +-
src/mod/endpoints/mod_dingaling/mod_dingaling.c | 4 +-
src/mod/endpoints/mod_khomp/src/khomp_pvt.cpp | 3 +-
src/mod/endpoints/mod_loopback/mod_loopback.c | 58 +-
src/mod/endpoints/mod_portaudio/mod_portaudio.c | 1046 +++++---
src/mod/endpoints/mod_skinny/skinny_protocol.h | 8 +
src/mod/endpoints/mod_skinny/skinny_server.c | 25 +
src/mod/endpoints/mod_skinny/skinny_tables.c | 1 +
src/mod/endpoints/mod_skinny/skinny_tables.h | 2 +-
src/mod/endpoints/mod_sofia/mod_sofia.c | 25 +-
src/mod/endpoints/mod_sofia/sofia.c | 11 +-
src/mod/endpoints/mod_sofia/sofia_glue.c | 27 +-
src/mod/endpoints/mod_sofia/sofia_presence.c | 62 +-
.../event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c | 396 ++--
.../mod_event_socket/mod_event_socket.c | 4 +-
src/mod/event_handlers/mod_snmp/FREESWITCH-MIB | 217 ++-
src/mod/event_handlers/mod_snmp/mod_snmp.c | 2 +-
src/mod/event_handlers/mod_snmp/subagent.c | 260 ++-
src/mod/event_handlers/mod_snmp/subagent.h | 57 +-
src/mod/formats/mod_file_string/mod_file_string.c | 2 +-
src/mod/languages/mod_lua/mod_lua_extra.c | 4 +-
src/mod/languages/mod_lua/mod_lua_extra.h | 4 +-
src/mod/languages/mod_lua/mod_lua_wrap.cpp | 50 +
.../languages/mod_managed/freeswitch_wrap.2010.cxx | 196 ++
src/mod/languages/mod_managed/freeswitch_wrap.cxx | 224 ++
src/mod/languages/mod_managed/managed/swig.2010.cs | 168 ++-
src/mod/languages/mod_managed/managed/swig.cs | 170 ++
.../languages/mod_spidermonkey/mod_spidermonkey.c | 13 +-
src/mod/xml_int/mod_xml_curl/mod_xml_curl.c | 4 +-
src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c | 6 +-
src/switch_channel.c | 58 +-
src/switch_console.c | 32 +-
src/switch_core.c | 49 +-
src/switch_core_asr.c | 53 +
src/switch_core_file.c | 2 +-
src/switch_core_session.c | 15 +
src/switch_core_sqldb.c | 71 +-
src/switch_cpp.cpp | 7 +
src/switch_event.c | 7 +-
src/switch_ivr_async.c | 83 +
src/switch_nat.c | 7 +
src/switch_rtp.c | 8 +-
src/switch_utils.c | 10 +-
src/switch_xml.c | 11 +-
src/switch_xml_config.c | 2 +-
support-d/prereq.sh | 2 +-
99 files changed, 7698 insertions(+), 2803 deletions(-)
create mode 100644 libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_relay.c
create mode 100644 src/mod/codecs/mod_opus/Makefile
copy src/mod/codecs/{mod_celt/mod_celt.c => mod_opus/mod_opus.c} (52%)
</pre>
<p>this email was generated because of /git/your-repo.git/hooks/post-receive by the file /git-core/contrib/hooks/post-receive-email<br />
For more info, see <a href="http://blog.chomperstomp.com/?p=630">http://blog.chomperstomp.com/?p=630</a>
-- <br />
FreeSWITCH Source</p>