clean:
touch *
rm -f $(LCR) $(LCRADMIN) $(CHAN_LCR) $(LCRWATCH) $(GEN) $(GENW) $(GENRC) $(GENEXT)
- rm -f *.o
+ rm -f *.o *.ooo
rm -f .*.c.sw* .*.cpp.sw* .*.h.sw*
rm -f bla nohup.out a.out
rm -f debug*.log
** **
\*****************************************************************************/
-signed long *audio_law_to_s32;
+signed int *audio_law_to_s32;
/* ulaw -> signed 16-bit */
-static signed long audio_ulaw_to_s32[] =
+static signed int audio_ulaw_to_s32[] =
{
0xffff8284, 0xffff8684, 0xffff8a84, 0xffff8e84,
0xffff9284, 0xffff9684, 0xffff9a84, 0xffff9e84,
};
/* alaw -> signed 16-bit */
-static signed long audio_alaw_to_s32[] =
+static signed int audio_alaw_to_s32[] =
{
0x000013fc, 0xffffec04, 0x00000144, 0xfffffebc,
0x0000517c, 0xffffae84, 0x0000051c, 0xfffffae4,
-extern signed long *audio_law_to_s32;
+extern signed int *audio_law_to_s32;
extern unsigned char audio_s16_to_law[65536];
extern short audio_alaw_relations[];
void generate_tables(char law);
{
struct lcr_msg *message;
char buffer[256];
- unsigned long port_id = portlist->port_id;
+ unsigned int port_id = portlist->port_id;
struct port_list *tportlist;
class Port *port;
struct interface *interface;
{
struct lcr_msg *message;
char buffer[256];
- unsigned long port_id = portlist->port_id;
+ unsigned int port_id = portlist->port_id;
int cause,
location;
/* port sends message to the endpoint
*/
-void EndpointAppPBX::ea_message_port(unsigned long port_id, int message_type, union parameter *param)
+void EndpointAppPBX::ea_message_port(unsigned int port_id, int message_type, union parameter *param)
{
struct port_list *portlist;
struct lcr_msg *message;
/* JOIN sends messages to the endpoint
*/
-void EndpointAppPBX::ea_message_join(unsigned long join_id, int message_type, union parameter *param)
+void EndpointAppPBX::ea_message_join(unsigned int join_id, int message_type, union parameter *param)
{
struct port_list *portlist;
struct lcr_msg *message;
return(0);
}
-void EndpointAppPBX::logmessage(int message_type, union parameter *param, unsigned long port_id, int dir)
+void EndpointAppPBX::logmessage(int message_type, union parameter *param, unsigned int port_id, int dir)
{
char *logtext = "unknown";
char buffer[64];
int e_hold; /* is this endpoint on hold ? */
char e_tone[256]; /* save tone for resuming ports */
- unsigned long e_adminid;
+ unsigned int e_adminid;
/* states */
int e_state; /* state of endpoint */
int e_powercount; /* power count */
int e_powerlimit; /* power limit */
double e_callback; /* time when callback (when idle reached) 0=off */
- signed long e_cfnr_release; /* time stamp when to do the release for call forward on no response */
- signed long e_cfnr_call; /* time stamp when to do the call for call forward on no response */
- signed long e_password_timeout; /* time stamp when to do the release for password timeout */
+ signed int e_cfnr_release; /* time stamp when to do the release for call forward on no response */
+ signed int e_cfnr_call; /* time stamp when to do the call for call forward on no response */
+ signed int e_password_timeout; /* time stamp when to do the release for password timeout */
/* port relation */
int e_multipoint_cause; /* cause value of disconnected multiport calls (highest priority) */
char e_crypt_info[33]; /* last information text */
int e_crypt_timeout_sec; /* timer */
int e_crypt_timeout_usec; /* timer */
- unsigned long e_crypt_random; /* current random number for ident */
- unsigned long e_crypt_bogomips; /* bogomips for ident */
+ unsigned int e_crypt_random; /* current random number for ident */
+ unsigned int e_crypt_bogomips; /* bogomips for ident */
unsigned char e_crypt_key[256]; /* the session key */
int e_crypt_key_len;
unsigned char e_crypt_ckey[256]; /* the encrypted session key */
/* messages */
void hookflash(void);
- void ea_message_port(unsigned long port_id, int message, union parameter *param);
+ void ea_message_port(unsigned int port_id, int message, union parameter *param);
void port_setup(struct port_list *portlist, int message_type, union parameter *param);
void port_information(struct port_list *portlist, int message_type, union parameter *param);
void port_dtmf(struct port_list *portlist, int message_type, union parameter *param);
void port_facility(struct port_list *portlist, int message_type, union parameter *param);
void port_suspend(struct port_list *portlist, int message_type, union parameter *param);
void port_resume(struct port_list *portlist, int message_type, union parameter *param);
- void ea_message_join(unsigned long join_id, int message, union parameter *param);
+ void ea_message_join(unsigned int join_id, int message, union parameter *param);
void join_crypt(struct port_list *portlist, int message_type, union parameter *param);
void join_mISDNsignal(struct port_list *portlist, int message_type, union parameter *param);
void join_setup(struct port_list *portlist, int message_type, union parameter *param);
void cryptman_timeout(int secs);
void message_disconnect_port(struct port_list *portlist, int cause, int location, char *display);
- void logmessage(int message_type, union parameter *param, unsigned long port_id, int dir);
+ void logmessage(int message_type, union parameter *param, unsigned int port_id, int dir);
void trace_header(char *name, int direction);
};
/*
* send control information to the channel (dsp-module)
*/
-static void ph_control(unsigned long handle, unsigned long c1, unsigned long c2, char *trace_name, int trace_value, int b_mode)
+static void ph_control(unsigned int handle, unsigned int c1, unsigned int c2, char *trace_name, int trace_value, int b_mode)
{
unsigned char buffer[MISDN_HEADER_LEN+sizeof(int)+sizeof(int)];
struct mISDNhead *ctrl = (struct mISDNhead *)buffer;
- unsigned long *d = (unsigned long *)(buffer+MISDN_HEADER_LEN);
+ unsigned int *d = (unsigned int *)(buffer+MISDN_HEADER_LEN);
int ret;
if (b_mode != 0 && b_mode != 2)
CERROR(NULL, NULL, "Failed to send to socket %d\n", handle);
}
-static void ph_control_block(unsigned long handle, unsigned long c1, void *c2, int c2_len, char *trace_name, int trace_value, int b_mode)
+static void ph_control_block(unsigned int handle, unsigned int c1, void *c2, int c2_len, char *trace_name, int trace_value, int b_mode)
{
unsigned char buffer[MISDN_HEADER_LEN+sizeof(int)+c2_len];
struct mISDNhead *ctrl = (struct mISDNhead *)buffer;
- unsigned long *d = (unsigned long *)(buffer+MISDN_HEADER_LEN);
+ unsigned int *d = (unsigned int *)(buffer+MISDN_HEADER_LEN);
int ret;
if (b_mode != 0 && b_mode != 2)
int bchannel_create(struct bchannel *bchannel, int mode)
{
int ret;
- unsigned long on = 1;
+ unsigned int on = 1;
struct sockaddr_mISDN addr;
if (bchannel->b_sock)
{
struct mISDNhead *hh = (struct mISDNhead *)buffer;
unsigned char *data = buffer + MISDN_HEADER_LEN;
- unsigned long cont = *((unsigned long *)data);
+ unsigned int cont = *((unsigned int *)data);
struct bchannel *remote_bchannel;
int ret;
* bchannel channel handling
*/
struct bchannel *bchannel_first = NULL;
-struct bchannel *find_bchannel_handle(unsigned long handle)
+struct bchannel *find_bchannel_handle(unsigned int handle)
{
struct bchannel *bchannel = bchannel_first;
}
#if 0
-struct bchannel *find_bchannel_ref(unsigned long ref)
+struct bchannel *find_bchannel_ref(unsigned int ref)
{
struct bchannel *bchannel = bchannel_first;
}
#endif
-struct bchannel *alloc_bchannel(unsigned long handle)
+struct bchannel *alloc_bchannel(unsigned int handle)
{
struct bchannel **bchannelp = &bchannel_first;
struct bchannel {
struct bchannel *next;
struct chan_call *call; /* link to call process */
- unsigned long handle; /* handle for stack id */
+ unsigned int handle; /* handle for stack id */
int b_sock; /* socket for b-channel */
int b_mode; /* dsp, raw, dsphdlc */
int b_state;
int b_tx_dejitter;
int b_tx_gain, b_rx_gain;
char b_pipeline[256];
- unsigned long b_conf;
+ unsigned int b_conf;
int b_echo;
int b_tone;
int b_rxoff;
void bchannel_pipeline(struct bchannel *bchannel, char *pipeline);
void bchannel_gain(struct bchannel *bchannel, int gain, int tx);
int bchannel_handle(void);
-struct bchannel *find_bchannel_handle(unsigned long handle);
-//struct bchannel *find_bchannel_ref(unsigned long ref);
-struct bchannel *alloc_bchannel(unsigned long handle);
+struct bchannel *find_bchannel_handle(unsigned int handle);
+//struct bchannel *find_bchannel_ref(unsigned int ref);
+struct bchannel *alloc_bchannel(unsigned int handle);
void free_bchannel(struct bchannel *channel);
va_end(args);
if (call)
- sprintf(call_text, "%ld", call->ref);
+ sprintf(call_text, "%d", call->ref);
if (ast)
strncpy(ast_text, ast->name, sizeof(ast_text)-1);
ast_text[sizeof(ast_text)-1] = '\0';
*/
struct chan_call *call_first;
-struct chan_call *find_call_ref(unsigned long ref)
+struct chan_call *find_call_ref(unsigned int ref)
{
struct chan_call *call = call_first;
return(call);
}
-struct chan_call *find_call_handle(unsigned long handle)
+struct chan_call *find_call_handle(unsigned int handle)
{
struct chan_call *call = call_first;
/*
* enque message to LCR
*/
-int send_message(int message_type, unsigned long ref, union parameter *param)
+int send_message(int message_type, unsigned int ref, union parameter *param)
{
struct admin_list *admin, **adminp;
/*
* message received from LCR
*/
-int receive_message(int message_type, unsigned long ref, union parameter *param)
+int receive_message(int message_type, unsigned int ref, union parameter *param)
{
struct bchannel *bchannel;
struct chan_call *call;
char *socket_name = SOCKET_NAME;
int conn;
struct sockaddr_un sock_address;
- unsigned long on = 1;
+ unsigned int on = 1;
union parameter param;
/* open socket */
struct chan_call {
struct chan_call *next; /* link to next call instance */
int state; /* current call state CHAN_LCR_STATE */
- unsigned long ref; /* callref for this channel */
+ unsigned int ref; /* callref for this channel */
void *ast; /* current asterisk channel */
int pbx_started;
/* indicates if pbx que is available */
/*
* support routine to get cpu speed
*/
-static unsigned long get_bogomips(void)
+static unsigned int get_bogomips(void)
{
FILE *fp;
char buffer[64], *p;
/*
* crc 32 stuff
*/
-static unsigned long crc_reflect(unsigned long ref, char ch)
+static unsigned int crc_reflect(unsigned int ref, char ch)
{
- unsigned long value = 0;
+ unsigned int value = 0;
int i;
i = 1;
return(value);
}
-static unsigned long crc32_table[256];
+static unsigned int crc32_table[256];
static int crc_initialized = 0;
void crc_init(void)
{
- unsigned long ulPolynomial = 0x04c11db7;
+ unsigned int ulPolynomial = 0x04c11db7;
int i, j;
i = 0;
crc_initialized = 1;
}
-unsigned long crc32(unsigned char *data, int len)
+unsigned int crc32(unsigned char *data, int len)
{
- unsigned long crc = 0xffffffff;
+ unsigned int crc = 0xffffffff;
if (!crc_initialized)
FATAL("crc not initialized, exitting...");
void EndpointAppPBX::cr_ident(int message, unsigned char *param, int len)
{
unsigned char buf[4], *p;
- unsigned long bogomips = 0, ran;
+ unsigned int bogomips = 0, ran;
int l;
l = CM_SIZEOFINF(CM_INFO_RANDOM);
*/
int cryptman_encode_bch(unsigned char *data, int len, unsigned char *buf, int buf_len)
{
- unsigned long crc;
+ unsigned int crc;
int overhead = 18;
len--; /* without null-termination */
cryptman_getinf(param, a, b);
void crc_init(void);
-unsigned long crc32(unsigned char *data, int len);
+unsigned int crc32(unsigned char *data, int len);
int cryptman_encode_bch(unsigned char *data, int len, unsigned char *buf, int buf_len);
extern "C" {
}
#include <q931.h>
-extern unsigned long mt_assign_pid;
+extern unsigned int mt_assign_pid;
#include "ie.cpp"
* return: <0: error, call is released, -cause is given
* 0: ok, nothing to do
*/
-int Pdss1::received_first_reply_to_setup(unsigned long cmd, int channel, int exclusive)
+int Pdss1::received_first_reply_to_setup(unsigned int cmd, int channel, int exclusive)
{
int ret;
l3_msg *l3m;
p_m_delete = 1;
}
+/* CC_RESTART INDICATION */
+void Pdss1::restart_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m)
+{
+ l1l2l3_trace_header(p_m_mISDNport, this, L3_RESTART_IND, DIRECTION_IN);
+ end_trace();
+
+ // L3 process is not toucht. (not even by network stack)
+}
+
/* CC_RELEASE_COMPLETE INDICATION (a reject) */
void Pdss1::release_complete_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m)
{
release_complete_ind(cmd, pid, l3m);
break;
+ case MT_RESTART:
+ restart_ind(cmd, pid, l3m);
+ break;
+
case MT_NOTIFY:
notify_ind(cmd, pid, l3m);
break;
* handles all messages from endpoint
*/
/* MESSAGE_INFORMATION */
-void Pdss1::message_information(unsigned long epoint_id, int message_id, union parameter *param)
+void Pdss1::message_information(unsigned int epoint_id, int message_id, union parameter *param)
{
l3_msg *l3m;
int newteid = 0;
/* MESSAGE_SETUP */
-void Pdss1::message_setup(unsigned long epoint_id, int message_id, union parameter *param)
+void Pdss1::message_setup(unsigned int epoint_id, int message_id, union parameter *param)
{
l3_msg *l3m;
int ret;
}
/* MESSAGE_FACILITY */
-void Pdss1::message_facility(unsigned long epoint_id, int message_id, union parameter *param)
+void Pdss1::message_facility(unsigned int epoint_id, int message_id, union parameter *param)
{
l3_msg *l3m;
}
/* MESSAGE_NOTIFY */
-void Pdss1::message_notify(unsigned long epoint_id, int message_id, union parameter *param)
+void Pdss1::message_notify(unsigned int epoint_id, int message_id, union parameter *param)
{
l3_msg *l3m;
int notify;
}
/* MESSAGE_OVERLAP */
-void Pdss1::message_overlap(unsigned long epoint_id, int message_id, union parameter *param)
+void Pdss1::message_overlap(unsigned int epoint_id, int message_id, union parameter *param)
{
l3_msg *l3m;
}
/* MESSAGE_PROCEEDING */
-void Pdss1::message_proceeding(unsigned long epoint_id, int message_id, union parameter *param)
+void Pdss1::message_proceeding(unsigned int epoint_id, int message_id, union parameter *param)
{
l3_msg *l3m;
}
/* MESSAGE_ALERTING */
-void Pdss1::message_alerting(unsigned long epoint_id, int message_id, union parameter *param)
+void Pdss1::message_alerting(unsigned int epoint_id, int message_id, union parameter *param)
{
l3_msg *l3m;
if (p_capainfo.bearer_capa==INFO_BC_SPEECH
|| p_capainfo.bearer_capa==INFO_BC_AUDIO
|| p_capainfo.bearer_capa==INFO_BC_DATAUNRESTRICTED_TONES)
- enc_ie_progress(l3m, 0, p_m_d_ntmode?1:5, 8);
+ if (p_m_mISDNport->tones)
+ enc_ie_progress(l3m, 0, p_m_d_ntmode?1:5, 8);
end_trace();
p_m_mISDNport->ml3->to_layer3(p_m_mISDNport->ml3, MT_CALL_PROCEEDING, p_m_d_l3id, l3m);
new_state(PORT_STATE_IN_PROCEEDING);
}
/* MESSAGE_CONNECT */
-void Pdss1::message_connect(unsigned long epoint_id, int message_id, union parameter *param)
+void Pdss1::message_connect(unsigned int epoint_id, int message_id, union parameter *param)
{
l3_msg *l3m;
int type, plan, present, screen;
l1l2l3_trace_header(p_m_mISDNport, this, L3_PROCEEDING_REQ, DIRECTION_OUT);
/* channel information */
enc_ie_channel_id(l3m, 1, p_m_b_channel);
-// /* progress information */
-// if (p_capainfo.bearer_capa==INFO_BC_SPEECH
-// || p_capainfo.bearer_capa==INFO_BC_AUDIO
-// || p_capainfo.bearer_capa==INFO_BC_DATAUNRESTRICTED_TONES)
-// enc_ie_progress(l3m, 0, p_m_d_ntmode?1:5, 8);
end_trace();
p_m_mISDNport->ml3->to_layer3(p_m_mISDNport->ml3, MT_CALL_PROCEEDING, p_m_d_l3id, l3m);
new_state(PORT_STATE_IN_PROCEEDING);
}
/* MESSAGE_DISCONNECT */
-void Pdss1::message_disconnect(unsigned long epoint_id, int message_id, union parameter *param)
+void Pdss1::message_disconnect(unsigned int epoint_id, int message_id, union parameter *param)
{
l3_msg *l3m;
struct lcr_msg *message;
if (p_capainfo.bearer_capa==INFO_BC_SPEECH
|| p_capainfo.bearer_capa==INFO_BC_AUDIO
|| p_capainfo.bearer_capa==INFO_BC_DATAUNRESTRICTED_TONES)
+ if (p_m_mISDNport->tones)
enc_ie_progress(l3m, 0, p_m_d_ntmode?1:5, 8);
end_trace();
p_m_mISDNport->ml3->to_layer3(p_m_mISDNport->ml3, MT_CALL_PROCEEDING, p_m_d_l3id, l3m);
}
/* MESSAGE_RELEASE */
-void Pdss1::message_release(unsigned long epoint_id, int message_id, union parameter *param)
+void Pdss1::message_release(unsigned int epoint_id, int message_id, union parameter *param)
{
l3_msg *l3m;
class Endpoint *epoint;
*/
if (p_state==PORT_STATE_IN_SETUP
|| p_state==PORT_STATE_OUT_SETUP)
-// // NOTE: a bug in mISDNuser (see disconnect_req_out !!!)
-// || p_state==PORT_STATE_OUT_DISCO)
{
//#warning remove me
//PDEBUG(DEBUG_LOG, "JOLLY sending release complete %d\n", p_serial);
if (p_capainfo.bearer_capa==INFO_BC_SPEECH
|| p_capainfo.bearer_capa==INFO_BC_AUDIO
|| p_capainfo.bearer_capa==INFO_BC_DATAUNRESTRICTED_TONES)
+ if (p_m_mISDNport->tones)
enc_ie_progress(l3m, 0, p_m_d_ntmode?1:5, 8);
end_trace();
p_m_mISDNport->ml3->to_layer3(p_m_mISDNport->ml3, MT_CALL_PROCEEDING, p_m_d_l3id, l3m);
/*
* endpoint sends messages to the port
*/
-int Pdss1::message_epoint(unsigned long epoint_id, int message_id, union parameter *param)
+int Pdss1::message_epoint(unsigned int epoint_id, int message_id, union parameter *param)
{
struct lcr_msg *message;
void message_isdn(unsigned int cmd, unsigned int pid, struct l3_msg *l3m);
int p_m_d_ces; /* ntmode: tei&sapi */
int handler(void);
- int message_epoint(unsigned long epoint_id, int message, union parameter *param);
+ int message_epoint(unsigned int epoint_id, int message, union parameter *param);
int p_m_d_ntmode; /* flags the nt-mode */
struct lcr_msg *p_m_d_queue; /* queue for SETUP if link is down */
int p_m_d_collect_location;
void new_state(int state); /* set new state */
-// void isdn_show_send_message(unsigned long prim, msg_t *msg);
+// void isdn_show_send_message(unsigned int prim, msg_t *msg);
int hunt_bchannel(int exclusive, int channel);
- int received_first_reply_to_setup(unsigned long cmd, int channel, int exclusive);
+ int received_first_reply_to_setup(unsigned int cmd, int channel, int exclusive);
void information_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m);
void setup_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m);
void setup_acknowledge_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m);
void connect_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m);
void disconnect_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m);
void release_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m);
+ void restart_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m);
void release_complete_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m);
void disconnect_ind_i(unsigned int cmd, unsigned int pid, struct l3_msg *l3m);
void t312_timeout_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m);
void retrieve_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m);
void suspend_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m);
void resume_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m);
- void message_information(unsigned long epoint_id, int message_id, union parameter *param);
- void message_setup(unsigned long epoint_id, int message_id, union parameter *param);
- void message_notify(unsigned long epoint_id, int message_id, union parameter *param);
- void message_facility(unsigned long epoint_id, int message_id, union parameter *param);
- void message_overlap(unsigned long epoint_id, int message_id, union parameter *param);
- void message_proceeding(unsigned long epoint_id, int message_id, union parameter *param);
- void message_alerting(unsigned long epoint_id, int message_id, union parameter *param);
- void message_connect(unsigned long epoint_id, int message_id, union parameter *param);
- void message_disconnect(unsigned long epoint_id, int message_id, union parameter *param);
- void message_release(unsigned long epoint_id, int message_id, union parameter *param);
+ void message_information(unsigned int epoint_id, int message_id, union parameter *param);
+ void message_setup(unsigned int epoint_id, int message_id, union parameter *param);
+ void message_notify(unsigned int epoint_id, int message_id, union parameter *param);
+ void message_facility(unsigned int epoint_id, int message_id, union parameter *param);
+ void message_overlap(unsigned int epoint_id, int message_id, union parameter *param);
+ void message_proceeding(unsigned int epoint_id, int message_id, union parameter *param);
+ void message_alerting(unsigned int epoint_id, int message_id, union parameter *param);
+ void message_connect(unsigned int epoint_id, int message_id, union parameter *param);
+ void message_disconnect(unsigned int epoint_id, int message_id, union parameter *param);
+ void message_release(unsigned int epoint_id, int message_id, union parameter *param);
/* IE conversion */
void enc_ie_complete(struct l3_msg *l3m, int complete);
#include "main.h"
-unsigned long epoint_serial = 1; /* initial value must be 1, because 0== no epoint */
+unsigned int epoint_serial = 1; /* initial value must be 1, because 0== no epoint */
class Endpoint *epoint_first = NULL;
/*
* find the epoint with epoint_id
*/
-class Endpoint *find_epoint_id(unsigned long epoint_id)
+class Endpoint *find_epoint_id(unsigned int epoint_id)
{
class Endpoint *epoint = epoint_first;
/*
* endpoint constructor (link with either port or join id)
*/
-Endpoint::Endpoint(unsigned long port_id, unsigned long join_id)
+Endpoint::Endpoint(unsigned int port_id, unsigned int join_id)
{
class Port *port;
class Endpoint **epointpointer;
/* create new portlist relation
*/
-struct port_list *Endpoint::portlist_new(unsigned long port_id, int port_type, int earlyb)
+struct port_list *Endpoint::portlist_new(unsigned int port_id, int port_type, int earlyb)
{
struct port_list *portlist, **portlistpointer;
/* structure of port_list */
struct port_list {
struct port_list *next;
- unsigned long port_id;
+ unsigned int port_id;
int port_type;
int early_b; /* if patterns are available */
};
class Endpoint
{
public:
- Endpoint(unsigned long port_id, unsigned long join_id);
+ Endpoint(unsigned int port_id, unsigned int join_id);
~Endpoint();
class Endpoint *next; /* next in list */
- unsigned long ep_serial; /* a unique serial to identify */
+ unsigned int ep_serial; /* a unique serial to identify */
int handler(void);
/* applocaton relation */
/* port relation */
struct port_list *ep_portlist; /* link to list of ports */
- struct port_list *portlist_new(unsigned long port_id, int port_type, int earlyb);
+ struct port_list *portlist_new(unsigned int port_id, int port_type, int earlyb);
void free_portlist(struct port_list *portlist);
/* join relation */
- unsigned long ep_join_id; /* link to join */
+ unsigned int ep_join_id; /* link to join */
/* if still used by threads */
int ep_use;
extern class Endpoint *epoint_first;
-class Endpoint *find_epoint_id(unsigned long epoint_id);
+class Endpoint *find_epoint_id(unsigned int epoint_id);
/* mini application for test purpose only */
-void EndpointApp::ea_message_port(unsigned long port_id, int message_type, union parameter *param)
+void EndpointApp::ea_message_port(unsigned int port_id, int message_type, union parameter *param)
{
PDEBUG(DEBUG_EPOINT, "%s: Spare function.\n", __FUNCTION__);
}
-void EndpointApp::ea_message_join(unsigned long join_id, int message_type, union parameter *param)
+void EndpointApp::ea_message_join(unsigned int join_id, int message_type, union parameter *param)
{
PDEBUG(DEBUG_EPOINT, "%s: Spare function.\n", __FUNCTION__);
}
class Endpoint *ea_endpoint;
virtual int handler(void);
- virtual void ea_message_port(unsigned long port_id, int message, union parameter *param);
- virtual void ea_message_join(unsigned long join_id, int message, union parameter *param);
+ virtual void ea_message_port(unsigned int port_id, int message, union parameter *param);
+ virtual void ea_message_join(unsigned int join_id, int message, union parameter *param);
};
tm = localtime(&start);
fprintf(fp,"%s %2d %04d %02d:%02d:%02d %s", mon[tm->tm_mon], tm->tm_mday, tm->tm_year+1900, tm->tm_hour, tm->tm_min, tm->tm_sec, number);
if (stop)
- fprintf(fp," %2ld:%02ld:%02ld", (stop-start)/3600, (((unsigned long)(stop-start))/60)%60, ((unsigned long)(stop-start))%60);
+ fprintf(fp," %2ld:%02ld:%02ld", (stop-start)/3600, (((unsigned int)(stop-start))/60)%60, ((unsigned int)(stop-start))%60);
else
fprintf(fp," --:--:--");
fprintf(fp," %s -> %s", callerid, calledid);
struct isdn_cause isdn_cause[128];
struct isdn_location isdn_location[16];
-void _printdebug(const char *function, int line, unsigned long mask, const char *fmt, ...)
+void _printdebug(const char *function, int line, unsigned int mask, const char *fmt, ...)
{
}
{
printf("Usage: %s <extension> <interfaces> <callerid>\n\n", argv[0]);
printf("extension: any number for the extension (e.g 200)\n");
- printf("interfaces: internal interface(s) to reach extension (seperated by commas. e.g Int1,Int2)\n");
+ printf("interfaces: internal interface(s) to reach extension, NOT port numbers\n");
+ printf(" -> seperate multiple interfaces with commas. e.g Int1,Int2\n");
printf("callerid: normal undefined called is (use what your telco assigned you)\n");
return(0);
}
struct fmt {
unsigned short stereo; /* 1 = pcm, 2 = adpcm */
unsigned short channels; /* number of channels */
- unsigned long sample_rate; /* sample rate */
- unsigned long data_rate; /* data rate */
+ unsigned int sample_rate; /* sample rate */
+ unsigned int data_rate; /* data rate */
unsigned short bytes_sample; /* bytes per sample (all channels) */
unsigned short bits_sample; /* bits per sample (one channel) */
};
unsigned char buffer[256];
struct fmt *fmt;
FILE *wfp;
- signed long i;
+ signed int i;
int channels, bytes;
short sample, sample2;
- signed long size, chunk;
+ signed int size, chunk;
int gotfmt = 0, gotdata = 0;
if ((wfp=fopen(wav,"r")))
} else
{
printf("Ignoring chunk '%c%c%c%c' (length=%ld)\n",buffer[0],buffer[1],buffer[2],buffer[3], chunk);
- while(chunk > (signed long)sizeof(buffer))
+ while(chunk > (signed int)sizeof(buffer))
{
fread(buffer, sizeof(buffer), 1, wfp);
chunk -= sizeof(buffer);
struct fmt {
unsigned short stereo; /* 1 = pcm, 2 = adpcm */
unsigned short channels; /* number of channels */
- unsigned long sample_rate; /* sample rate */
- unsigned long data_rate; /* data rate */
+ unsigned int sample_rate; /* sample rate */
+ unsigned int data_rate; /* data rate */
unsigned short bytes_sample; /* bytes per sample (all channels) */
unsigned short bits_sample; /* bits per sample (one channel) */
};
unsigned char buffer[256];
struct fmt fmt;
FILE *lfp;
- unsigned long i;
+ unsigned int i;
short sample;
- unsigned long size, wsize;
+ unsigned int size, wsize;
if ((lfp=fopen(name,"r")))
{
#include "main.h"
//#define __u8 unsigned char
//#define __u16 unsigned short
-//#define __u32 unsigned long
+//#define __u32 unsigned int
-unsigned long join_serial = 1; /* must be 1, because 0== no join */
+unsigned int join_serial = 1; /* must be 1, because 0== no join */
//JOIN_STATES
/*
* find the join with join_id
*/
-class Join *find_join_id(unsigned long join_id)
+class Join *find_join_id(unsigned int join_id)
{
class Join *join = join_first;
/* epoint sends a message to a join
*
*/
-void Join::message_epoint(unsigned long epoint_id, int message_type, union parameter *param)
+void Join::message_epoint(unsigned int epoint_id, int message_type, union parameter *param)
{
}
Join();
virtual ~Join();
class Join *next; /* next node in list of joins */
- virtual void message_epoint(unsigned long epoint_id, int message, union parameter *param);
+ virtual void message_epoint(unsigned int epoint_id, int message, union parameter *param);
virtual int handler(void);
- unsigned long j_type; /* join type (pbx or asterisk) */
- unsigned long j_serial; /* serial/unique number of join */
+ unsigned int j_type; /* join type (pbx or asterisk) */
+ unsigned int j_serial; /* serial/unique number of join */
};
void join_free(void);
extern class Join *join_first;
-class Join *find_join_id(unsigned long join_id);
+class Join *find_join_id(unsigned int join_id);
#include "main.h"
//#define __u8 unsigned char
//#define __u16 unsigned short
-//#define __u32 unsigned long
+//#define __u32 unsigned int
/* notify endpoint about state change (if any) */
/*
* bridging is only possible with two connected endpoints
*/
-void JoinPBX::bridge_data(unsigned long epoint_from, struct join_relation *relation_from, union parameter *param)
+void JoinPBX::bridge_data(unsigned int epoint_from, struct join_relation *relation_from, union parameter *param)
{
struct join_relation *relation_to;
/* count number of relations in a join
*/
-int joinpbx_countrelations(unsigned long join_id)
+int joinpbx_countrelations(unsigned int join_id)
{
struct join_relation *relation;
int i;
/* epoint sends a message to a join
*
*/
-void JoinPBX::message_epoint(unsigned long epoint_id, int message_type, union parameter *param)
+void JoinPBX::message_epoint(unsigned int epoint_id, int message_type, union parameter *param)
{
class Join *cl;
struct join_relation *relation, *reltemp;
* if other outgoing endpoints already exists, they are release as well.
* note: if this functions fails, it will destroy its own join object!
*/
-int JoinPBX::out_setup(unsigned long epoint_id, int message_type, union parameter *param, char *newnumber)
+int JoinPBX::out_setup(unsigned int epoint_id, int message_type, union parameter *param, char *newnumber)
{
struct join_relation *relation;
struct lcr_msg *message;
struct join_relation { /* relation to an interface */
struct join_relation *next; /* next node */
int type; /* type of relation */
- unsigned long epoint_id; /* interface to link join to */
+ unsigned int epoint_id; /* interface to link join to */
int channel_state; /* if audio is available */
int rx_state; /* current state of what we received from endpoint */
int tx_state; /* current state of what we sent to endpoint */
public:
JoinPBX(class Endpoint *epoint);
~JoinPBX();
- void message_epoint(unsigned long epoint_id, int message, union parameter *param);
+ void message_epoint(unsigned int epoint_id, int message, union parameter *param);
int handler(void);
int release(struct join_relation *relation, int location, int cause);
int j_partyline_jingle; /* also play jingle on join/leave */
void bridge(void);
- void bridge_data(unsigned long epoint_from, struct join_relation *relation_from, union parameter *param);
+ void bridge_data(unsigned int epoint_from, struct join_relation *relation_from, union parameter *param);
void remove_relation(struct join_relation *relation);
struct join_relation *add_relation(void);
- int out_setup(unsigned long epoint_id, int message, union parameter *param, char *newnumber);
+ int out_setup(unsigned int epoint_id, int message, union parameter *param, char *newnumber);
void play_jingle(int in);
};
void joinpbx_debug(class JoinPBX *joinpbx, char *function);
-int joinpbx_countrelations(unsigned long join_id);
+int joinpbx_countrelations(unsigned int join_id);
int track_notify(int oldstate, int notify);
#include "main.h"
//#define __u8 unsigned char
//#define __u16 unsigned short
-//#define __u32 unsigned long
+//#define __u32 unsigned int
/*
* constructor for a new join
* the join will have a relation to the calling endpoint
*/
-JoinRemote::JoinRemote(unsigned long serial, char *remote_name, int remote_id) : Join()
+JoinRemote::JoinRemote(unsigned int serial, char *remote_name, int remote_id) : Join()
{
PDEBUG(DEBUG_JOIN, "Constructor(new join)");
union parameter param;
}
-void JoinRemote::message_epoint(unsigned long epoint_id, int message_type, union parameter *param)
+void JoinRemote::message_epoint(unsigned int epoint_id, int message_type, union parameter *param)
{
/* if endpoint has just been removed, but still a message in the que */
if (epoint_id != j_epoint_id)
}
}
-void message_bchannel_to_remote(unsigned long remote_id, unsigned long ref, int type, unsigned long handle, int tx_gain, int rx_gain, char *pipeline, unsigned char *crypt, int crypt_len, int crypt_type)
+void message_bchannel_to_remote(unsigned int remote_id, unsigned int ref, int type, unsigned int handle, int tx_gain, int rx_gain, char *pipeline, unsigned char *crypt, int crypt_len, int crypt_type)
{
union parameter param;
class JoinRemote : public Join
{
public:
- JoinRemote(unsigned long serial, char *remote_name, int remote_id);
+ JoinRemote(unsigned int serial, char *remote_name, int remote_id);
~JoinRemote();
- void message_epoint(unsigned long epoint_id, int message, union parameter *param);
+ void message_epoint(unsigned int epoint_id, int message, union parameter *param);
void message_remote(int message_type, union parameter *param);
int handler(void);
int j_remote_id;
char j_remote_name[32];
- unsigned long j_epoint_id;
+ unsigned int j_epoint_id;
};
-void message_bchannel_to_remote(unsigned long remote_id, unsigned long ref, int type, unsigned long handle, int tx_gain, int rx_gain, char *pipeline, unsigned char *crypt, int crypt_len, int crypt_type);
+void message_bchannel_to_remote(unsigned int remote_id, unsigned int ref, int type, unsigned int handle, int tx_gain, int rx_gain, char *pipeline, unsigned char *crypt, int crypt_len, int crypt_type);
#define LOGLINES 128
char logline[LOGLINES][512];
-unsigned long logcur = 0;
+unsigned int logcur = 0;
int logfh = -1;
char logfile[128];
}
int debug_epoint(struct admin_message *msg, struct admin_message *m, int line, int i, int vline)
{
- unsigned long epoint = m[i].u.e.serial;
+ unsigned int epoint = m[i].u.e.serial;
char buffer[256];
unsigned char c;
int j, jj;
}
int debug_join(struct admin_message *msg, struct admin_message *m, int line, int i)
{
- unsigned long join = m[i].u.j.serial;
+ unsigned int join = m[i].u.j.serial;
char buffer[256];
int j, jj;
*p;
int line, offset = 0, hoffset = 0;
int i, ii, j, jj, k;
- unsigned long l, ll;
+ unsigned int l, ll;
int num;
int len;
int off;
int stimeout = 0, ptimeout = 0, atimeout = 0, ctimeout = 0;
int l;
double timer = 0, now_d;
- unsigned long on = 1;
+ unsigned int on = 1;
struct timeval now_tv;
struct timezone now_tz;
int los, ais, rdi, slip_tx, slip_rx;
int channels;
char busy[256]; /* if port is idle(0) busy(1) */
- unsigned long port[256]; /* current port */
+ unsigned int port[256]; /* current port */
};
struct admin_response_remote {
};
struct admin_response_join {
- unsigned long serial; /* join serial number */
+ unsigned int serial; /* join serial number */
char remote[32]; /* remote application name */
- unsigned long partyline;
+ unsigned int partyline;
};
struct admin_response_epoint {
- unsigned long serial;
- unsigned long join; /* link to join */
+ unsigned int serial;
+ unsigned int join; /* link to join */
// int join_notify; /* if relation notified on hold */
// int join_hold; /* if relation on hold */
int rx_state;
};
struct admin_response_port {
- unsigned long serial; /* port serial number */
+ unsigned int serial; /* port serial number */
char name[64]; /* name of port */
- unsigned long epoint; /* link to epoint */
+ unsigned int epoint; /* link to epoint */
int state;
int isdn; /* if port is isdn */
int isdn_chan; /* bchannel number */
struct admin_msg {
int type; /* type of message */
- unsigned long ref; /* reference to individual endpoints */
+ unsigned int ref; /* reference to individual endpoints */
union parameter param; /* parameter union */
};
unsigned char mISDN_rand[256];
int mISDN_rand_count = 0;
-unsigned long mt_assign_pid = ~0;
+unsigned int mt_assign_pid = ~0;
int mISDNsocket = -1;
*/
static struct isdn_message {
char *name;
- unsigned long value;
+ unsigned int value;
} isdn_message[] = {
{"PH_ACTIVATE", L1_ACTIVATE_REQ},
{"PH_DEACTIVATE", L1_DEACTIVATE_REQ},
" INDICATION",
" RESPONSE",
};
-void l1l2l3_trace_header(struct mISDNport *mISDNport, class PmISDN *port, unsigned long msg, int direction)
+void l1l2l3_trace_header(struct mISDNport *mISDNport, class PmISDN *port, unsigned int msg, int direction)
{
int i;
char msgtext[64] = "<<UNKNOWN MESSAGE>>";
/*
* send control information to the channel (dsp-module)
*/
-void ph_control(struct mISDNport *mISDNport, class PmISDN *isdnport, unsigned long sock, unsigned long c1, unsigned long c2, char *trace_name, int trace_value)
+void ph_control(struct mISDNport *mISDNport, class PmISDN *isdnport, int sock, unsigned int c1, unsigned int c2, char *trace_name, int trace_value)
{
unsigned char buffer[MISDN_HEADER_LEN+sizeof(int)+sizeof(int)];
struct mISDNhead *ctrl = (struct mISDNhead *)buffer;
- unsigned long *d = (unsigned long *)(buffer+MISDN_HEADER_LEN);
+ unsigned int *d = (unsigned int *)(buffer+MISDN_HEADER_LEN);
int ret;
if (sock < 0)
end_trace();
}
-void ph_control_block(struct mISDNport *mISDNport, class PmISDN *isdnport, int sock, unsigned long c1, void *c2, int c2_len, char *trace_name, int trace_value)
+void ph_control_block(struct mISDNport *mISDNport, class PmISDN *isdnport, int sock, unsigned int c1, void *c2, int c2_len, char *trace_name, int trace_value)
{
unsigned char buffer[MISDN_HEADER_LEN+sizeof(int)+c2_len];
struct mISDNhead *ctrl = (struct mISDNhead *)buffer;
- unsigned long *d = (unsigned long *)(buffer+MISDN_HEADER_LEN);
+ unsigned int *d = (unsigned int *)(buffer+MISDN_HEADER_LEN);
int ret;
if (sock < 0)
static int _bchannel_create(struct mISDNport *mISDNport, int i)
{
int ret;
- unsigned long on = 1;
+ unsigned int on = 1;
struct sockaddr_mISDN addr;
if (mISDNport->b_socket[i] > -1)
class PmISDN *b_port = mISDNport->b_port[i];
int state = mISDNport->b_state[i];
double timer = mISDNport->b_timer[i];
- unsigned long p_m_remote_ref = 0;
- unsigned long p_m_remote_id = 0;
+ unsigned int p_m_remote_ref = 0;
+ unsigned int p_m_remote_id = 0;
int p_m_tx_gain = 0;
int p_m_rx_gain = 0;
char *p_m_pipeline = NULL;
unsigned char *p_m_crypt_key = NULL;
int p_m_crypt_key_len = 0;
int p_m_crypt_key_type = 0;
- unsigned long portid = (mISDNport->portnum<<8) + i+1+(i>=15);
+ unsigned int portid = (mISDNport->portnum<<8) + i+1+(i>=15);
if (b_port)
{
}
/* process bchannel export/import message from join */
-void message_bchannel_from_remote(class JoinRemote *joinremote, int type, unsigned long handle)
+void message_bchannel_from_remote(class JoinRemote *joinremote, int type, unsigned int handle)
{
class Endpoint *epoint;
class Port *port;
ii = mISDNport->b_num;
while(i < ii)
{
- if ((unsigned long)(mISDNport->portnum<<8)+i+1+(i>=15) == handle)
+ if ((unsigned int)(mISDNport->portnum<<8)+i+1+(i>=15) == handle)
break;
i++;
}
*/
void PmISDN::bchannel_receive(struct mISDNhead *hh, unsigned char *data, int len)
{
- unsigned long cont = *((unsigned long *)data);
+ unsigned int cont = *((unsigned int *)data);
unsigned char *data_temp;
- unsigned long length_temp;
+ unsigned int length_temp;
struct lcr_msg *message;
unsigned char *p;
int l;
/* MESSAGE_mISDNSIGNAL */
//extern struct lcr_msg *dddebug;
-void PmISDN::message_mISDNsignal(unsigned long epoint_id, int message_id, union parameter *param)
+void PmISDN::message_mISDNsignal(unsigned int epoint_id, int message_id, union parameter *param)
{
switch(param->mISDNsignal.message)
{
}
/* MESSAGE_CRYPT */
-void PmISDN::message_crypt(unsigned long epoint_id, int message_id, union parameter *param)
+void PmISDN::message_crypt(unsigned int epoint_id, int message_id, union parameter *param)
{
struct lcr_msg *message;
/*
* endpoint sends messages to the port
*/
-int PmISDN::message_epoint(unsigned long epoint_id, int message_id, union parameter *param)
+int PmISDN::message_epoint(unsigned int epoint_id, int message_id, union parameter *param)
{
if (Port::message_epoint(epoint_id, message_id, param))
return(1);
int b_state[128]; /* statemachine, 0 = IDLE */
double b_timer[128]; /* timer for state machine */
int b_remote_id[128]; /* the socket currently exported (0=none) */
- unsigned long b_remote_ref[128]; /* the ref currently exported */
+ unsigned int b_remote_ref[128]; /* the ref currently exported */
int locally; /* local causes are sent as local causes not remote */
int los, ais, rdi, slip_rx, slip_tx;
};
int mISDN_handler(void);
void enc_ie_cause_standalone(struct l3_msg *l3m, int location, int cause);
int stack2manager(struct mISDNport *mISDNport, unsigned int cmd, unsigned int pid, struct l3_msg *l3m);
-void ph_control(struct mISDNport *mISDNport, class PmISDN *isdnport, unsigned long handle, unsigned long c1, unsigned long c2, char *trace_name, int trace_value);
-void ph_control_block(struct mISDNport *mISDNport, unsigned long handle, unsigned long c1, void *c2, int c2_len, char *trace_name, int trace_value);
+void ph_control(struct mISDNport *mISDNport, class PmISDN *isdnport, unsigned int handle, unsigned int c1, unsigned int c2, char *trace_name, int trace_value);
+void ph_control_block(struct mISDNport *mISDNport, unsigned int handle, unsigned int c1, void *c2, int c2_len, char *trace_name, int trace_value);
void chan_trace_header(struct mISDNport *mISDNport, class PmISDN *port, char *msgtext, int direction);
-void l1l2l3_trace_header(struct mISDNport *mISDNport, class PmISDN *port, unsigned long prim, int direction);
+void l1l2l3_trace_header(struct mISDNport *mISDNport, class PmISDN *port, unsigned int prim, int direction);
void bchannel_event(struct mISDNport *mISDNport, int i, int event);
-void message_bchannel_from_remote(class JoinRemote *joinremote, int type, unsigned long handle);
+void message_bchannel_from_remote(class JoinRemote *joinremote, int type, unsigned int handle);
/* mISDN port classes */
void bchannel_receive(struct mISDNhead *hh, unsigned char *data, int len);
int handler(void);
void transmit(unsigned char *buffer, int length);
- int message_epoint(unsigned long epoint_id, int message, union parameter *param);
- void message_mISDNsignal(unsigned long epoint_id, int message_id, union parameter *param);
- void message_crypt(unsigned long epoint_id, int message_id, union parameter *param);
+ int message_epoint(unsigned int epoint_id, int message, union parameter *param);
+ void message_mISDNsignal(unsigned int epoint_id, int message_id, union parameter *param);
+ void message_crypt(unsigned int epoint_id, int message_id, union parameter *param);
struct mISDNport *p_m_mISDNport; /* pointer to port */
int p_m_delay; /* use delay instead of dejitter */
int p_m_tx_gain, p_m_rx_gain; /* volume shift (0 = no change) */
int p_m_joindata; /* the call requires data due to no briging capability */
int p_m_load; /* current data in dsp tx buffer */
- unsigned long p_m_last_tv_sec; /* time stamp of last handler call, (to sync audio data */
- unsigned long p_m_last_tv_msec;
+ unsigned int p_m_last_tv_sec; /* time stamp of last handler call, (to sync audio data */
+ unsigned int p_m_last_tv_msec;
// int p_m_fromup_buffer_readp; /* buffer for audio from remote endpoint */
// int p_m_fromup_buffer_writep;
// unsigned char p_m_fromup_buffer[FROMUP_BUFFER_SIZE];
int p_m_crypt_listen_state;
int p_m_crypt_listen_len;
unsigned char p_m_crypt_listen_msg[1100];
- unsigned long p_m_crypt_listen_crc;
+ unsigned int p_m_crypt_listen_crc;
void cryptman_listen_bch(unsigned char *p, int l);
void set_tone(char *dir, char *name);
// long long p_m_jitterdropped; /* number of bytes dropped */
int p_m_delete; /* true if obj. must del. */
int p_m_hold; /* if port is on hold */
- unsigned long p_m_timeout; /* timeout of timers */
+ unsigned int p_m_timeout; /* timeout of timers */
time_t p_m_timer; /* start of timer */
unsigned char p_m_remote_ref; /* join to export bchannel to */
unsigned char p_m_remote_id; /* sock to export bchannel to */
/* memory allocation with setting to zero */
#define MALLOC(size) _malloc(size, __FUNCTION__, __LINE__)
-static inline void *_malloc(unsigned long size, const char *function, int line)
+static inline void *_malloc(unsigned int size, const char *function, int line)
{
void *addr;
addr = malloc(size);
}
-void _printdebug(const char *function, int line, unsigned long mask, const char *fmt, ...)
+void _printdebug(const char *function, int line, unsigned int mask, const char *fmt, ...)
{
char buffer[4096];
va_list args;
#define PERROR(fmt, arg...) _printerror(__FUNCTION__, __LINE__, fmt, ## arg)
#define PDEBUG_RUNTIME(mask, fmt, arg...) _printdebug(NULL, 0, mask, fmt, ## arg)
#define PERROR_RUNTIME(fmt, arg...) _printerror(NULL, 0, fmt, ## arg)
-void _printdebug(const char *function, int line, unsigned long mask, const char *fmt, ...);
+void _printdebug(const char *function, int line, unsigned int mask, const char *fmt, ...);
void _printerror(const char *function, int line, const char *fmt, ...);
#define DEBUG_FUNC
void debug(const char *function, int line, char *prefix, char *buffer);
struct param_bchannel {
int type; /* BCHANNEL_* */
- unsigned long handle; /* bchannel stack/portid */
+ unsigned int handle; /* bchannel stack/portid */
int tx_gain, rx_gain;
char pipeline[256];
unsigned char crypt[128];
struct lcr_msg *next;
int type; /* type of message */
int flow; /* from where to where */
- unsigned long id_from; /* in case of flow==PORT_TO_EPOINT: id_from is the port's serial, id_to is the epoint's serial */
- unsigned long id_to;
+ unsigned int id_from; /* in case of flow==PORT_TO_EPOINT: id_from is the port's serial, id_to is the epoint's serial */
+ unsigned int id_to;
int keep;
union parameter param;
};
class Port *port_first = NULL;
-unsigned long port_serial = 1; /* must be 1, because 0== no port */
+unsigned int port_serial = 1; /* must be 1, because 0== no port */
/* free epointlist relation
}
-void Port::free_epointid(unsigned long epoint_id)
+void Port::free_epointid(unsigned int epoint_id)
{
struct epoint_list *temp, **tempp;
/* create new epointlist relation
*/
-struct epoint_list *Port::epointlist_new(unsigned long epoint_id)
+struct epoint_list *Port::epointlist_new(unsigned int epoint_id)
{
struct epoint_list *epointlist, **epointlistpointer;
/*
* find the port with port_id
*/
-class Port *find_port_id(unsigned long port_id)
+class Port *find_port_id(unsigned int port_id)
{
class Port *port = port_first;
*/
void Port::set_vbox_play(char *name, int offset)
{
- signed long size;
+ signed int size;
struct lcr_msg *message;
/* use ser_box_tone() */
* therefor a return=1 means: stop, no more processing
*/
//extern struct lcr_msg *dddebug;
-int Port::message_epoint(unsigned long epoint_id, int message_id, union parameter *param)
+int Port::message_epoint(unsigned int epoint_id, int message_id, union parameter *param)
{
/* check if we got audio data from one remote port */
switch(message_id)
struct fmt {
unsigned short stereo; /* 1 = mono, 2 = stereo */
unsigned short channels; /* number of channels */
- unsigned long sample_rate; /* sample rate */
- unsigned long data_rate; /* data rate */
+ unsigned int sample_rate; /* sample rate */
+ unsigned int data_rate; /* data rate */
unsigned short bytes_sample; /* bytes per sample (all channels) */
unsigned short bits_sample; /* bits per sample (one channel) */
};
void Port::close_record(int beep, int mute)
{
static signed short beep_mono[256];
- unsigned long size, wsize;
+ unsigned int size, wsize;
struct fmt fmt;
char filename[512], indexname[512];
FILE *fp;
unsigned char write_buffer[1024], *d;
signed short *s;
int free, i, ii;
- signed long sample;
+ signed int sample;
/* no recording */
if (!p_record || !length)
/* structure of epoint_list */
struct epoint_list {
struct epoint_list *next;
- unsigned long epoint_id;
+ unsigned int epoint_id;
int active;
};
-inline unsigned long ACTIVE_EPOINT(struct epoint_list *epointlist)
+inline unsigned int ACTIVE_EPOINT(struct epoint_list *epointlist)
{
while(epointlist)
{
return(0);
}
-inline unsigned long INACTIVE_EPOINT(struct epoint_list *epointlist)
+inline unsigned int INACTIVE_EPOINT(struct epoint_list *epointlist)
{
while(epointlist)
{
class Port *next; /* next port in list */
int p_type; /* type of port */
virtual int handler(void);
- virtual int message_epoint(unsigned long epoint_id, int message, union parameter *param);
+ virtual int message_epoint(unsigned int epoint_id, int message, union parameter *param);
virtual void set_echotest(int echotest);
virtual void set_tone(char *dir, char *name);
virtual int read_audio(unsigned char *buffer, int length);
char p_tone_fh; /* file descriptor of current tone or -1 if not open */
void *p_tone_fetched; /* pointer to fetched data */
int p_tone_codec; /* codec that the tone is made of */
- long p_tone_size, p_tone_left; /* size of tone in bytes (not samples), bytes left */
- long p_tone_eof; /* flag that makes the use of eof message */
- long p_tone_counter; /* flag that makes the use of counter message */
- long p_tone_speed; /* speed of current tone, 1=normal, may also be negative */
+ signed int p_tone_size, p_tone_left; /* size of tone in bytes (not samples), bytes left */
+ signed int p_tone_eof; /* flag that makes the use of eof message */
+ signed int p_tone_counter; /* flag that makes the use of counter message */
+ signed int p_tone_speed; /* speed of current tone, 1=normal, may also be negative */
// char p_knock_fh; /* file descriptor of knocking tone or -1 if not open */
// void *p_knock_fetched; /* pointer to fetched data */
// int p_knock_codec;
-// long p_knock_size, p_knock_left;
+// signed int p_knock_size, p_knock_left;
void set_vbox_tone(char *dir, char *name);/* tone of answering machine */
void set_vbox_play(char *name, int offset); /* sample of answ. */
void set_vbox_speed(int speed); /* speed of answ. */
/* identification */
- unsigned long p_serial; /* serial unique id of port */
+ unsigned int p_serial; /* serial unique id of port */
char p_name[128]; /* name of port or token (h323) */
/* endpoint relation */
FILE *p_record; /* recording fp: if not NULL, recording is enabled */
int p_record_type; /* codec to use: RECORD_MONO, RECORD_STEREO, ... */
int p_record_skip; /* skip bytes before writing the sample */
- unsigned long p_record_length; /* size of what's written so far */
+ unsigned int p_record_length; /* size of what's written so far */
signed short p_record_buffer[RECORD_BUFFER_LENGTH];
- unsigned long p_record_buffer_readp;
- unsigned long p_record_buffer_writep;
+ unsigned int p_record_buffer_readp;
+ unsigned int p_record_buffer_writep;
int p_record_buffer_dir; /* current direction in buffer */
char p_record_filename[256]; /* record filename */
int p_record_vbox_email_file;
void free_epointlist(struct epoint_list *epointlist);
- void free_epointid(unsigned long epoint_id);
- struct epoint_list *epointlist_new(unsigned long epoint_id);
+ void free_epointid(unsigned int epoint_id);
+ struct epoint_list *epointlist_new(unsigned int epoint_id);
};
extern Port *port_first;
-extern unsigned long port_serial;
+extern unsigned int port_serial;
class Port *find_port_with_token(char *name);
-class Port *find_port_id(unsigned long port_id);
+class Port *find_port_id(unsigned int port_id);
#endif // PORT_HEADER
struct route_rule *rule = ruleset->rule_first;
struct route_cond *cond;
struct route_action *action = NULL;
- unsigned long comp_len;
+ unsigned int comp_len;
int j, jj;
char callerid[64], redirid[64];
int integer;
case MATCH_FREE:
case MATCH_NOTFREE:
- if (!(comp_len = (unsigned long)strchr(cond->string_value, ':')))
+ if (!(comp_len = (unsigned int)strchr(cond->string_value, ':')))
break;
- comp_len = comp_len-(unsigned long)cond->string_value;
+ comp_len = comp_len-(unsigned int)cond->string_value;
avail = 0;
mISDNport = mISDNport_first;
while(mISDNport)
match_string_prefix:
comp_len = strlen(cond->string_value); /* because we must reach value's length */
/* we must have greater or equal length to values */
- if ((unsigned long)strlen(string) < comp_len)
+ if ((unsigned int)strlen(string) < comp_len)
{
/* special case for unfinished dialing */
if (cond->match == MATCH_DIALING)
*/
int admin_init(void)
{
- unsigned long on = 1;
+ unsigned int on = 1;
/* open and bind socket */
if ((sock = socket(PF_UNIX, SOCK_STREAM, 0)) < 0)
*/
int admin_release(struct admin_queue **responsep, char *message)
{
- unsigned long id;
+ unsigned int id;
struct admin_queue *response; /* response pointer */
class EndpointAppPBX *apppbx;
/*
* this function is called for every message to remote socket
*/
-int admin_message_from_join(int remote_id, unsigned long ref, int message_type, union parameter *param)
+int admin_message_from_join(int remote_id, unsigned int ref, int message_type, union parameter *param)
{
struct admin_list *admin;
struct admin_queue **responsep; /* response pointer */
int len;
int new_sock;
socklen_t sock_len = sizeof(sock_address);
- unsigned long on = 1;
+ unsigned int on = 1;
int work = 0; /* if work was done */
struct Endpoint *epoint;
struct admin_queue {
struct admin_queue *next;
- ulong offset; /* current offset writing */
- ulong num; /* number of admin messages */
+ unsigned int offset; /* current offset writing */
+ unsigned int num; /* number of admin messages */
struct admin_message am[0];
};
int sockserial;
char remote_name[32]; /* socket is connected remote application */
struct admin_trace_req trace; /* stores trace, if detail != 0 */
- unsigned long epointid;
+ unsigned int epointid;
struct admin_queue *response;
};
int admin_handle(void);
void admin_call_response(int adminid, int message, char *connected, int cause, int location, int notify);
int admin_message_to_join(struct admin_message *msg, int remote_id);
-int admin_message_from_join(int remote_id, unsigned long ref, int message_type, union parameter *param);
+int admin_message_from_join(int remote_id, unsigned int ref, int message_type, union parameter *param);
struct fmt {
unsigned short stereo; /* 1 = pcm, 2 = adpcm */
unsigned short channels; /* number of channels */
- unsigned long sample_rate; /* sample rate */
- unsigned long data_rate; /* data rate */
+ unsigned int sample_rate; /* sample rate */
+ unsigned int data_rate; /* data rate */
unsigned short bytes_sample; /* bytes per sample (all channels) */
unsigned short bits_sample; /* bits per sample (one channel) */
};
-int open_tone(char *file, int *codec, signed long *length, signed long *left)
+int open_tone(char *file, int *codec, signed int *length, signed int *left)
{
int fh;
char filename[256];
unsigned char buffer[256];
struct fmt *fmt;
int channels, bytes;
- unsigned long size, chunk;
+ unsigned int size, chunk;
int gotfmt = 0;
struct stat _stat;
int linksize;
if (codec)
*codec = CODEC_MONO;
if (length)
- *length = ((signed long)chunk)>>1;
+ *length = ((signed int)chunk)>>1;
if (left)
- *left = ((signed long)chunk)>>1;
+ *left = ((signed int)chunk)>>1;
// printf("left=%d\n",*left);
} else
if (bytes==2 && channels==2)
if (codec)
*codec = CODEC_STEREO;
if (length)
- *length = ((signed long)chunk)>>2;
+ *length = ((signed int)chunk)>>2;
if (left)
- *left = ((signed long)chunk)>>2;
+ *left = ((signed int)chunk)>>2;
} else
if (bytes==1 && channels==1)
{
if (codec)
*codec = CODEC_8BIT;
if (length)
- *length = (signed long)chunk;
+ *length = (signed int)chunk;
if (left)
- *left = (signed long)chunk;
+ *left = (signed int)chunk;
} else
{
close(fh);
* the len must be the number of samples, NOT for the bytes to read!!
* the data returned is law-code
*/
-int read_tone(int fh, unsigned char *buffer, int codec, int len, signed long size, signed long *left, int speed)
+int read_tone(int fh, unsigned char *buffer, int codec, int len, signed int size, signed int *left, int speed)
{
int l;
int offset;
signed short buffer16[len], *buf16 = buffer16;
signed short buffer32[len<<1], *buf32 = buffer32;
unsigned char buffer8[len], *buf8 = buffer8;
- signed long sample;
+ signed int sample;
int i = 0;
//printf("left=%ld\n",*left);
char filename[256], name[256];
int fh;
int tone_codec;
- signed long tone_size, tone_left;
- unsigned long memory = 0;
+ signed int tone_size, tone_left;
+ unsigned int memory = 0;
int samples = 0;
/* if disabled */
/*
* opens the fetched tone (if available)
*/
-void *open_tone_fetched(char *dir, char *file, int *codec, signed long *length, signed long *left)
+void *open_tone_fetched(char *dir, char *file, int *codec, signed int *length, signed int *left)
{
struct toneset *toneset;
struct tonesettone *tonesettone;
* read from fetched tone, check size
* the len must be the number of samples, NOT for the bytes to read!!
*/
-int read_tone_fetched(void **fetched, void *buffer, int len, signed long size, signed long *left, int speed)
+int read_tone_fetched(void **fetched, void *buffer, int len, signed int size, signed int *left, int speed)
{
int l;
//printf("left=%ld\n",*left);
** **
\*****************************************************************************/
-int open_tone(char *file, int *codec, signed long *length, signed long *left);
-int read_tone(int fh, unsigned char *buffer, int codec, int len, signed long size, signed long *left, int speed);
+int open_tone(char *file, int *codec, signed int *length, signed int *left);
+int read_tone(int fh, unsigned char *buffer, int codec, int len, signed int size, signed int *left, int speed);
int fetch_tones(void);
void free_tones(void);
-void *open_tone_fetched(char *dir, char *file, int *codec, signed long *length, signed long *left);
-int read_tone_fetched(void **fetched, void *buffer, int len, signed long size, signed long *left, int speed);
+void *open_tone_fetched(char *dir, char *file, int *codec, signed int *length, signed int *left);
+int read_tone_fetched(void **fetched, void *buffer, int len, signed int size, signed int *left, int speed);
/* tone sets */
struct tonesettone {
char caller[64];
char dialing[64];
int direction;
- unsigned long sec, usec;
+ unsigned int sec, usec;
/* type */
int category;
- unsigned long serial;
+ unsigned int serial;
char name[64];
/* elements */
int VBoxPort::handler(void)
{
struct lcr_msg *message;
- unsigned long tosend;
+ unsigned int tosend;
unsigned char buffer[ISDN_TRANSMIT];
time_t currenttime;
class Endpoint *epoint;
}
/* calculate the number of bytes */
- tosend = (unsigned long)((now_d-p_vbox_audio_start)*8000) - p_vbox_audio_transferred;
+ tosend = (unsigned int)((now_d-p_vbox_audio_start)*8000) - p_vbox_audio_transferred;
/* wait for more */
if (tosend < sizeof(buffer))
/*
* endpoint sends messages to the vbox port
*/
-int VBoxPort::message_epoint(unsigned long epoint_id, int message_id, union parameter *param)
+int VBoxPort::message_epoint(unsigned int epoint_id, int message_id, union parameter *param)
{
struct lcr_msg *message;
class Endpoint *epoint;
public:
VBoxPort(int type, struct port_settings *settings);
~VBoxPort();
- int message_epoint(unsigned long epoint_id, int message, union parameter *param);
+ int message_epoint(unsigned int epoint_id, int message, union parameter *param);
int handler(void);
private:
struct EndpointAppPBX *p_vbox_apppbx; /* pbx application */
- unsigned long p_vbox_timeout; /* timeout for recording */
+ unsigned int p_vbox_timeout; /* timeout for recording */
char p_vbox_extension[32]; /* current extension */
// int p_vbox_recording; /* if currently recording */
int p_vbox_announce_fh; /* the announcement filehandler */
int p_vbox_announce_codec; /* the announcement codec */
- signed long p_vbox_announce_left; /* the number of bytes left of announcement sample */
- signed long p_vbox_announce_size; /* size of current announcement (in bytes) */
+ signed int p_vbox_announce_left; /* the number of bytes left of announcement sample */
+ signed int p_vbox_announce_size; /* size of current announcement (in bytes) */
int p_vbox_mode; /* type of recording VBOX_MODE_* */
double p_vbox_audio_start; /* time stamp of starting of audio (<1 == not yet started) */
- unsigned long p_vbox_audio_transferred; /* number of samples sent to endpoint */
- signed long p_vbox_record_start; /* start for recording */
- signed long p_vbox_record_limit; /* limit for recording */
+ unsigned int p_vbox_audio_transferred; /* number of samples sent to endpoint */
+ signed int p_vbox_record_start; /* start for recording */
+ signed int p_vbox_record_limit; /* limit for recording */
struct extension p_vbox_ext; /* save settings of extension */
};