*/
#include "openzap.h"
-#include "ss7_boost_client.h"
-#include "zap_ss7_boost.h"
+#include "sangoma_boost_client.h"
+#include "zap_sangoma_boost.h"
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
SFLAG_SENT_FINAL_RESPONSE = (1 << 1)
} sflag_t;
-typedef uint16_t ss7_boost_request_id_t;
+typedef uint16_t sangoma_boost_request_id_t;
/**
- * \brief SS7 boost request status
+ * \brief SANGOMA boost request status
*/
typedef enum {
BST_FREE,
BST_WAITING,
BST_READY,
BST_FAIL
-} ss7_boost_request_status_t;
+} sangoma_boost_request_status_t;
/**
- * \brief SS7 boost request structure
+ * \brief SANGOMA boost request structure
*/
typedef struct {
- ss7_boost_request_status_t status;
- ss7bc_short_event_t event;
+ sangoma_boost_request_status_t status;
+ sangomabc_short_event_t event;
zap_span_t *span;
zap_channel_t *zchan;
-} ss7_boost_request_t;
+} sangoma_boost_request_t;
//#define MAX_REQ_ID ZAP_MAX_PHYSICAL_SPANS_PER_LOGICAL_SPAN * ZAP_MAX_CHANNELS_PHYSICAL_SPAN
#define MAX_REQ_ID 6000
static uint16_t SETUP_GRID[ZAP_MAX_PHYSICAL_SPANS_PER_LOGICAL_SPAN+1][ZAP_MAX_CHANNELS_PHYSICAL_SPAN+1] = {{ 0 }};
-static ss7_boost_request_t OUTBOUND_REQUESTS[MAX_REQ_ID+1] = {{ 0 }};
+static sangoma_boost_request_t OUTBOUND_REQUESTS[MAX_REQ_ID+1] = {{ 0 }};
static zap_mutex_t *request_mutex = NULL;
static zap_mutex_t *signal_mutex = NULL;
* \param line Line number on request
* \return NULL if not found, channel otherwise
*/
-static void __release_request_id(ss7_boost_request_id_t r, const char *func, int line)
+static void __release_request_id(sangoma_boost_request_id_t r, const char *func, int line)
{
assert(r <= MAX_REQ_ID);
zap_mutex_lock(request_mutex);
}
#define release_request_id(r) __release_request_id(r, __FUNCTION__, __LINE__)
-static ss7_boost_request_id_t last_req = 0;
+static sangoma_boost_request_id_t last_req = 0;
/**
* \brief Gets the first available tank request ID
* \param line Line number on request
* \return 0 on failure, request ID on success
*/
-static ss7_boost_request_id_t __next_request_id(const char *func, int line)
+static sangoma_boost_request_id_t __next_request_id(const char *func, int line)
{
- ss7_boost_request_id_t r = 0, i = 0;
+ sangoma_boost_request_id_t r = 0, i = 0;
int found=0;
zap_mutex_lock(request_mutex);
/**
* \brief Finds the channel that triggered an event
* \param span Span where to search the channel
- * \param event SS7 event
+ * \param event SANGOMA event
* \param force Do not wait for the channel to be available if in use
* \return NULL if not found, channel otherwise
*/
-static zap_channel_t *find_zchan(zap_span_t *span, ss7bc_short_event_t *event, int force)
+static zap_channel_t *find_zchan(zap_span_t *span, sangomabc_short_event_t *event, int force)
{
int i;
zap_channel_t *zchan = NULL;
/**
- * \brief Requests an ss7 boost channel on a span (outgoing call)
+ * \brief Requests an sangoma boost channel on a span (outgoing call)
* \param span Span where to get a channel
* \param chan_id Specific channel to get (0 for any)
* \param direction Call direction
* \param zchan Channel to initialise
* \return Success or failure
*/
-static ZIO_CHANNEL_REQUEST_FUNCTION(ss7_boost_channel_request)
+static ZIO_CHANNEL_REQUEST_FUNCTION(sangoma_boost_channel_request)
{
- zap_ss7_boost_data_t *ss7_boost_data = span->signal_data;
+ zap_sangoma_boost_data_t *sangoma_boost_data = span->signal_data;
zap_status_t status = ZAP_FAIL;
- ss7_boost_request_id_t r;
- ss7bc_event_t event = {0};
+ sangoma_boost_request_id_t r;
+ sangomabc_event_t event = {0};
int sanity = 5000;
- ss7_boost_request_status_t st;
+ sangoma_boost_request_status_t st;
char ani[128] = "";
char *gr = NULL;
uint32_t count = 0;
return ZAP_FAIL;
}
- ss7bc_call_init(&event, caller_data->cid_num.digits, ani, r);
+ sangomabc_call_init(&event, caller_data->cid_num.digits, ani, r);
if (gr && *(gr+1)) {
OUTBOUND_REQUESTS[r].status = BST_WAITING;
OUTBOUND_REQUESTS[r].span = span;
- if (ss7bc_connection_write(&ss7_boost_data->mcon, &event) <= 0) {
+ if (sangomabc_connection_write(&sangoma_boost_data->mcon, &event) <= 0) {
zap_log(ZAP_LOG_CRIT, "Failed to tx on ISUP socket [%s]\n", strerror(errno));
status = ZAP_FAIL;
*zchan = NULL;
} else if (st != BST_READY) {
assert(r <= MAX_REQ_ID);
nack_map[r] = 1;
- ss7bc_exec_command(&ss7_boost_data->mcon,
+ sangomabc_exec_command(&sangoma_boost_data->mcon,
0,
0,
r,
}
/**
- * \brief Starts an ss7 boost channel (outgoing call)
+ * \brief Starts an sangoma boost channel (outgoing call)
* \param zchan Channel to initiate call on
* \return Success
*/
-static ZIO_CHANNEL_OUTGOING_CALL_FUNCTION(ss7_boost_outgoing_call)
+static ZIO_CHANNEL_OUTGOING_CALL_FUNCTION(sangoma_boost_outgoing_call)
{
zap_status_t status = ZAP_SUCCESS;
/**
* \brief Handler for call start ack event
- * \param mcon ss7 boost connection
+ * \param mcon sangoma boost connection
* \param event Event to handle
*/
-static void handle_call_start_ack(ss7bc_connection_t *mcon, ss7bc_short_event_t *event)
+static void handle_call_start_ack(sangomabc_connection_t *mcon, sangomabc_short_event_t *event)
{
zap_channel_t *zchan;
zap_log(ZAP_LOG_CRIT, "START ACK CANT FIND A CHAN %d:%d\n", event->span+1,event->chan+1);
- ss7bc_exec_command(mcon,
+ sangomabc_exec_command(mcon,
event->span,
event->chan,
event->call_setup_id,
/**
* \brief Handler for call done event
* \param span Span where event was fired
- * \param mcon ss7 boost connection
+ * \param mcon sangoma boost connection
* \param event Event to handle
*/
-static void handle_call_done(zap_span_t *span, ss7bc_connection_t *mcon, ss7bc_short_event_t *event)
+static void handle_call_done(zap_span_t *span, sangomabc_connection_t *mcon, sangomabc_short_event_t *event)
{
zap_channel_t *zchan;
int r = 0;
/**
* \brief Handler for call start nack event
* \param span Span where event was fired
- * \param mcon ss7 boost connection
+ * \param mcon sangoma boost connection
* \param event Event to handle
*/
-static void handle_call_start_nack(zap_span_t *span, ss7bc_connection_t *mcon, ss7bc_short_event_t *event)
+static void handle_call_start_nack(zap_span_t *span, sangomabc_connection_t *mcon, sangomabc_short_event_t *event)
{
zap_channel_t *zchan;
if (event->call_setup_id) {
- ss7bc_exec_command(mcon,
+ sangomabc_exec_command(mcon,
0,
0,
event->call_setup_id,
/* nobody else will do it so we have to do it ourselves */
- ss7bc_exec_command(mcon,
+ sangomabc_exec_command(mcon,
event->span,
event->chan,
0,
/**
* \brief Handler for call stop event
* \param span Span where event was fired
- * \param mcon ss7 boost connection
+ * \param mcon sangoma boost connection
* \param event Event to handle
*/
-static void handle_call_stop(zap_span_t *span, ss7bc_connection_t *mcon, ss7bc_short_event_t *event)
+static void handle_call_stop(zap_span_t *span, sangomabc_connection_t *mcon, sangomabc_short_event_t *event)
{
zap_channel_t *zchan;
zap_set_sflag_locked(zchan, SFLAG_SENT_FINAL_RESPONSE);
}
- ss7bc_exec_command(mcon,
+ sangomabc_exec_command(mcon,
event->span,
event->chan,
0,
/**
* \brief Handler for call answer event
* \param span Span where event was fired
- * \param mcon ss7 boost connection
+ * \param mcon sangoma boost connection
* \param event Event to handle
*/
-static void handle_call_answer(zap_span_t *span, ss7bc_connection_t *mcon, ss7bc_short_event_t *event)
+static void handle_call_answer(zap_span_t *span, sangomabc_connection_t *mcon, sangomabc_short_event_t *event)
{
zap_channel_t *zchan;
/**
* \brief Handler for call start event
* \param span Span where event was fired
- * \param mcon ss7 boost connection
+ * \param mcon sangoma boost connection
* \param event Event to handle
*/
-static void handle_call_start(zap_span_t *span, ss7bc_connection_t *mcon, ss7bc_event_t *event)
+static void handle_call_start(zap_span_t *span, sangomabc_connection_t *mcon, sangomabc_event_t *event)
{
zap_channel_t *zchan;
- if (!(zchan = find_zchan(span, (ss7bc_short_event_t*)event, 0))) {
+ if (!(zchan = find_zchan(span, (sangomabc_short_event_t*)event, 0))) {
goto error;
}
zap_log(ZAP_LOG_CRIT, "START CANT FIND A CHAN %d:%d\n", event->span+1,event->chan+1);
- ss7bc_exec_command(mcon,
+ sangomabc_exec_command(mcon,
event->span,
event->chan,
0,
/**
* \brief Handler for heartbeat event
- * \param mcon ss7 boost connection
+ * \param mcon sangoma boost connection
* \param event Event to handle
*/
-static void handle_heartbeat(ss7bc_connection_t *mcon, ss7bc_short_event_t *event)
+static void handle_heartbeat(sangomabc_connection_t *mcon, sangomabc_short_event_t *event)
{
int err;
- err = ss7bc_connection_writep(mcon, (ss7bc_event_t*)event);
+ err = sangomabc_connection_writep(mcon, (sangomabc_event_t*)event);
if (err <= 0) {
zap_log(ZAP_LOG_CRIT, "Failed to tx on ISUP socket [%s]: %s\n", strerror(errno));
/**
* \brief Handler for restart ack event
- * \param mcon ss7 boost connection
+ * \param mcon sangoma boost connection
* \param span Span where event was fired
* \param event Event to handle
*/
-static void handle_restart_ack(ss7bc_connection_t *mcon, zap_span_t *span, ss7bc_short_event_t *event)
+static void handle_restart_ack(sangomabc_connection_t *mcon, zap_span_t *span, sangomabc_short_event_t *event)
{
zap_log(ZAP_LOG_DEBUG, "RECV RESTART ACK\n");
}
/**
* \brief Handler for restart event
- * \param mcon ss7 boost connection
+ * \param mcon sangoma boost connection
* \param span Span where event was fired
* \param event Event to handle
*/
-static void handle_restart(ss7bc_connection_t *mcon, zap_span_t *span, ss7bc_short_event_t *event)
+static void handle_restart(sangomabc_connection_t *mcon, zap_span_t *span, sangomabc_short_event_t *event)
{
- zap_ss7_boost_data_t *ss7_boost_data = span->signal_data;
+ zap_sangoma_boost_data_t *sangoma_boost_data = span->signal_data;
mcon->rxseq_reset = 0;
- zap_set_flag((&ss7_boost_data->mcon), MSU_FLAG_DOWN);
+ zap_set_flag((&sangoma_boost_data->mcon), MSU_FLAG_DOWN);
zap_set_flag_locked(span, ZAP_SPAN_SUSPENDED);
- zap_set_flag(ss7_boost_data, ZAP_SS7_BOOST_RESTARTING);
+ zap_set_flag(sangoma_boost_data, ZAP_SANGOMA_BOOST_RESTARTING);
mcon->hb_elapsed = 0;
}
/**
* \brief Handler for incoming digit event
- * \param mcon ss7 boost connection
+ * \param mcon sangoma boost connection
* \param span Span where event was fired
* \param event Event to handle
*/
-static void handle_incoming_digit(ss7bc_connection_t *mcon, zap_span_t *span, ss7bc_event_t *event)
+static void handle_incoming_digit(sangomabc_connection_t *mcon, zap_span_t *span, sangomabc_event_t *event)
{
zap_channel_t *zchan = NULL;
char digits[MAX_DIALED_DIGITS + 2] = "";
- if (!(zchan = find_zchan(span, (ss7bc_short_event_t *)event, 1))) {
+ if (!(zchan = find_zchan(span, (sangomabc_short_event_t *)event, 1))) {
zap_log(ZAP_LOG_ERROR, "Invalid channel\n");
return;
}
}
/**
- * \brief Handler for ss7 boost event
+ * \brief Handler for sangoma boost event
* \param span Span where event was fired
- * \param mcon ss7 boost connection
+ * \param mcon sangoma boost connection
* \param event Event to handle
*/
-static int parse_ss7_event(zap_span_t *span, ss7bc_connection_t *mcon, ss7bc_short_event_t *event)
+static int parse_sangoma_event(zap_span_t *span, sangomabc_connection_t *mcon, sangomabc_short_event_t *event)
{
zap_mutex_lock(signal_mutex);
switch(event->event_id) {
case SIGBOOST_EVENT_CALL_START:
- handle_call_start(span, mcon, (ss7bc_event_t*)event);
+ handle_call_start(span, mcon, (sangomabc_event_t*)event);
break;
case SIGBOOST_EVENT_CALL_STOPPED:
handle_call_stop(span, mcon, event);
//handle_gap_abate(event);
break;
case SIGBOOST_EVENT_DIGIT_IN:
- handle_incoming_digit(mcon, span, (ss7bc_event_t*)event);
+ handle_incoming_digit(mcon, span, (sangomabc_event_t*)event);
break;
default:
- zap_log(ZAP_LOG_WARNING, "No handler implemented for [%s]\n", ss7bc_event_id_name(event->event_id));
+ zap_log(ZAP_LOG_WARNING, "No handler implemented for [%s]\n", sangomabc_event_id_name(event->event_id));
break;
}
static __inline__ void state_advance(zap_channel_t *zchan)
{
- zap_ss7_boost_data_t *ss7_boost_data = zchan->span->signal_data;
- ss7bc_connection_t *mcon = &ss7_boost_data->mcon;
+ zap_sangoma_boost_data_t *sangoma_boost_data = zchan->span->signal_data;
+ sangomabc_connection_t *mcon = &sangoma_boost_data->mcon;
zap_sigmsg_t sig;
zap_status_t status;
{
if (zap_test_flag(zchan, ZAP_CHANNEL_OUTBOUND)) {
sig.event_id = ZAP_SIGEVENT_PROGRESS_MEDIA;
- if ((status = ss7_boost_data->signal_cb(&sig) != ZAP_SUCCESS)) {
+ if ((status = sangoma_boost_data->signal_cb(&sig) != ZAP_SUCCESS)) {
zap_set_state_locked(zchan, ZAP_CHANNEL_STATE_HANGUP);
}
} else {
- ss7bc_exec_command(mcon,
+ sangomabc_exec_command(mcon,
zchan->physical_span_id-1,
zchan->physical_chan_id-1,
0,
{
if (!zap_test_flag(zchan, ZAP_CHANNEL_OUTBOUND)) {
sig.event_id = ZAP_SIGEVENT_START;
- if ((status = ss7_boost_data->signal_cb(&sig) != ZAP_SUCCESS)) {
+ if ((status = sangoma_boost_data->signal_cb(&sig) != ZAP_SUCCESS)) {
zap_set_state_locked(zchan, ZAP_CHANNEL_STATE_HANGUP);
}
}
case ZAP_CHANNEL_STATE_RESTART:
{
sig.event_id = ZAP_SIGEVENT_RESTART;
- status = ss7_boost_data->signal_cb(&sig);
+ status = sangoma_boost_data->signal_cb(&sig);
zap_set_sflag_locked(zchan, SFLAG_SENT_FINAL_RESPONSE);
zap_set_state_locked(zchan, ZAP_CHANNEL_STATE_DOWN);
{
if (zap_test_flag(zchan, ZAP_CHANNEL_OUTBOUND)) {
sig.event_id = ZAP_SIGEVENT_UP;
- if ((status = ss7_boost_data->signal_cb(&sig) != ZAP_SUCCESS)) {
+ if ((status = sangoma_boost_data->signal_cb(&sig) != ZAP_SUCCESS)) {
zap_set_state_locked(zchan, ZAP_CHANNEL_STATE_HANGUP);
}
} else {
if (!(zap_test_flag(zchan, ZAP_CHANNEL_PROGRESS) || zap_test_flag(zchan, ZAP_CHANNEL_MEDIA))) {
- ss7bc_exec_command(mcon,
+ sangomabc_exec_command(mcon,
zchan->physical_span_id-1,
zchan->physical_chan_id-1,
0,
0);
}
- ss7bc_exec_command(mcon,
+ sangomabc_exec_command(mcon,
zchan->physical_span_id-1,
zchan->physical_chan_id-1,
0,
zap_set_sflag_locked(zchan, SFLAG_SENT_FINAL_RESPONSE);
if (zap_test_flag(zchan, ZAP_CHANNEL_ANSWERED) || zap_test_flag(zchan, ZAP_CHANNEL_PROGRESS) || zap_test_flag(zchan, ZAP_CHANNEL_MEDIA)) {
- ss7bc_exec_command(mcon,
+ sangomabc_exec_command(mcon,
zchan->physical_span_id-1,
zchan->physical_chan_id-1,
0,
SIGBOOST_EVENT_CALL_STOPPED,
zchan->caller_data.hangup_cause);
} else {
- ss7bc_exec_command(mcon,
+ sangomabc_exec_command(mcon,
zchan->physical_span_id-1,
zchan->physical_chan_id-1,
0,
case ZAP_CHANNEL_STATE_CANCEL:
{
sig.event_id = ZAP_SIGEVENT_STOP;
- status = ss7_boost_data->signal_cb(&sig);
+ status = sangoma_boost_data->signal_cb(&sig);
zap_set_state_locked(zchan, ZAP_CHANNEL_STATE_DOWN);
zap_set_sflag_locked(zchan, SFLAG_SENT_FINAL_RESPONSE);
- ss7bc_exec_command(mcon,
+ sangomabc_exec_command(mcon,
zchan->physical_span_id-1,
zchan->physical_chan_id-1,
0,
case ZAP_CHANNEL_STATE_TERMINATING:
{
sig.event_id = ZAP_SIGEVENT_STOP;
- status = ss7_boost_data->signal_cb(&sig);
+ status = sangoma_boost_data->signal_cb(&sig);
zap_set_state_locked(zchan, ZAP_CHANNEL_STATE_HANGUP_COMPLETE);
zap_set_sflag_locked(zchan, SFLAG_SENT_FINAL_RESPONSE);
- ss7bc_exec_command(mcon,
+ sangomabc_exec_command(mcon,
zchan->physical_span_id-1,
zchan->physical_chan_id-1,
0,
*/
static __inline__ void check_state(zap_span_t *span)
{
- zap_ss7_boost_data_t *ss7_boost_data = span->signal_data;
+ zap_sangoma_boost_data_t *sangoma_boost_data = span->signal_data;
int susp = zap_test_flag(span, ZAP_SPAN_SUSPENDED);
if (susp && zap_check_state_all(span, ZAP_CHANNEL_STATE_DOWN)) {
}
}
- if (zap_test_flag(ss7_boost_data, ZAP_SS7_BOOST_RESTARTING)) {
+ if (zap_test_flag(sangoma_boost_data, ZAP_SANGOMA_BOOST_RESTARTING)) {
if (zap_check_state_all(span, ZAP_CHANNEL_STATE_DOWN)) {
- ss7bc_exec_command(&ss7_boost_data->mcon,
+ sangomabc_exec_command(&sangoma_boost_data->mcon,
0,
0,
-1,
SIGBOOST_EVENT_SYSTEM_RESTART_ACK,
0);
- zap_clear_flag(ss7_boost_data, ZAP_SS7_BOOST_RESTARTING);
+ zap_clear_flag(sangoma_boost_data, ZAP_SANGOMA_BOOST_RESTARTING);
zap_clear_flag_locked(span, ZAP_SPAN_SUSPENDED);
- zap_clear_flag((&ss7_boost_data->mcon), MSU_FLAG_DOWN);
- ss7_boost_data->mcon.hb_elapsed = 0;
+ zap_clear_flag((&sangoma_boost_data->mcon), MSU_FLAG_DOWN);
+ sangoma_boost_data->mcon.hb_elapsed = 0;
init_outgoing_array();
}
}
}
/**
- * \brief Main thread function for ss7 boost span (monitor)
+ * \brief Main thread function for sangoma boost span (monitor)
* \param me Current thread
* \param obj Span to run in this thread
*/
-static void *zap_ss7_events_run(zap_thread_t *me, void *obj)
+static void *zap_sangoma_events_run(zap_thread_t *me, void *obj)
{
zap_span_t *span = (zap_span_t *) obj;
- zap_ss7_boost_data_t *ss7_boost_data = span->signal_data;
+ zap_sangoma_boost_data_t *sangoma_boost_data = span->signal_data;
- while (zap_test_flag(ss7_boost_data, ZAP_SS7_BOOST_RUNNING) && zap_running()) {
+ while (zap_test_flag(sangoma_boost_data, ZAP_SANGOMA_BOOST_RUNNING) && zap_running()) {
check_events(span,100);
}
}
/**
- * \brief Main thread function for ss7 boost span (monitor)
+ * \brief Main thread function for sangoma boost span (monitor)
* \param me Current thread
* \param obj Span to run in this thread
*/
-static void *zap_ss7_boost_run(zap_thread_t *me, void *obj)
+static void *zap_sangoma_boost_run(zap_thread_t *me, void *obj)
{
zap_span_t *span = (zap_span_t *) obj;
- zap_ss7_boost_data_t *ss7_boost_data = span->signal_data;
- ss7bc_connection_t *mcon, *pcon;
+ zap_sangoma_boost_data_t *sangoma_boost_data = span->signal_data;
+ sangomabc_connection_t *mcon, *pcon;
uint32_t ms = 10; //, too_long = 20000;
- ss7_boost_data->pcon = ss7_boost_data->mcon;
+ sangoma_boost_data->pcon = sangoma_boost_data->mcon;
- if (ss7bc_connection_open(&ss7_boost_data->mcon,
- ss7_boost_data->mcon.cfg.local_ip,
- ss7_boost_data->mcon.cfg.local_port,
- ss7_boost_data->mcon.cfg.remote_ip,
- ss7_boost_data->mcon.cfg.remote_port) < 0) {
- zap_log(ZAP_LOG_DEBUG, "Error: Opening MCON Socket [%d] %s\n", ss7_boost_data->mcon.socket, strerror(errno));
+ if (sangomabc_connection_open(&sangoma_boost_data->mcon,
+ sangoma_boost_data->mcon.cfg.local_ip,
+ sangoma_boost_data->mcon.cfg.local_port,
+ sangoma_boost_data->mcon.cfg.remote_ip,
+ sangoma_boost_data->mcon.cfg.remote_port) < 0) {
+ zap_log(ZAP_LOG_DEBUG, "Error: Opening MCON Socket [%d] %s\n", sangoma_boost_data->mcon.socket, strerror(errno));
goto end;
}
- if (ss7bc_connection_open(&ss7_boost_data->pcon,
- ss7_boost_data->pcon.cfg.local_ip,
- ++ss7_boost_data->pcon.cfg.local_port,
- ss7_boost_data->pcon.cfg.remote_ip,
- ++ss7_boost_data->pcon.cfg.remote_port) < 0) {
- zap_log(ZAP_LOG_DEBUG, "Error: Opening PCON Socket [%d] %s\n", ss7_boost_data->pcon.socket, strerror(errno));
+ if (sangomabc_connection_open(&sangoma_boost_data->pcon,
+ sangoma_boost_data->pcon.cfg.local_ip,
+ ++sangoma_boost_data->pcon.cfg.local_port,
+ sangoma_boost_data->pcon.cfg.remote_ip,
+ ++sangoma_boost_data->pcon.cfg.remote_port) < 0) {
+ zap_log(ZAP_LOG_DEBUG, "Error: Opening PCON Socket [%d] %s\n", sangoma_boost_data->pcon.socket, strerror(errno));
goto end;
}
- mcon = &ss7_boost_data->mcon;
- pcon = &ss7_boost_data->pcon;
+ mcon = &sangoma_boost_data->mcon;
+ pcon = &sangoma_boost_data->pcon;
init_outgoing_array();
- ss7bc_exec_commandp(pcon,
+ sangomabc_exec_commandp(pcon,
0,
0,
-1,
0);
zap_set_flag(mcon, MSU_FLAG_DOWN);
- while (zap_test_flag(ss7_boost_data, ZAP_SS7_BOOST_RUNNING)) {
+ while (zap_test_flag(sangoma_boost_data, ZAP_SANGOMA_BOOST_RUNNING)) {
fd_set rfds, efds;
struct timeval tv = { 0, ms * 1000 };
int max, activity, i = 0;
- ss7bc_event_t *event = NULL;
+ sangomabc_event_t *event = NULL;
if (!zap_running()) {
- ss7bc_exec_commandp(pcon,
+ sangomabc_exec_commandp(pcon,
0,
0,
-1,
}
if (FD_ISSET(pcon->socket, &rfds)) {
- while ((event = ss7bc_connection_readp(pcon, i))) {
- parse_ss7_event(span, pcon, (ss7bc_short_event_t*)event);
+ while ((event = sangomabc_connection_readp(pcon, i))) {
+ parse_sangoma_event(span, pcon, (sangomabc_short_event_t*)event);
i++;
}
}
i=0;
if (FD_ISSET(mcon->socket, &rfds)) {
- if ((event = ss7bc_connection_read(mcon, i))) {
- parse_ss7_event(span, mcon, (ss7bc_short_event_t*)event);
+ if ((event = sangomabc_connection_read(mcon, i))) {
+ parse_sangoma_event(span, mcon, (sangomabc_short_event_t*)event);
i++;
}
}
zap_log(ZAP_LOG_CRIT, "Lost Heartbeat!\n");
zap_set_flag_locked(span, ZAP_SPAN_SUSPENDED);
zap_set_flag(mcon, MSU_FLAG_DOWN);
- ss7bc_exec_commandp(pcon,
+ sangomabc_exec_commandp(pcon,
0,
0,
-1,
end:
- ss7bc_connection_close(&ss7_boost_data->mcon);
- ss7bc_connection_close(&ss7_boost_data->pcon);
+ sangomabc_connection_close(&sangoma_boost_data->mcon);
+ sangomabc_connection_close(&sangoma_boost_data->pcon);
- zap_clear_flag(ss7_boost_data, ZAP_SS7_BOOST_RUNNING);
+ zap_clear_flag(sangoma_boost_data, ZAP_SANGOMA_BOOST_RUNNING);
- zap_log(ZAP_LOG_DEBUG, "SS7_BOOST thread ended.\n");
+ zap_log(ZAP_LOG_DEBUG, "SANGOMA_BOOST thread ended.\n");
return NULL;
}
/**
- * \brief Loads ss7 boost signaling module
+ * \brief Loads sangoma boost signaling module
* \param zio Openzap IO interface
* \return Success
*/
-static ZIO_SIG_LOAD_FUNCTION(zap_ss7_boost_init)
+static ZIO_SIG_LOAD_FUNCTION(zap_sangoma_boost_init)
{
zap_mutex_create(&request_mutex);
zap_mutex_create(&signal_mutex);
return ZAP_SUCCESS;
}
-static zap_status_t zap_ss7_boost_start(zap_span_t *span)
+static zap_status_t zap_sangoma_boost_start(zap_span_t *span)
{
int err;
- zap_ss7_boost_data_t *ss7_boost_data = span->signal_data;
- zap_set_flag(ss7_boost_data, ZAP_SS7_BOOST_RUNNING);
- err=zap_thread_create_detached(zap_ss7_boost_run, span);
+ zap_sangoma_boost_data_t *sangoma_boost_data = span->signal_data;
+ zap_set_flag(sangoma_boost_data, ZAP_SANGOMA_BOOST_RUNNING);
+ err=zap_thread_create_detached(zap_sangoma_boost_run, span);
if (err) {
- zap_clear_flag(ss7_boost_data, ZAP_SS7_BOOST_RUNNING);
+ zap_clear_flag(sangoma_boost_data, ZAP_SANGOMA_BOOST_RUNNING);
return err;
}
// launch the events thread to handle HW DTMF and possibly
// other events in the future
- err=zap_thread_create_detached(zap_ss7_events_run, span);
+ err=zap_thread_create_detached(zap_sangoma_events_run, span);
if (err) {
- zap_clear_flag(ss7_boost_data, ZAP_SS7_BOOST_RUNNING);
+ zap_clear_flag(sangoma_boost_data, ZAP_SANGOMA_BOOST_RUNNING);
}
return err;
}
};
/**
- * \brief Initialises an ss7 boost span from configuration variables
+ * \brief Initialises an sangoma boost span from configuration variables
* \param span Span to configure
* \param sig_cb Callback function for event signals
* \param ap List of configuration variables
* \return Success or failure
*/
-static ZIO_SIG_CONFIGURE_FUNCTION(zap_ss7_boost_configure_span)
+static ZIO_SIG_CONFIGURE_FUNCTION(zap_sangoma_boost_configure_span)
{
- zap_ss7_boost_data_t *ss7_boost_data = NULL;
+ zap_sangoma_boost_data_t *sangoma_boost_data = NULL;
const char *local_ip = "127.0.0.65", *remote_ip = "127.0.0.66";
int local_port = 53000, remote_port = 53000;
char *var, *val;
return ZAP_FAIL;
}
- ss7_boost_data = malloc(sizeof(*ss7_boost_data));
- assert(ss7_boost_data);
- memset(ss7_boost_data, 0, sizeof(*ss7_boost_data));
+ sangoma_boost_data = malloc(sizeof(*sangoma_boost_data));
+ assert(sangoma_boost_data);
+ memset(sangoma_boost_data, 0, sizeof(*sangoma_boost_data));
- zap_set_string(ss7_boost_data->mcon.cfg.local_ip, local_ip);
- ss7_boost_data->mcon.cfg.local_port = local_port;
- zap_set_string(ss7_boost_data->mcon.cfg.remote_ip, remote_ip);
- ss7_boost_data->mcon.cfg.remote_port = remote_port;
- ss7_boost_data->signal_cb = sig_cb;
- span->start = zap_ss7_boost_start;
- span->signal_data = ss7_boost_data;
- span->signal_type = ZAP_SIGTYPE_SS7BOOST;
- span->outgoing_call = ss7_boost_outgoing_call;
- span->channel_request = ss7_boost_channel_request;
+ zap_set_string(sangoma_boost_data->mcon.cfg.local_ip, local_ip);
+ sangoma_boost_data->mcon.cfg.local_port = local_port;
+ zap_set_string(sangoma_boost_data->mcon.cfg.remote_ip, remote_ip);
+ sangoma_boost_data->mcon.cfg.remote_port = remote_port;
+ sangoma_boost_data->signal_cb = sig_cb;
+ span->start = zap_sangoma_boost_start;
+ span->signal_data = sangoma_boost_data;
+ span->signal_type = ZAP_SIGTYPE_SANGOMABOOST;
+ span->outgoing_call = sangoma_boost_outgoing_call;
+ span->channel_request = sangoma_boost_channel_request;
span->state_map = &boost_state_map;
zap_set_flag_locked(span, ZAP_SPAN_SUSPENDED);
}
/**
- * \brief Openzap ss7 boost signaling module definition
+ * \brief Openzap sangoma boost signaling module definition
*/
zap_module_t zap_module = {
- "ss7_boost",
+ "sangoma_boost",
NULL,
NULL,
- zap_ss7_boost_init,
- zap_ss7_boost_configure_span,
+ zap_sangoma_boost_init,
+ zap_sangoma_boost_configure_span,
NULL
};
#endif
#include "openzap.h"
-#include <ss7_boost_client.h>
+#include <sangoma_boost_client.h>
#ifndef HAVE_GETHOSTBYNAME_R
int *__h_errnop);
#endif
-struct ss7bc_map {
+struct sangomabc_map {
uint32_t event_id;
const char *name;
};
-static struct ss7bc_map ss7bc_table[] = {
+static struct sangomabc_map sangomabc_table[] = {
{SIGBOOST_EVENT_CALL_START, "CALL_START"},
{SIGBOOST_EVENT_CALL_START_ACK, "CALL_START_ACK"},
{SIGBOOST_EVENT_CALL_START_NACK, "CALL_START_NACK"},
-static void ss7bc_print_event_call(ss7bc_connection_t *mcon, ss7bc_event_t *event, int priority, int dir, const char *file, const char *func, int line)
+static void sangomabc_print_event_call(sangomabc_connection_t *mcon, sangomabc_event_t *event, int priority, int dir, const char *file, const char *func, int line)
{
if (event->event_id == SIGBOOST_EVENT_HEARTBEAT)
return;
zap_log(file, func, line, ZAP_LOG_LEVEL_WARNING, "%s EVENT: %s:(%X) [w%dg%d] CSid=%i Seq=%i Cn=[%s] Cd=[%s] Ci=[%s]\n",
dir ? "TX":"RX",
- ss7bc_event_id_name(event->event_id),
+ sangomabc_event_id_name(event->event_id),
event->event_id,
event->span+1,
event->chan+1,
);
}
-static void ss7bc_print_event_short(ss7bc_connection_t *mcon, ss7bc_short_event_t *event, int priority, int dir, const char *file, const char *func, int line)
+static void sangomabc_print_event_short(sangomabc_connection_t *mcon, sangomabc_short_event_t *event, int priority, int dir, const char *file, const char *func, int line)
{
if (event->event_id == SIGBOOST_EVENT_HEARTBEAT)
return;
zap_log(file, func, line, ZAP_LOG_LEVEL_WARNING, "%s EVENT (%s): %s:(%X) [w%dg%d] Rc=%i CSid=%i Seq=%i \n",
dir ? "TX":"RX",
priority ? "P":"N",
- ss7bc_event_id_name(event->event_id),
+ sangomabc_event_id_name(event->event_id),
event->event_id,
event->span+1,
event->chan+1,
}
-static int create_conn_socket(ss7bc_connection_t *mcon, char *local_ip, int local_port, char *ip, int port)
+static int create_conn_socket(sangomabc_connection_t *mcon, char *local_ip, int local_port, char *ip, int port)
{
int rc;
struct hostent *result, *local_result;
return mcon->socket;
}
-int ss7bc_connection_close(ss7bc_connection_t *mcon)
+int sangomabc_connection_close(sangomabc_connection_t *mcon)
{
if (mcon->socket > -1) {
close(mcon->socket);
return 0;
}
-int ss7bc_connection_open(ss7bc_connection_t *mcon, char *local_ip, int local_port, char *ip, int port)
+int sangomabc_connection_open(sangomabc_connection_t *mcon, char *local_ip, int local_port, char *ip, int port)
{
create_conn_socket(mcon, local_ip, local_port, ip, port);
return mcon->socket;
}
-int ss7bc_exec_command(ss7bc_connection_t *mcon, int span, int chan, int id, int cmd, int cause)
+int sangomabc_exec_command(sangomabc_connection_t *mcon, int span, int chan, int id, int cmd, int cause)
{
- ss7bc_short_event_t oevent;
+ sangomabc_short_event_t oevent;
int retry = 5;
- ss7bc_event_init(&oevent, cmd, chan, span);
+ sangomabc_event_init(&oevent, cmd, chan, span);
oevent.release_cause = cause;
if (cmd == SIGBOOST_EVENT_SYSTEM_RESTART || cmd == SIGBOOST_EVENT_SYSTEM_RESTART_ACK) {
oevent.call_setup_id = id;
}
- while (ss7bc_connection_write(mcon, (ss7bc_event_t*)&oevent) <= 0) {
+ while (sangomabc_connection_write(mcon, (sangomabc_event_t*)&oevent) <= 0) {
if (--retry <= 0) {
zap_log(ZAP_LOG_CRIT, "Failed to tx on ISUP socket: %s\n", strerror(errno));
return -1;
}
-int ss7bc_exec_commandp(ss7bc_connection_t *pcon, int span, int chan, int id, int cmd, int cause)
+int sangomabc_exec_commandp(sangomabc_connection_t *pcon, int span, int chan, int id, int cmd, int cause)
{
- ss7bc_short_event_t oevent;
+ sangomabc_short_event_t oevent;
int retry = 5;
- ss7bc_event_init(&oevent, cmd, chan, span);
+ sangomabc_event_init(&oevent, cmd, chan, span);
oevent.release_cause = cause;
if (id >= 0) {
oevent.call_setup_id = id;
}
- while (ss7bc_connection_writep(pcon, (ss7bc_event_t*)&oevent) <= 0) {
+ while (sangomabc_connection_writep(pcon, (sangomabc_event_t*)&oevent) <= 0) {
if (--retry <= 0) {
zap_log(ZAP_LOG_CRIT, "Failed to tx on ISUP socket: %s\n", strerror(errno));
return -1;
return 0;
}
-ss7bc_event_t *__ss7bc_connection_read(ss7bc_connection_t *mcon, int iteration, const char *file, const char *func, int line)
+sangomabc_event_t *__sangomabc_connection_read(sangomabc_connection_t *mcon, int iteration, const char *file, const char *func, int line)
{
unsigned int fromlen = sizeof(struct sockaddr_in);
int bytes = 0;
} else if ((bytes >= MIN_SIZE_CALLSTART_MSG) && boost_full_event(mcon->event.event_id)) {
msg_ok=1;
- } else if (bytes == sizeof(ss7bc_short_event_t)) {
+ } else if (bytes == sizeof(sangomabc_short_event_t)) {
msg_ok=1;
} else {
if (msg_ok){
- if (ss7bc_test_flag(mcon, MSU_FLAG_DOWN)) {
+ if (sangomabc_test_flag(mcon, MSU_FLAG_DOWN)) {
if (mcon->event.event_id != SIGBOOST_EVENT_SYSTEM_RESTART &&
mcon->event.event_id != SIGBOOST_EVENT_SYSTEM_RESTART_ACK &&
mcon->event.event_id != SIGBOOST_EVENT_HEARTBEAT) {
zap_log(file, func, line, ZAP_LOG_LEVEL_WARNING, "Not reading packets when connection is down. [%s]\n",
- ss7bc_event_id_name(mcon->event.event_id));
+ sangomabc_event_id_name(mcon->event.event_id));
return NULL;
}
}
if (boost_full_event(mcon->event.event_id)) {
- ss7bc_print_event_call(mcon, &mcon->event, 0, 0, file, func, line);
+ sangomabc_print_event_call(mcon, &mcon->event, 0, 0, file, func, line);
} else {
- ss7bc_print_event_short(mcon, (ss7bc_short_event_t*)&mcon->event, 0, 0, file, func, line);
+ sangomabc_print_event_short(mcon, (sangomabc_short_event_t*)&mcon->event, 0, 0, file, func, line);
}
#if 0
return NULL;
}
-ss7bc_event_t *__ss7bc_connection_readp(ss7bc_connection_t *mcon, int iteration, const char *file, const char *func, int line)
+sangomabc_event_t *__sangomabc_connection_readp(sangomabc_connection_t *mcon, int iteration, const char *file, const char *func, int line)
{
unsigned int fromlen = sizeof(struct sockaddr_in);
int bytes = 0;
zap_log(ZAP_LOG_CRIT, "Invalid Boost Version %i Expecting %i\n",mcon->event.version, SIGBOOST_VERSION);
}
- if (bytes == sizeof(ss7bc_short_event_t)) {
+ if (bytes == sizeof(sangomabc_short_event_t)) {
if (boost_full_event(mcon->event.event_id)) {
- ss7bc_print_event_call(mcon, &mcon->event, 1, 0, file, func, line);
+ sangomabc_print_event_call(mcon, &mcon->event, 1, 0, file, func, line);
} else {
- ss7bc_print_event_short(mcon, (ss7bc_short_event_t*)&mcon->event, 1, 0, file, func, line);
+ sangomabc_print_event_short(mcon, (sangomabc_short_event_t*)&mcon->event, 1, 0, file, func, line);
}
return &mcon->event;
}
-int __ss7bc_connection_write(ss7bc_connection_t *mcon, ss7bc_event_t *event, const char *file, const char *func, int line)
+int __sangomabc_connection_write(sangomabc_connection_t *mcon, sangomabc_event_t *event, const char *file, const char *func, int line)
{
int err;
int event_size=MIN_SIZE_CALLSTART_MSG+event->isup_in_rdnis_size;
}
if (event->span >= ZAP_MAX_PHYSICAL_SPANS_PER_LOGICAL_SPAN || event->chan >= ZAP_MAX_CHANNELS_PHYSICAL_SPAN ) {
- zap_log(file, func, line, ZAP_LOG_LEVEL_CRIT, "Critical Error: TX Cmd=%s Invalid Span=%i Chan=%i\n", ss7bc_event_id_name(event->event_id), event->span, event->chan);
+ zap_log(file, func, line, ZAP_LOG_LEVEL_CRIT, "Critical Error: TX Cmd=%s Invalid Span=%i Chan=%i\n", sangomabc_event_id_name(event->event_id), event->span, event->chan);
abort();
return -1;
}
if (!boost_full_event(event->event_id)) {
- event_size=sizeof(ss7bc_short_event_t);
+ event_size=sizeof(sangomabc_short_event_t);
}
- if (ss7bc_test_flag(mcon, MSU_FLAG_DOWN)) {
+ if (sangomabc_test_flag(mcon, MSU_FLAG_DOWN)) {
if (event->event_id != SIGBOOST_EVENT_SYSTEM_RESTART &&
event->event_id != SIGBOOST_EVENT_SYSTEM_RESTART_ACK &&
event->event_id != SIGBOOST_EVENT_HEARTBEAT) {
zap_log(file, func, line, ZAP_LOG_LEVEL_WARNING, "Not writing packets when connection is down. [%s]\n",
- ss7bc_event_id_name(event->event_id));
+ sangomabc_event_id_name(event->event_id));
return 0;
}
}
}
if (boost_full_event(event->event_id)) {
- ss7bc_print_event_call(mcon, event, 0, 1, file, func, line);
+ sangomabc_print_event_call(mcon, event, 0, 1, file, func, line);
} else {
- ss7bc_print_event_short(mcon, (ss7bc_short_event_t*)event, 0, 1, file, func, line);
+ sangomabc_print_event_short(mcon, (sangomabc_short_event_t*)event, 0, 1, file, func, line);
}
return err;
}
-int __ss7bc_connection_writep(ss7bc_connection_t *mcon, ss7bc_event_t *event, const char *file, const char *func, int line)
+int __sangomabc_connection_writep(sangomabc_connection_t *mcon, sangomabc_event_t *event, const char *file, const char *func, int line)
{
int err;
- int event_size=sizeof(ss7bc_event_t);
+ int event_size=sizeof(sangomabc_event_t);
if (!event || mcon->socket < 0 || !mcon->mutex) {
zap_log(file, func, line, ZAP_LOG_LEVEL_CRIT, "Critical Error: No Event Device\n");
}
if (!boost_full_event(event->event_id)) {
- event_size=sizeof(ss7bc_short_event_t);
+ event_size=sizeof(sangomabc_short_event_t);
}
zap_mutex_lock(mcon->mutex);
}
if (boost_full_event(event->event_id)) {
- ss7bc_print_event_call(mcon, event, 1, 1, file, func, line);
+ sangomabc_print_event_call(mcon, event, 1, 1, file, func, line);
} else {
- ss7bc_print_event_short(mcon, (ss7bc_short_event_t*)event, 1, 1, file, func, line);
+ sangomabc_print_event_short(mcon, (sangomabc_short_event_t*)event, 1, 1, file, func, line);
}
return err;
}
-void ss7bc_call_init(ss7bc_event_t *event, const char *calling, const char *called, int setup_id)
+void sangomabc_call_init(sangomabc_event_t *event, const char *calling, const char *called, int setup_id)
{
- memset(event, 0, sizeof(ss7bc_event_t));
+ memset(event, 0, sizeof(sangomabc_event_t));
event->event_id = SIGBOOST_EVENT_CALL_START;
if (calling) {
}
-void ss7bc_event_init(ss7bc_short_event_t *event, ss7bc_event_id_t event_id, int chan, int span)
+void sangomabc_event_init(sangomabc_short_event_t *event, sangomabc_event_id_t event_id, int chan, int span)
{
- memset(event, 0, sizeof(ss7bc_short_event_t));
+ memset(event, 0, sizeof(sangomabc_short_event_t));
event->event_id = event_id;
event->chan = chan;
event->span = span;
}
-const char *ss7bc_event_id_name(uint32_t event_id)
+const char *sangomabc_event_id_name(uint32_t event_id)
{
unsigned int x;
const char *ret = NULL;
- for (x = 0 ; x < sizeof(ss7bc_table)/sizeof(struct ss7bc_map); x++) {
- if (ss7bc_table[x].event_id == event_id) {
- ret = ss7bc_table[x].name;
+ for (x = 0 ; x < sizeof(sangomabc_table)/sizeof(struct sangomabc_map); x++) {
+ if (sangomabc_table[x].event_id == event_id) {
+ ret = sangomabc_table[x].name;
break;
}
}
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef _SS7BC_H
-#define _SS7BC_H
+#ifndef _SANGOMABC_H
+#define _SANGOMABC_H
#include <ctype.h>
#include <string.h>
#include <sigboost.h>
#include <sys/time.h>
-#define ss7bc_test_flag(p,flag) ({ \
+#define sangomabc_test_flag(p,flag) ({ \
((p)->flags & (flag)); \
})
-#define ss7bc_set_flag(p,flag) do { \
+#define sangomabc_set_flag(p,flag) do { \
((p)->flags |= (flag)); \
} while (0)
-#define ss7bc_clear_flag(p,flag) do { \
+#define sangomabc_clear_flag(p,flag) do { \
((p)->flags &= ~(flag)); \
} while (0)
-#define ss7bc_copy_flags(dest,src,flagz) do { \
+#define sangomabc_copy_flags(dest,src,flagz) do { \
(dest)->flags &= ~(flagz); \
(dest)->flags |= ((src)->flags & (flagz)); \
} while (0)
-typedef t_sigboost_callstart ss7bc_event_t;
-typedef t_sigboost_short ss7bc_short_event_t;
-typedef uint32_t ss7bc_event_id_t;
+typedef t_sigboost_callstart sangomabc_event_t;
+typedef t_sigboost_short sangomabc_short_event_t;
+typedef uint32_t sangomabc_event_id_t;
-typedef struct ss7bc_ip_cfg
+typedef struct sangomabc_ip_cfg
{
char local_ip[25];
int local_port;
char remote_ip[25];
int remote_port;
-}ss7bc_ip_cfg_t;
+}sangomabc_ip_cfg_t;
typedef enum {
MSU_FLAG_EVENT = (1 << 0),
MSU_FLAG_DOWN = (1 << 1)
-} ss7bc_flag_t;
+} sangomabc_flag_t;
-struct ss7bc_connection {
+struct sangomabc_connection {
zap_socket_t socket;
struct sockaddr_in local_addr;
struct sockaddr_in remote_addr;
- ss7bc_event_t event;
+ sangomabc_event_t event;
struct hostent remote_hp;
struct hostent local_hp;
unsigned int flags;
unsigned int rxseq;
unsigned int txwindow;
unsigned int rxseq_reset;
- ss7bc_ip_cfg_t cfg;
+ sangomabc_ip_cfg_t cfg;
uint32_t hb_elapsed;
};
-typedef struct ss7bc_connection ss7bc_connection_t;
+typedef struct sangomabc_connection sangomabc_connection_t;
/* disable nagle's algorythm */
static inline void sctp_no_nagle(int socket)
#endif
}
-int ss7bc_connection_close(ss7bc_connection_t *mcon);
-int ss7bc_connection_open(ss7bc_connection_t *mcon, char *local_ip, int local_port, char *ip, int port);
-ss7bc_event_t *__ss7bc_connection_read(ss7bc_connection_t *mcon, int iteration, const char *file, const char *func, int line);
-ss7bc_event_t *__ss7bc_connection_readp(ss7bc_connection_t *mcon, int iteration, const char *file, const char *func, int line);
-int __ss7bc_connection_write(ss7bc_connection_t *mcon, ss7bc_event_t *event, const char *file, const char *func, int line);
-int __ss7bc_connection_writep(ss7bc_connection_t *mcon, ss7bc_event_t *event, const char *file, const char *func, int line);
-#define ss7bc_connection_write(_m,_e) __ss7bc_connection_write(_m, _e, __FILE__, __func__, __LINE__)
-#define ss7bc_connection_writep(_m,_e) __ss7bc_connection_writep(_m, _e, __FILE__, __func__, __LINE__)
-#define ss7bc_connection_read(_m,_e) __ss7bc_connection_read(_m, _e, __FILE__, __func__, __LINE__)
-#define ss7bc_connection_readp(_m,_e) __ss7bc_connection_readp(_m, _e, __FILE__, __func__, __LINE__)
-void ss7bc_event_init(ss7bc_short_event_t *event, ss7bc_event_id_t event_id, int chan, int span);
-void ss7bc_call_init(ss7bc_event_t *event, const char *calling, const char *called, int setup_id);
-const char *ss7bc_event_id_name(uint32_t event_id);
-int ss7bc_exec_command(ss7bc_connection_t *mcon, int span, int chan, int id, int cmd, int cause);
-int ss7bc_exec_commandp(ss7bc_connection_t *pcon, int span, int chan, int id, int cmd, int cause);
+int sangomabc_connection_close(sangomabc_connection_t *mcon);
+int sangomabc_connection_open(sangomabc_connection_t *mcon, char *local_ip, int local_port, char *ip, int port);
+sangomabc_event_t *__sangomabc_connection_read(sangomabc_connection_t *mcon, int iteration, const char *file, const char *func, int line);
+sangomabc_event_t *__sangomabc_connection_readp(sangomabc_connection_t *mcon, int iteration, const char *file, const char *func, int line);
+int __sangomabc_connection_write(sangomabc_connection_t *mcon, sangomabc_event_t *event, const char *file, const char *func, int line);
+int __sangomabc_connection_writep(sangomabc_connection_t *mcon, sangomabc_event_t *event, const char *file, const char *func, int line);
+#define sangomabc_connection_write(_m,_e) __sangomabc_connection_write(_m, _e, __FILE__, __func__, __LINE__)
+#define sangomabc_connection_writep(_m,_e) __sangomabc_connection_writep(_m, _e, __FILE__, __func__, __LINE__)
+#define sangomabc_connection_read(_m,_e) __sangomabc_connection_read(_m, _e, __FILE__, __func__, __LINE__)
+#define sangomabc_connection_readp(_m,_e) __sangomabc_connection_readp(_m, _e, __FILE__, __func__, __LINE__)
+void sangomabc_event_init(sangomabc_short_event_t *event, sangomabc_event_id_t event_id, int chan, int span);
+void sangomabc_call_init(sangomabc_event_t *event, const char *calling, const char *called, int setup_id);
+const char *sangomabc_event_id_name(uint32_t event_id);
+int sangomabc_exec_command(sangomabc_connection_t *mcon, int span, int chan, int id, int cmd, int cause);
+int sangomabc_exec_commandp(sangomabc_connection_t *pcon, int span, int chan, int id, int cmd, int cause);
#endif