|
|
|
@ -1,7 +1,8 @@
|
|
|
|
|
$OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
$OpenBSD: patch-channels_chan_unistim_c,v 1.3 2011/07/12 19:54:39 sthen Exp $
|
|
|
|
|
|
|
|
|
|
# Patch is from https://bugs.digium.com/view.php?id=18229, in particular, chan_unistim.c.r299906-6.diff
|
|
|
|
|
--- channels/chan_unistim.c.orig Wed Jul 14 16:48:36 2010
|
|
|
|
|
+++ channels/chan_unistim.c Fri Jun 24 14:21:26 2011
|
|
|
|
|
--- channels/chan_unistim.c.orig Thu May 5 18:53:45 2011
|
|
|
|
|
+++ channels/chan_unistim.c Tue Jul 12 12:28:03 2011
|
|
|
|
|
@@ -32,6 +32,15 @@
|
|
|
|
|
* \ingroup channel_drivers
|
|
|
|
|
*/
|
|
|
|
@ -17,8 +18,8 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
+
|
|
|
|
|
#include "asterisk.h"
|
|
|
|
|
|
|
|
|
|
ASTERISK_FILE_VERSION(__FILE__, "$Revision: 1.2 $")
|
|
|
|
|
@@ -69,6 +78,8 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision: 1.2 $")
|
|
|
|
|
ASTERISK_FILE_VERSION(__FILE__, "$Revision: 1.3 $")
|
|
|
|
|
@@ -69,6 +78,8 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision: 1.3 $")
|
|
|
|
|
#include "asterisk/musiconhold.h"
|
|
|
|
|
#include "asterisk/causes.h"
|
|
|
|
|
#include "asterisk/indications.h"
|
|
|
|
@ -27,7 +28,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
|
|
|
|
|
/*! Beware, G729 and G723 are not supported by asterisk, except with the proper licence */
|
|
|
|
|
#define CAPABILITY AST_FORMAT_ALAW | AST_FORMAT_ULAW /* | AST_FORMAT_G729A | AST_FORMAT_G723_1 */
|
|
|
|
|
@@ -78,11 +89,14 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision: 1.2 $")
|
|
|
|
|
@@ -78,11 +89,14 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision: 1.3 $")
|
|
|
|
|
#define DEFAULTCALLERNAME " "
|
|
|
|
|
#define DEFAULTHEIGHT 3
|
|
|
|
|
#define USTM_LOG_DIR "unistimHistory"
|
|
|
|
@ -42,7 +43,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
/*! Try x times before removing the phone */
|
|
|
|
|
#define NB_MAX_RETRANSMIT 8
|
|
|
|
|
/*! Nb of milliseconds waited when no events are scheduled */
|
|
|
|
|
@@ -99,8 +113,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision: 1.2 $")
|
|
|
|
|
@@ -99,8 +113,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision: 1.3 $")
|
|
|
|
|
#define MAX_ENTRY_LOG 30
|
|
|
|
|
|
|
|
|
|
#define SUB_REAL 0
|
|
|
|
@ -69,7 +70,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
static void dummy(char *unused, ...)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
@@ -251,7 +274,10 @@ enum phone_state {
|
|
|
|
|
@@ -252,7 +275,10 @@ enum phone_state {
|
|
|
|
|
STATE_DIALPAGE,
|
|
|
|
|
STATE_RINGING,
|
|
|
|
|
STATE_CALL,
|
|
|
|
@ -80,7 +81,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
STATE_CLEANING,
|
|
|
|
|
STATE_HISTORY
|
|
|
|
|
};
|
|
|
|
|
@@ -302,45 +328,17 @@ enum phone_key {
|
|
|
|
|
@@ -303,45 +329,17 @@ enum phone_key {
|
|
|
|
|
KEY_INDEX = 0x7f
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
@ -135,7 +136,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
|
|
|
|
|
struct wsabuf {
|
|
|
|
|
u_long len;
|
|
|
|
|
@@ -360,7 +358,7 @@ struct systemtime {
|
|
|
|
|
@@ -361,7 +359,7 @@ struct systemtime {
|
|
|
|
|
|
|
|
|
|
struct unistim_subchannel {
|
|
|
|
|
ast_mutex_t lock;
|
|
|
|
@ -144,7 +145,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
unsigned int subtype;
|
|
|
|
|
/*! Asterisk channel used by the subchannel */
|
|
|
|
|
struct ast_channel *owner;
|
|
|
|
|
@@ -368,9 +366,14 @@ struct unistim_subchannel {
|
|
|
|
|
@@ -369,9 +367,14 @@ struct unistim_subchannel {
|
|
|
|
|
struct unistim_line *parent;
|
|
|
|
|
/*! RTP handle */
|
|
|
|
|
struct ast_rtp_instance *rtp;
|
|
|
|
@ -159,7 +160,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
@@ -382,14 +385,10 @@ struct unistim_line {
|
|
|
|
|
@@ -383,14 +386,10 @@ struct unistim_line {
|
|
|
|
|
char name[80];
|
|
|
|
|
/*! Like USTM/200\@black */
|
|
|
|
|
char fullname[80];
|
|
|
|
@ -174,7 +175,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
/*! CallerID Number */
|
|
|
|
|
char cid_num[AST_MAX_EXTENSION];
|
|
|
|
|
/*! Mailbox for MWI */
|
|
|
|
|
@@ -414,6 +413,7 @@ struct unistim_line {
|
|
|
|
|
@@ -415,6 +414,7 @@ struct unistim_line {
|
|
|
|
|
char parkinglot[AST_MAX_CONTEXT];
|
|
|
|
|
struct unistim_line *next;
|
|
|
|
|
struct unistim_device *parent;
|
|
|
|
@ -182,7 +183,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
@@ -422,19 +422,21 @@ struct unistim_line {
|
|
|
|
|
@@ -423,19 +423,21 @@ struct unistim_line {
|
|
|
|
|
static struct unistim_device {
|
|
|
|
|
int receiver_state; /*!< state of the receiver (see ReceiverState) */
|
|
|
|
|
int size_phone_number; /*!< size of the phone number */
|
|
|
|
@ -213,7 +214,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
char maintext0[25]; /*!< when the phone is idle, display this string on line 0 */
|
|
|
|
|
char maintext1[25]; /*!< when the phone is idle, display this string on line 1 */
|
|
|
|
|
char maintext2[25]; /*!< when the phone is idle, display this string on line 2 */
|
|
|
|
|
@@ -445,12 +447,16 @@ static struct unistim_device {
|
|
|
|
|
@@ -446,12 +448,16 @@ static struct unistim_device {
|
|
|
|
|
struct ast_tone_zone *tz; /*!< Tone zone for res_indications (ring, busy, congestion) */
|
|
|
|
|
char ringvolume; /*!< Ring volume */
|
|
|
|
|
char ringstyle; /*!< Ring melody */
|
|
|
|
@ -231,7 +232,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
char lst_cid[TEXT_LENGTH_MAX]; /*!< Last callerID received */
|
|
|
|
|
char lst_cnm[TEXT_LENGTH_MAX]; /*!< Last callername recevied */
|
|
|
|
|
char call_forward[AST_MAX_EXTENSION]; /*!< Forward number */
|
|
|
|
|
@@ -458,15 +464,14 @@ static struct unistim_device {
|
|
|
|
|
@@ -459,15 +465,14 @@ static struct unistim_device {
|
|
|
|
|
int previous_output; /*!< Previous output */
|
|
|
|
|
int volume; /*!< Default volume */
|
|
|
|
|
int mute; /*!< Mute mode */
|
|
|
|
@ -250,7 +251,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
struct unistimsession *session;
|
|
|
|
|
struct unistim_device *next;
|
|
|
|
|
} *devices = NULL;
|
|
|
|
|
@@ -489,9 +494,23 @@ static struct unistimsession {
|
|
|
|
|
@@ -490,9 +495,23 @@ static struct unistimsession {
|
|
|
|
|
struct wsabuf wsabufsend[MAX_BUF_NUMBER]; /*!< Size of each paquet stored in the buffer array & pointer to this buffer */
|
|
|
|
|
unsigned char buf[MAX_BUF_NUMBER][MAX_BUF_SIZE]; /*!< Buffer array used to keep the lastest non-acked paquets */
|
|
|
|
|
struct unistim_device *device;
|
|
|
|
@ -275,7 +276,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
/*!
|
|
|
|
|
* \page Unistim datagram formats
|
|
|
|
|
*
|
|
|
|
|
@@ -623,10 +642,14 @@ static const unsigned char packet_send_date_time2[] =
|
|
|
|
|
@@ -624,10 +643,14 @@ static const unsigned char packet_send_date_time2[] =
|
|
|
|
|
};
|
|
|
|
|
static const unsigned char packet_send_Contrast[] =
|
|
|
|
|
{ 0x17, 0x04, 0x24, /*Contrast */ 0x08 };
|
|
|
|
@ -294,7 +295,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
static const unsigned char packet_send_icon[] = { 0x17, 0x05, 0x14, /*pos */ 0x00, /*icon */ 0x25 }; /* display an icon in front of the text zone */
|
|
|
|
|
static const unsigned char packet_send_S7[] = { 0x17, 0x06, 0x0f, 0x30, 0x07, 0x07 };
|
|
|
|
|
static const unsigned char packet_send_set_pos_cursor[] =
|
|
|
|
|
@@ -657,6 +680,23 @@ static const unsigned char packet_send_status2[] =
|
|
|
|
|
@@ -658,6 +681,23 @@ static const unsigned char packet_send_status2[] =
|
|
|
|
|
{ 0x17, 0x0b, 0x19, /* pos [08|28|48|68] */ 0x00, /* text */ 0x20, 0x20, 0x20, 0x20,
|
|
|
|
|
0x20, 0x20, 0x20 /* end_text */ };
|
|
|
|
|
|
|
|
|
@ -318,7 +319,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
static const unsigned char packet_send_led_update[] = { 0x19, 0x04, 0x00, 0x00 };
|
|
|
|
|
|
|
|
|
|
static const unsigned char packet_send_query_basic_manager_04[] = { 0x1a, 0x04, 0x01, 0x04 };
|
|
|
|
|
@@ -717,14 +757,129 @@ static const struct ast_channel_tech unistim_tech = {
|
|
|
|
|
@@ -718,14 +758,129 @@ static const struct ast_channel_tech unistim_tech = {
|
|
|
|
|
.bridge = ast_rtp_instance_bridge,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
@ -451,7 +452,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
strerror(errno));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -950,10 +1105,44 @@ static void send_start_timer(struct unistimsession *pt
|
|
|
|
|
@@ -951,10 +1106,44 @@ static void send_start_timer(struct unistimsession *pt
|
|
|
|
|
BUFFSEND;
|
|
|
|
|
if (unistimdebug)
|
|
|
|
|
ast_verb(0, "Sending start timer\n");
|
|
|
|
@ -498,7 +499,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
static void send_stop_timer(struct unistimsession *pte)
|
|
|
|
|
{
|
|
|
|
|
BUFFSEND;
|
|
|
|
|
@@ -963,7 +1152,7 @@ static void send_stop_timer(struct unistimsession *pte
|
|
|
|
|
@@ -964,7 +1153,7 @@ static void send_stop_timer(struct unistimsession *pte
|
|
|
|
|
send_client(SIZE_HEADER + sizeof(packet_send_stop_timer), buffsend, pte);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -507,7 +508,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
{
|
|
|
|
|
BUFFSEND;
|
|
|
|
|
if (unistimdebug)
|
|
|
|
|
@@ -1021,9 +1210,9 @@ static void send_tone(struct unistimsession *pte, uint
|
|
|
|
|
@@ -1022,9 +1211,9 @@ static void send_tone(struct unistimsession *pte, uint
|
|
|
|
|
|
|
|
|
|
/* Positions for favorites
|
|
|
|
|
|--------------------|
|
|
|
|
@ -520,7 +521,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/* status (icons) : 00 = nothing, 2x/3x = see parser.h, 4x/5x = blink fast, 6x/7x = blink slow */
|
|
|
|
|
@@ -1040,44 +1229,122 @@ send_favorite(unsigned char pos, unsigned char status,
|
|
|
|
|
@@ -1041,44 +1230,122 @@ send_favorite(unsigned char pos, unsigned char status,
|
|
|
|
|
buffsend[10] = pos;
|
|
|
|
|
buffsend[24] = pos;
|
|
|
|
|
buffsend[25] = status;
|
|
|
|
@ -657,7 +658,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
if (d->sp[i] == pte->device) { /* It's us ? */
|
|
|
|
|
if (d->softkeyicon[i] != status) { /* Avoid resending the same icon */
|
|
|
|
|
d->softkeyicon[i] = status;
|
|
|
|
|
@@ -1090,30 +1357,40 @@ static void change_favorite_icon(struct unistimsession
|
|
|
|
|
@@ -1091,30 +1358,40 @@ static void change_favorite_icon(struct unistimsession
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -707,7 +708,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
struct unistimsession *cur, *prev = NULL;
|
|
|
|
|
ast_mutex_lock(&sessionlock);
|
|
|
|
|
cur = sessions;
|
|
|
|
|
@@ -1127,12 +1404,11 @@ static void close_client(struct unistimsession *s)
|
|
|
|
|
@@ -1128,12 +1405,11 @@ static void close_client(struct unistimsession *s)
|
|
|
|
|
if (cur) { /* Session found ? */
|
|
|
|
|
if (cur->device) { /* This session was registered ? */
|
|
|
|
|
s->state = STATE_CLEANING;
|
|
|
|
@ -723,7 +724,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
if (sub) {
|
|
|
|
|
if (sub->owner) { /* Call in progress ? */
|
|
|
|
|
if (unistimdebug)
|
|
|
|
|
@@ -1142,7 +1418,7 @@ static void close_client(struct unistimsession *s)
|
|
|
|
|
@@ -1143,7 +1419,7 @@ static void close_client(struct unistimsession *s)
|
|
|
|
|
} else
|
|
|
|
|
ast_log(LOG_WARNING, "Freeing a client with no subchannel !\n");
|
|
|
|
|
if (!ast_strlen_zero(s->device->extension_number))
|
|
|
|
@ -732,7 +733,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
cur->device->session = NULL;
|
|
|
|
|
} else {
|
|
|
|
|
if (unistimdebug)
|
|
|
|
|
@@ -1206,6 +1482,12 @@ send_text(unsigned char pos, unsigned char inverse, st
|
|
|
|
|
@@ -1207,6 +1483,12 @@ send_text(unsigned char pos, unsigned char inverse, st
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
BUFFSEND;
|
|
|
|
@ -745,7 +746,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
if (unistimdebug)
|
|
|
|
|
ast_verb(0, "Sending text at pos %d, inverse flag %d\n", pos, inverse);
|
|
|
|
|
memcpy(buffsend + SIZE_HEADER, packet_send_text, sizeof(packet_send_text));
|
|
|
|
|
@@ -1365,12 +1647,21 @@ static void send_texttitle(struct unistimsession *pte,
|
|
|
|
|
@@ -1366,12 +1648,21 @@ static void send_texttitle(struct unistimsession *pte,
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -767,7 +768,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
if (unistimdebug)
|
|
|
|
|
ast_verb(0, "Sending Time & Date\n");
|
|
|
|
|
memcpy(buffsend + SIZE_HEADER, packet_send_date_time, sizeof(packet_send_date_time));
|
|
|
|
|
@@ -1443,6 +1734,43 @@ static void send_cursor_pos(struct unistimsession *pte
|
|
|
|
|
@@ -1444,6 +1735,43 @@ static void send_cursor_pos(struct unistimsession *pte
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -811,7 +812,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
static void rcv_resume_connection_with_server(struct unistimsession *pte)
|
|
|
|
|
{
|
|
|
|
|
BUFFSEND;
|
|
|
|
|
@@ -1483,37 +1811,91 @@ static int unistim_register(struct unistimsession *s)
|
|
|
|
|
@@ -1484,37 +1812,91 @@ static int unistim_register(struct unistimsession *s)
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -922,7 +923,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
static void rcv_mac_addr(struct unistimsession *pte, const unsigned char *buf)
|
|
|
|
|
{
|
|
|
|
|
BUFFSEND;
|
|
|
|
|
@@ -1547,6 +1929,7 @@ static void rcv_mac_addr(struct unistimsession *pte, c
|
|
|
|
|
@@ -1548,6 +1930,7 @@ static void rcv_mac_addr(struct unistimsession *pte, c
|
|
|
|
|
d = devices;
|
|
|
|
|
while (d) {
|
|
|
|
|
if (!strcasecmp(d->name, "template")) {
|
|
|
|
@ -930,7 +931,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
/* Found, cloning this entry */
|
|
|
|
|
if (!(newd = ast_malloc(sizeof(*newd)))) {
|
|
|
|
|
ast_mutex_unlock(&devicelock);
|
|
|
|
|
@@ -1560,8 +1943,9 @@ static void rcv_mac_addr(struct unistimsession *pte, c
|
|
|
|
|
@@ -1561,8 +1944,9 @@ static void rcv_mac_addr(struct unistimsession *pte, c
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -942,7 +943,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
ast_free(newd);
|
|
|
|
|
ast_free(newl);
|
|
|
|
|
ast_mutex_unlock(&devicelock);
|
|
|
|
|
@@ -1572,16 +1956,16 @@ static void rcv_mac_addr(struct unistimsession *pte, c
|
|
|
|
|
@@ -1573,16 +1957,16 @@ static void rcv_mac_addr(struct unistimsession *pte, c
|
|
|
|
|
ast_copy_string(newd->name, addrmac, sizeof(newd->name));
|
|
|
|
|
if (newd->extension == EXTENSION_NONE)
|
|
|
|
|
newd->extension = EXTENSION_ASK;
|
|
|
|
@ -963,7 +964,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
snprintf(newl->fullname, sizeof(newl->fullname), "USTM/%s@%s",
|
|
|
|
|
newl->name, newd->name);
|
|
|
|
|
/* Go to the end of the linked chain */
|
|
|
|
|
@@ -1625,16 +2009,16 @@ static void rcv_mac_addr(struct unistimsession *pte, c
|
|
|
|
|
@@ -1626,16 +2010,16 @@ static void rcv_mac_addr(struct unistimsession *pte, c
|
|
|
|
|
pte->state = STATE_EXTENSION;
|
|
|
|
|
else {
|
|
|
|
|
/* Yes, because of a phone reboot. We don't ask again for the TN */
|
|
|
|
@ -983,7 +984,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
pte->state = STATE_EXTENSION;
|
|
|
|
|
else
|
|
|
|
|
pte->state = STATE_MAINPAGE;
|
|
|
|
|
@@ -1728,11 +2112,11 @@ static int write_history(struct unistimsession *pte, c
|
|
|
|
|
@@ -1729,11 +2113,11 @@ static int write_history(struct unistimsession *pte, c
|
|
|
|
|
ast_localtime(&now, &atm, NULL);
|
|
|
|
|
if (ismissed) {
|
|
|
|
|
if (way == 'i')
|
|
|
|
@ -998,7 +999,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
snprintf(line1, sizeof(line1), "%04d/%02d/%02d %02d:%02d:%02d %s",
|
|
|
|
|
atm.tm_year + 1900, atm.tm_mon + 1, atm.tm_mday, atm.tm_hour,
|
|
|
|
|
atm.tm_min, atm.tm_sec, tmp2);
|
|
|
|
|
@@ -1850,41 +2234,14 @@ static int write_history(struct unistimsession *pte, c
|
|
|
|
|
@@ -1851,41 +2235,14 @@ static int write_history(struct unistimsession *pte, c
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1046,29 +1047,13 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int attempt_transfer(struct unistim_subchannel *p1, struct unistim_subchannel *p2)
|
|
|
|
|
@@ -1908,33 +2265,23 @@ static int attempt_transfer(struct unistim_subchannel
|
|
|
|
|
peerb = chanb;
|
|
|
|
|
peerc = bridgea;
|
|
|
|
|
peerd = bridgeb;
|
|
|
|
|
+ ast_log(LOG_WARNING, "1\n");
|
|
|
|
|
} else if (bridgeb) {
|
|
|
|
|
peera = chanb;
|
|
|
|
|
peerb = chana;
|
|
|
|
|
peerc = bridgeb;
|
|
|
|
|
peerd = bridgea;
|
|
|
|
|
+ ast_log(LOG_WARNING, "1\n"); /* c */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (peera && peerb && peerc && (peerb != peerc)) {
|
|
|
|
|
- /*ast_quiet_chan(peera);
|
|
|
|
|
- ast_quiet_chan(peerb);
|
|
|
|
|
- ast_quiet_chan(peerc);
|
|
|
|
|
- ast_quiet_chan(peerd); */
|
|
|
|
|
@@ -1919,21 +2276,11 @@ static int attempt_transfer(struct unistim_subchannel
|
|
|
|
|
ast_quiet_chan(peerb);
|
|
|
|
|
ast_quiet_chan(peerc);
|
|
|
|
|
ast_quiet_chan(peerd); */
|
|
|
|
|
+ unistim_quiet_chan(peera);
|
|
|
|
|
+ unistim_quiet_chan(peerb);
|
|
|
|
|
+ unistim_quiet_chan(peerc);
|
|
|
|
|
+ if (peerd)
|
|
|
|
|
+ unistim_quiet_chan(peerd);
|
|
|
|
|
|
|
|
|
|
- if (peera->cdr && peerb->cdr) {
|
|
|
|
|
- peerb->cdr = ast_cdr_append(peerb->cdr, peera->cdr);
|
|
|
|
@ -1084,11 +1069,11 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
- }
|
|
|
|
|
- peerc->cdr = NULL;
|
|
|
|
|
-
|
|
|
|
|
+ ast_debug(4, "UNISTIM transfer: trying to masquerade %s into %s\n", peerc->name, peerb->name);
|
|
|
|
|
+ ast_debug(4, "UNISTIM transfer: trying to masquerade %s into %s\n", peerc->name, peerb->name);
|
|
|
|
|
if (ast_channel_masquerade(peerb, peerc)) {
|
|
|
|
|
ast_log(LOG_WARNING, "Failed to masquerade %s into %s\n", peerb->name,
|
|
|
|
|
peerc->name);
|
|
|
|
|
@@ -1972,32 +2319,118 @@ void change_callerid(struct unistimsession *pte, int t
|
|
|
|
|
@@ -1971,32 +2318,118 @@ void change_callerid(struct unistimsession *pte, int t
|
|
|
|
|
memcpy(data, callerid, size);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1219,7 +1204,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
change_callerid(pte, 1, "");
|
|
|
|
|
write_history(pte, 'o', pte->device->missed_call);
|
|
|
|
|
pte->device->missed_call = 0;
|
|
|
|
|
@@ -2005,9 +2438,10 @@ static void close_call(struct unistimsession *pte)
|
|
|
|
|
@@ -2004,9 +2437,10 @@ static void close_call(struct unistimsession *pte)
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1231,7 +1216,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -2019,7 +2453,7 @@ static void *unistim_ss(void *data)
|
|
|
|
|
@@ -2018,7 +2452,7 @@ static void *unistim_ss(void *data)
|
|
|
|
|
struct unistimsession *s = l->parent->session;
|
|
|
|
|
int res;
|
|
|
|
|
|
|
|
|
@ -1240,7 +1225,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
ast_copy_string(chan->exten, s->device->phone_number, sizeof(chan->exten));
|
|
|
|
|
ast_copy_string(s->device->redial_number, s->device->phone_number,
|
|
|
|
|
sizeof(s->device->redial_number));
|
|
|
|
|
@@ -2027,85 +2461,50 @@ static void *unistim_ss(void *data)
|
|
|
|
|
@@ -2026,85 +2460,50 @@ static void *unistim_ss(void *data)
|
|
|
|
|
res = ast_pbx_run(chan);
|
|
|
|
|
if (res) {
|
|
|
|
|
ast_log(LOG_WARNING, "PBX exited non-zero\n");
|
|
|
|
@ -1358,7 +1343,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
/* Setting up RTP of the phone */
|
|
|
|
|
if (public_ip.sin_family == 0) /* NAT IP override ? */
|
|
|
|
|
memcpy(&public, &us, sizeof(public)); /* No defined, using IP from recvmsg */
|
|
|
|
|
@@ -2118,35 +2517,35 @@ static void start_rtp(struct unistim_subchannel *sub)
|
|
|
|
|
@@ -2117,35 +2516,35 @@ static void start_rtp(struct unistim_subchannel *sub)
|
|
|
|
|
ast_verb(0, "Starting phone RTP stack. Our public IP is %s\n",
|
|
|
|
|
ast_inet_ntoa(public.sin_addr));
|
|
|
|
|
}
|
|
|
|
@ -1404,7 +1389,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
memcpy(buffsend + 28, &public.sin_addr, sizeof(public.sin_addr));
|
|
|
|
|
buffsend[20] = (htons(sin.sin_port) & 0xff00) >> 8;
|
|
|
|
|
buffsend[21] = (htons(sin.sin_port) & 0x00ff);
|
|
|
|
|
@@ -2165,18 +2564,17 @@ static void start_rtp(struct unistim_subchannel *sub)
|
|
|
|
|
@@ -2164,18 +2563,17 @@ static void start_rtp(struct unistim_subchannel *sub)
|
|
|
|
|
buffsend[11] = codec;
|
|
|
|
|
}
|
|
|
|
|
buffsend[12] = codec;
|
|
|
|
@ -1426,7 +1411,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
memcpy(buffsend + 28, &public.sin_addr, sizeof(public.sin_addr));
|
|
|
|
|
buffsend[20] = (htons(sin.sin_port) & 0xff00) >> 8;
|
|
|
|
|
buffsend[21] = (htons(sin.sin_port) & 0x00ff);
|
|
|
|
|
@@ -2195,8 +2593,7 @@ static void start_rtp(struct unistim_subchannel *sub)
|
|
|
|
|
@@ -2194,8 +2592,7 @@ static void start_rtp(struct unistim_subchannel *sub)
|
|
|
|
|
buffsend[12] = codec;
|
|
|
|
|
}
|
|
|
|
|
buffsend[11] = codec;
|
|
|
|
@ -1436,7 +1421,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
} else {
|
|
|
|
|
uint16_t rtcpsin_port = htons(us.sin_port) + 1; /* RTCP port is RTP + 1 */
|
|
|
|
|
|
|
|
|
|
@@ -2230,73 +2627,152 @@ static void start_rtp(struct unistim_subchannel *sub)
|
|
|
|
|
@@ -2229,73 +2626,152 @@ static void start_rtp(struct unistim_subchannel *sub)
|
|
|
|
|
buffsend[46] = (htons(sin.sin_port) & 0x00ff);
|
|
|
|
|
buffsend[47] = (rtcpsin_port & 0xff00) >> 8;
|
|
|
|
|
buffsend[48] = (rtcpsin_port & 0x00ff);
|
|
|
|
@ -1637,7 +1622,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
send_led_update(pte, 0);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
@@ -2306,107 +2782,217 @@ static void handle_dial_page(struct unistimsession *pt
|
|
|
|
|
@@ -2305,107 +2781,217 @@ static void handle_dial_page(struct unistimsession *pt
|
|
|
|
|
send_select_output(pte, OUTPUT_SPEAKER, pte->device->volume, MUTE_OFF);
|
|
|
|
|
else
|
|
|
|
|
send_select_output(pte, pte->device->output, pte->device->volume, MUTE_OFF);
|
|
|
|
@ -1907,7 +1892,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
|
|
|
|
|
/* start switch */
|
|
|
|
|
if (ast_pthread_create(&t, NULL, unistim_ss, c)) {
|
|
|
|
|
@@ -2416,81 +3002,51 @@ static void HandleCallOutgoing(struct unistimsession *
|
|
|
|
|
@@ -2415,81 +3001,51 @@ static void HandleCallOutgoing(struct unistimsession *
|
|
|
|
|
} else
|
|
|
|
|
ast_log(LOG_WARNING, "Unable to create channel for %s@%s\n",
|
|
|
|
|
sub->parent->name, s->device->name);
|
|
|
|
@ -2023,7 +2008,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
ast_verb(0, "Handle Call Incoming for %s@%s\n", sub->parent->name,
|
|
|
|
|
s->device->name);
|
|
|
|
|
start_rtp(sub);
|
|
|
|
|
@@ -2498,16 +3054,16 @@ static void HandleCallIncoming(struct unistimsession *
|
|
|
|
|
@@ -2497,16 +3053,16 @@ static void HandleCallIncoming(struct unistimsession *
|
|
|
|
|
ast_log(LOG_WARNING, "Unable to create channel for %s@%s\n", sub->parent->name,
|
|
|
|
|
s->device->name);
|
|
|
|
|
ast_queue_control(sub->owner, AST_CONTROL_ANSWER);
|
|
|
|
@ -2044,7 +2029,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
write_history(s, 'i', 0);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
@@ -2516,8 +3072,10 @@ static int unistim_do_senddigit(struct unistimsession
|
|
|
|
|
@@ -2515,8 +3071,10 @@ static int unistim_do_senddigit(struct unistimsession
|
|
|
|
|
{
|
|
|
|
|
struct ast_frame f = { .frametype = AST_FRAME_DTMF, .subclass.integer = digit, .src = "unistim" };
|
|
|
|
|
struct unistim_subchannel *sub;
|
|
|
|
@ -2057,7 +2042,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
ast_log(LOG_WARNING, "Unable to find subchannel in dtmf senddigit\n");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
@@ -2527,65 +3085,78 @@ static int unistim_do_senddigit(struct unistimsession
|
|
|
|
|
@@ -2526,65 +3084,78 @@ static int unistim_do_senddigit(struct unistimsession
|
|
|
|
|
|
|
|
|
|
if (unistimdebug)
|
|
|
|
|
ast_verb(0, "Send Digit %c\n", digit);
|
|
|
|
@ -2188,7 +2173,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
if ((keycode >= KEY_0) && (keycode <= KEY_SHARP)) {
|
|
|
|
|
if (keycode == KEY_SHARP)
|
|
|
|
|
keycode = '#';
|
|
|
|
|
@@ -2602,9 +3173,17 @@ static void key_call(struct unistimsession *pte, char
|
|
|
|
|
@@ -2601,9 +3172,17 @@ static void key_call(struct unistimsession *pte, char
|
|
|
|
|
close_call(pte);
|
|
|
|
|
break;
|
|
|
|
|
case KEY_FUNC2:
|
|
|
|
@ -2208,7 +2193,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
if (pte->device->output == OUTPUT_HEADPHONE)
|
|
|
|
|
send_select_output(pte, OUTPUT_HANDSET, pte->device->volume, MUTE_OFF);
|
|
|
|
|
else
|
|
|
|
|
@@ -2618,82 +3197,71 @@ static void key_call(struct unistimsession *pte, char
|
|
|
|
|
@@ -2617,82 +3196,71 @@ static void key_call(struct unistimsession *pte, char
|
|
|
|
|
MUTE_OFF);
|
|
|
|
|
break;
|
|
|
|
|
case KEY_MUTE:
|
|
|
|
@ -2331,7 +2316,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
if (keycode == KEY_FUNC3) {
|
|
|
|
|
if (pte->device->size_phone_number <= 1)
|
|
|
|
|
keycode = KEY_FUNC4;
|
|
|
|
|
@@ -2702,50 +3270,32 @@ static void key_dial_page(struct unistimsession *pte,
|
|
|
|
|
@@ -2701,50 +3269,32 @@ static void key_dial_page(struct unistimsession *pte,
|
|
|
|
|
keycode = pte->device->phone_number[pte->device->size_phone_number] + 0x10;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -2393,7 +2378,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (pte->device->call_forward[0] == -1) {
|
|
|
|
|
@@ -2755,7 +3305,9 @@ static void key_dial_page(struct unistimsession *pte,
|
|
|
|
|
@@ -2754,7 +3304,9 @@ static void key_dial_page(struct unistimsession *pte,
|
|
|
|
|
show_main_page(pte);
|
|
|
|
|
} else if ((keycode == KEY_FUNC2) || (keycode == KEY_HANGUP)) {
|
|
|
|
|
pte->device->call_forward[0] = '\0';
|
|
|
|
@ -2404,7 +2389,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
@@ -2766,40 +3318,43 @@ static void key_dial_page(struct unistimsession *pte,
|
|
|
|
|
@@ -2765,40 +3317,43 @@ static void key_dial_page(struct unistimsession *pte,
|
|
|
|
|
ast_copy_string(pte->device->phone_number, pte->device->redial_number,
|
|
|
|
|
sizeof(pte->device->phone_number));
|
|
|
|
|
case KEY_FUNC1:
|
|
|
|
@ -2469,7 +2454,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
break;
|
|
|
|
|
case KEY_LOUDSPK:
|
|
|
|
|
if (pte->device->output == OUTPUT_SPEAKER) {
|
|
|
|
|
@@ -2824,10 +3379,50 @@ static void key_dial_page(struct unistimsession *pte,
|
|
|
|
|
@@ -2823,10 +3378,50 @@ static void key_dial_page(struct unistimsession *pte,
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2521,7 +2506,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
{
|
|
|
|
|
char buf[30], buf2[5];
|
|
|
|
|
|
|
|
|
|
@@ -2843,7 +3438,7 @@ static void HandleSelectCodec(struct unistimsession *p
|
|
|
|
|
@@ -2842,7 +3437,7 @@ static void HandleSelectCodec(struct unistimsession *p
|
|
|
|
|
send_blink_cursor(pte);
|
|
|
|
|
send_cursor_pos(pte, TEXT_LINE2 + SELECTCODEC_START_ENTRY_POS);
|
|
|
|
|
pte->size_buff_entry = 0;
|
|
|
|
@ -2530,7 +2515,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -2901,19 +3496,110 @@ static void key_select_codec(struct unistimsession *pt
|
|
|
|
|
@@ -2900,19 +3495,110 @@ static void key_select_codec(struct unistimsession *pt
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2645,7 +2630,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
pte->size_buff_entry = 0;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
@@ -2985,8 +3671,8 @@ static void key_select_extension(struct unistimsession
|
|
|
|
|
@@ -2984,8 +3670,8 @@ static void key_select_extension(struct unistimsession
|
|
|
|
|
d = d->next;
|
|
|
|
|
}
|
|
|
|
|
ast_mutex_unlock(&devicelock);
|
|
|
|
@ -2656,7 +2641,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
send_cursor_pos(pte,
|
|
|
|
|
(unsigned char) (TEXT_LINE2 + SELECTEXTENSION_START_ENTRY_POS +
|
|
|
|
|
pte->size_buff_entry));
|
|
|
|
|
@@ -2994,9 +3680,9 @@ static void key_select_extension(struct unistimsession
|
|
|
|
|
@@ -2993,9 +3679,9 @@ static void key_select_extension(struct unistimsession
|
|
|
|
|
} else {
|
|
|
|
|
ast_copy_string(pte->device->extension_number, pte->buff_entry,
|
|
|
|
|
pte->size_buff_entry + 1);
|
|
|
|
@ -2669,7 +2654,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
send_cursor_pos(pte,
|
|
|
|
|
(unsigned char) (TEXT_LINE2 +
|
|
|
|
|
SELECTEXTENSION_START_ENTRY_POS +
|
|
|
|
|
@@ -3016,12 +3702,13 @@ static void key_select_extension(struct unistimsession
|
|
|
|
|
@@ -3015,12 +3701,13 @@ static void key_select_extension(struct unistimsession
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2685,7 +2670,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
if (i == pos) {
|
|
|
|
|
pos++;
|
|
|
|
|
continue;
|
|
|
|
|
@@ -3045,22 +3732,37 @@ static void show_entry_history(struct unistimsession *
|
|
|
|
|
@@ -3044,22 +3731,37 @@ static void show_entry_history(struct unistimsession *
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
line[sizeof(line) - 1] = '\0';
|
|
|
|
@ -2728,7 +2713,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
fclose(*f);
|
|
|
|
|
|
|
|
|
|
snprintf(line, sizeof(line), "Call %03d/%03d", pte->buff_entry[2],
|
|
|
|
|
@@ -3070,20 +3772,20 @@ static void show_entry_history(struct unistimsession *
|
|
|
|
|
@@ -3069,20 +3771,20 @@ static void show_entry_history(struct unistimsession *
|
|
|
|
|
if (pte->buff_entry[2] == 1)
|
|
|
|
|
strcpy(func1, " ");
|
|
|
|
|
else
|
|
|
|
@ -2755,7 +2740,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
{
|
|
|
|
|
char tmp[AST_CONFIG_MAX_PATH];
|
|
|
|
|
char count;
|
|
|
|
|
@@ -3118,12 +3820,13 @@ static void show_history(struct unistimsession *pte, c
|
|
|
|
|
@@ -3117,12 +3819,13 @@ static void show_history(struct unistimsession *pte, c
|
|
|
|
|
return;
|
|
|
|
|
if (!pte->device->callhistory)
|
|
|
|
|
return;
|
|
|
|
@ -2770,7 +2755,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
show_entry_history(pte, &f);
|
|
|
|
|
pte->state = STATE_HISTORY;
|
|
|
|
|
}
|
|
|
|
|
@@ -3131,60 +3834,73 @@ static void show_history(struct unistimsession *pte, c
|
|
|
|
|
@@ -3130,60 +3833,73 @@ static void show_history(struct unistimsession *pte, c
|
|
|
|
|
static void show_main_page(struct unistimsession *pte)
|
|
|
|
|
{
|
|
|
|
|
char tmpbuf[TEXT_LENGTH_MAX + 1];
|
|
|
|
@ -2869,7 +2854,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
pte->device->missed_call = 0;
|
|
|
|
|
}
|
|
|
|
|
if ((keycode >= KEY_0) && (keycode <= KEY_SHARP)) {
|
|
|
|
|
@@ -3194,6 +3910,7 @@ static void key_main_page(struct unistimsession *pte,
|
|
|
|
|
@@ -3193,6 +3909,7 @@ static void key_main_page(struct unistimsession *pte,
|
|
|
|
|
}
|
|
|
|
|
switch (keycode) {
|
|
|
|
|
case KEY_FUNC1:
|
|
|
|
@ -2877,7 +2862,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
handle_dial_page(pte);
|
|
|
|
|
break;
|
|
|
|
|
case KEY_FUNC2:
|
|
|
|
|
@@ -3207,7 +3924,7 @@ static void key_main_page(struct unistimsession *pte,
|
|
|
|
|
@@ -3206,7 +3923,7 @@ static void key_main_page(struct unistimsession *pte,
|
|
|
|
|
|
|
|
|
|
ast_copy_string(pte->device->phone_number, pte->device->redial_number,
|
|
|
|
|
sizeof(pte->device->phone_number));
|
|
|
|
@ -2886,7 +2871,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
break;
|
|
|
|
|
case KEY_FUNC3:
|
|
|
|
|
if (!ast_strlen_zero(pte->device->call_forward)) {
|
|
|
|
|
@@ -3215,7 +3932,7 @@ static void key_main_page(struct unistimsession *pte,
|
|
|
|
|
@@ -3214,7 +3931,7 @@ static void key_main_page(struct unistimsession *pte,
|
|
|
|
|
memmove(pte->device->call_forward + 1, pte->device->call_forward,
|
|
|
|
|
sizeof(pte->device->call_forward));
|
|
|
|
|
pte->device->call_forward[0] = '\0';
|
|
|
|
@ -2895,7 +2880,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
pte->device->output = OUTPUT_HANDSET; /* Seems to be reseted somewhere */
|
|
|
|
|
show_main_page(pte);
|
|
|
|
|
break;
|
|
|
|
|
@@ -3225,9 +3942,9 @@ static void key_main_page(struct unistimsession *pte,
|
|
|
|
|
@@ -3224,9 +3941,9 @@ static void key_main_page(struct unistimsession *pte,
|
|
|
|
|
break;
|
|
|
|
|
case KEY_FUNC4:
|
|
|
|
|
if (pte->device->extension == EXTENSION_ASK) {
|
|
|
|
@ -2907,7 +2892,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
} else if (pte->device->extension == EXTENSION_TN) {
|
|
|
|
|
ast_mutex_lock(&devicelock);
|
|
|
|
|
strcpy(pte->device->id, pte->device->extension_number);
|
|
|
|
|
@@ -3236,26 +3953,25 @@ static void key_main_page(struct unistimsession *pte,
|
|
|
|
|
@@ -3235,26 +3952,25 @@ static void key_main_page(struct unistimsession *pte,
|
|
|
|
|
pte->device->session = NULL;
|
|
|
|
|
pte->device = NULL;
|
|
|
|
|
ast_mutex_unlock(&devicelock);
|
|
|
|
@ -2945,7 +2930,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
break;
|
|
|
|
|
case KEY_LOUDSPK:
|
|
|
|
|
send_select_output(pte, OUTPUT_SPEAKER, pte->device->volume, MUTE_OFF);
|
|
|
|
|
@@ -3280,44 +3996,41 @@ static void key_history(struct unistimsession *pte, ch
|
|
|
|
|
@@ -3279,44 +3995,41 @@ static void key_history(struct unistimsession *pte, ch
|
|
|
|
|
FILE *f;
|
|
|
|
|
char count;
|
|
|
|
|
long offset;
|
|
|
|
@ -3011,7 +2996,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
break;
|
|
|
|
|
ast_copy_string(pte->device->redial_number, pte->device->lst_cid,
|
|
|
|
|
sizeof(pte->device->redial_number));
|
|
|
|
|
@@ -3340,6 +4053,20 @@ static void key_history(struct unistimsession *pte, ch
|
|
|
|
|
@@ -3339,6 +4052,20 @@ static void key_history(struct unistimsession *pte, ch
|
|
|
|
|
show_history(pte, 'i');
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
@ -3032,7 +3017,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -3350,7 +4077,7 @@ static void init_phone_step2(struct unistimsession *pt
|
|
|
|
|
@@ -3349,7 +4076,7 @@ static void init_phone_step2(struct unistimsession *pt
|
|
|
|
|
ast_verb(0, "Sending S4\n");
|
|
|
|
|
memcpy(buffsend + SIZE_HEADER, packet_send_s4, sizeof(packet_send_s4));
|
|
|
|
|
send_client(SIZE_HEADER + sizeof(packet_send_s4), buffsend, pte);
|
|
|
|
@ -3041,7 +3026,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
send_date_time3(pte);
|
|
|
|
|
if (unistimdebug)
|
|
|
|
|
ast_verb(0, "Sending S7\n");
|
|
|
|
|
@@ -3375,9 +4102,13 @@ static void init_phone_step2(struct unistimsession *pt
|
|
|
|
|
@@ -3374,9 +4101,13 @@ static void init_phone_step2(struct unistimsession *pt
|
|
|
|
|
send_client(SIZE_HEADER + sizeof(packet_send_S7), buffsend, pte);
|
|
|
|
|
send_led_update(pte, 0);
|
|
|
|
|
send_ping(pte);
|
|
|
|
@ -3057,7 +3042,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
return;
|
|
|
|
|
} else {
|
|
|
|
|
int i;
|
|
|
|
|
@@ -3385,8 +4116,8 @@ static void init_phone_step2(struct unistimsession *pt
|
|
|
|
|
@@ -3384,8 +4115,8 @@ static void init_phone_step2(struct unistimsession *pt
|
|
|
|
|
|
|
|
|
|
for (i = 1; i < 6; i++)
|
|
|
|
|
send_favorite(i, 0, pte, "");
|
|
|
|
@ -3068,7 +3053,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
strcpy(tmp, "MAC = ");
|
|
|
|
|
strcat(tmp, pte->macaddr);
|
|
|
|
|
send_text(TEXT_LINE2, TEXT_NORMAL, pte, tmp);
|
|
|
|
|
@@ -3440,8 +4171,8 @@ static void process_request(int size, unsigned char *b
|
|
|
|
|
@@ -3439,8 +4170,8 @@ static void process_request(int size, unsigned char *b
|
|
|
|
|
char keycode = buf[13];
|
|
|
|
|
|
|
|
|
|
if (unistimdebug)
|
|
|
|
@ -3079,7 +3064,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
|
|
|
|
|
switch (pte->state) {
|
|
|
|
|
case STATE_INIT:
|
|
|
|
|
@@ -3467,10 +4198,19 @@ static void process_request(int size, unsigned char *b
|
|
|
|
|
@@ -3466,10 +4197,19 @@ static void process_request(int size, unsigned char *b
|
|
|
|
|
case STATE_EXTENSION:
|
|
|
|
|
key_select_extension(pte, keycode);
|
|
|
|
|
break;
|
|
|
|
@ -3100,7 +3085,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
key_history(pte, keycode);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
@@ -3488,13 +4228,15 @@ static void process_request(int size, unsigned char *b
|
|
|
|
|
@@ -3487,13 +4227,15 @@ static void process_request(int size, unsigned char *b
|
|
|
|
|
send_select_output(pte, OUTPUT_HEADPHONE, pte->device->volume, MUTE_OFF);
|
|
|
|
|
else
|
|
|
|
|
send_select_output(pte, OUTPUT_HANDSET, pte->device->volume, MUTE_OFF);
|
|
|
|
@ -3119,7 +3104,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
send_select_output(pte, OUTPUT_HANDSET, pte->device->volume, MUTE_OFF);
|
|
|
|
|
handle_dial_page(pte);
|
|
|
|
|
}
|
|
|
|
|
@@ -3508,7 +4250,7 @@ static void process_request(int size, unsigned char *b
|
|
|
|
|
@@ -3507,7 +4249,7 @@ static void process_request(int size, unsigned char *b
|
|
|
|
|
pte->device->receiver_state = STATE_ONHOOK;
|
|
|
|
|
if (pte->state == STATE_CALL)
|
|
|
|
|
close_call(pte);
|
|
|
|
@ -3128,7 +3113,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
close_call(pte);
|
|
|
|
|
else if (pte->state == STATE_EXTENSION)
|
|
|
|
|
return;
|
|
|
|
|
@@ -3706,13 +4448,52 @@ static struct unistimsession *channel_to_session(struc
|
|
|
|
|
@@ -3705,13 +4447,52 @@ static struct unistimsession *channel_to_session(struc
|
|
|
|
|
return sub->parent->parent->session;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -3183,7 +3168,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
|
|
|
|
|
session = channel_to_session(ast);
|
|
|
|
|
if (!session) {
|
|
|
|
|
@@ -3721,6 +4502,7 @@ static int unistim_call(struct ast_channel *ast, char
|
|
|
|
|
@@ -3720,6 +4501,7 @@ static int unistim_call(struct ast_channel *ast, char
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sub = ast->tech_pvt;
|
|
|
|
@ -3191,7 +3176,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
if ((ast->_state != AST_STATE_DOWN) && (ast->_state != AST_STATE_RESERVED)) {
|
|
|
|
|
ast_log(LOG_WARNING, "unistim_call called on %s, neither down nor reserved\n",
|
|
|
|
|
ast->name);
|
|
|
|
|
@@ -3731,58 +4513,49 @@ static int unistim_call(struct ast_channel *ast, char
|
|
|
|
|
@@ -3730,58 +4512,49 @@ static int unistim_call(struct ast_channel *ast, char
|
|
|
|
|
ast_verb(3, "unistim_call(%s)\n", ast->name);
|
|
|
|
|
|
|
|
|
|
session->state = STATE_RINGING;
|
|
|
|
@ -3285,7 +3270,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
|
|
|
|
|
s = channel_to_session(ast);
|
|
|
|
|
sub = ast->tech_pvt;
|
|
|
|
|
@@ -3802,32 +4575,43 @@ static int unistim_hangup(struct ast_channel *ast)
|
|
|
|
|
@@ -3801,32 +4574,43 @@ static int unistim_hangup(struct ast_channel *ast)
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
l = sub->parent;
|
|
|
|
@ -3342,7 +3327,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
ast_mutex_lock(&sub->lock);
|
|
|
|
|
@@ -3835,34 +4619,26 @@ static int unistim_hangup(struct ast_channel *ast)
|
|
|
|
|
@@ -3834,34 +4618,26 @@ static int unistim_hangup(struct ast_channel *ast)
|
|
|
|
|
ast->tech_pvt = NULL;
|
|
|
|
|
sub->alreadygone = 0;
|
|
|
|
|
ast_mutex_unlock(&sub->lock);
|
|
|
|
@ -3396,7 +3381,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
if (sub->rtp) {
|
|
|
|
|
if (unistimdebug)
|
|
|
|
|
ast_verb(0, "Destroying RTP session\n");
|
|
|
|
|
@@ -3870,16 +4646,27 @@ static int unistim_hangup(struct ast_channel *ast)
|
|
|
|
|
@@ -3869,16 +4645,27 @@ static int unistim_hangup(struct ast_channel *ast)
|
|
|
|
|
sub->rtp = NULL;
|
|
|
|
|
} else if (unistimdebug)
|
|
|
|
|
ast_verb(0, "No RTP session to destroy\n");
|
|
|
|
@ -3434,7 +3419,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -3889,6 +4676,7 @@ static int unistim_answer(struct ast_channel *ast)
|
|
|
|
|
@@ -3888,6 +4675,7 @@ static int unistim_answer(struct ast_channel *ast)
|
|
|
|
|
int res = 0;
|
|
|
|
|
struct unistim_subchannel *sub;
|
|
|
|
|
struct unistim_line *l;
|
|
|
|
@ -3442,7 +3427,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
struct unistimsession *s;
|
|
|
|
|
|
|
|
|
|
s = channel_to_session(ast);
|
|
|
|
|
@@ -3898,18 +4686,19 @@ static int unistim_answer(struct ast_channel *ast)
|
|
|
|
|
@@ -3897,18 +4685,19 @@ static int unistim_answer(struct ast_channel *ast)
|
|
|
|
|
}
|
|
|
|
|
sub = ast->tech_pvt;
|
|
|
|
|
l = sub->parent;
|
|
|
|
@ -3469,7 +3454,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
if (ast->_state != AST_STATE_UP)
|
|
|
|
|
ast_setstate(ast, AST_STATE_UP);
|
|
|
|
|
return res;
|
|
|
|
|
@@ -4047,14 +4836,16 @@ static int unistim_write(struct ast_channel *ast, stru
|
|
|
|
|
@@ -4046,14 +4835,16 @@ static int unistim_write(struct ast_channel *ast, stru
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
@ -3489,7 +3474,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -4123,7 +4914,13 @@ static char *control2str(int ind)
|
|
|
|
|
@@ -4122,7 +4913,13 @@ static char *control2str(int ind)
|
|
|
|
|
return "Key Radio";
|
|
|
|
|
case AST_CONTROL_RADIO_UNKEY:
|
|
|
|
|
return "Un-Key Radio";
|
|
|
|
@ -3504,7 +3489,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
return "Stop tone";
|
|
|
|
|
}
|
|
|
|
|
return "UNKNOWN";
|
|
|
|
|
@@ -4150,8 +4947,8 @@ static int unistim_indicate(struct ast_channel *ast, i
|
|
|
|
|
@@ -4149,8 +4946,8 @@ static int unistim_indicate(struct ast_channel *ast, i
|
|
|
|
|
struct unistimsession *s;
|
|
|
|
|
|
|
|
|
|
if (unistimdebug) {
|
|
|
|
@ -3515,7 +3500,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
s = channel_to_session(ast);
|
|
|
|
|
@@ -4164,7 +4961,7 @@ static int unistim_indicate(struct ast_channel *ast, i
|
|
|
|
|
@@ -4163,7 +4960,7 @@ static int unistim_indicate(struct ast_channel *ast, i
|
|
|
|
|
switch (ind) {
|
|
|
|
|
case AST_CONTROL_RINGING:
|
|
|
|
|
if (ast->_state != AST_STATE_UP) {
|
|
|
|
@ -3524,7 +3509,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
in_band_indication(ast, l->parent->tz, "ring");
|
|
|
|
|
s->device->missed_call = -1;
|
|
|
|
|
break;
|
|
|
|
|
@@ -4173,7 +4970,7 @@ static int unistim_indicate(struct ast_channel *ast, i
|
|
|
|
|
@@ -4172,7 +4969,7 @@ static int unistim_indicate(struct ast_channel *ast, i
|
|
|
|
|
case AST_CONTROL_BUSY:
|
|
|
|
|
if (ast->_state != AST_STATE_UP) {
|
|
|
|
|
sub->alreadygone = 1;
|
|
|
|
@ -3533,7 +3518,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
in_band_indication(ast, l->parent->tz, "busy");
|
|
|
|
|
s->device->missed_call = -1;
|
|
|
|
|
break;
|
|
|
|
|
@@ -4182,7 +4979,7 @@ static int unistim_indicate(struct ast_channel *ast, i
|
|
|
|
|
@@ -4181,7 +4978,7 @@ static int unistim_indicate(struct ast_channel *ast, i
|
|
|
|
|
case AST_CONTROL_CONGESTION:
|
|
|
|
|
if (ast->_state != AST_STATE_UP) {
|
|
|
|
|
sub->alreadygone = 1;
|
|
|
|
@ -3542,7 +3527,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
in_band_indication(ast, l->parent->tz, "congestion");
|
|
|
|
|
s->device->missed_call = -1;
|
|
|
|
|
break;
|
|
|
|
|
@@ -4196,13 +4993,23 @@ static int unistim_indicate(struct ast_channel *ast, i
|
|
|
|
|
@@ -4195,13 +4992,23 @@ static int unistim_indicate(struct ast_channel *ast, i
|
|
|
|
|
break;
|
|
|
|
|
case AST_CONTROL_PROGRESS:
|
|
|
|
|
case AST_CONTROL_SRCUPDATE:
|
|
|
|
@ -3568,7 +3553,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
default:
|
|
|
|
|
ast_log(LOG_WARNING, "Don't know how to indicate condition %d\n", ind);
|
|
|
|
|
return -1;
|
|
|
|
|
@@ -4215,6 +5022,7 @@ static struct unistim_subchannel *find_subchannel_by_n
|
|
|
|
|
@@ -4214,6 +5021,7 @@ static struct unistim_subchannel *find_subchannel_by_n
|
|
|
|
|
{
|
|
|
|
|
struct unistim_line *l;
|
|
|
|
|
struct unistim_device *d;
|
|
|
|
@ -3576,7 +3561,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
char line[256];
|
|
|
|
|
char *at;
|
|
|
|
|
char *device;
|
|
|
|
|
@@ -4238,12 +5046,22 @@ static struct unistim_subchannel *find_subchannel_by_n
|
|
|
|
|
@@ -4237,12 +5045,22 @@ static struct unistim_subchannel *find_subchannel_by_n
|
|
|
|
|
if (unistimdebug)
|
|
|
|
|
ast_verb(0, "Found device: %s\n", d->name);
|
|
|
|
|
/* Found the device */
|
|
|
|
@ -3603,7 +3588,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
if (at) { /* Other options ? */
|
|
|
|
|
at++; /* Skip slash */
|
|
|
|
|
if (*at == 'r') { /* distinctive ring */
|
|
|
|
|
@@ -4259,16 +5077,20 @@ static struct unistim_subchannel *find_subchannel_by_n
|
|
|
|
|
@@ -4258,16 +5076,20 @@ static struct unistim_subchannel *find_subchannel_by_n
|
|
|
|
|
if (unistimdebug)
|
|
|
|
|
ast_verb(0, "Distinctive ring : style #%d volume %d\n",
|
|
|
|
|
ring_style, ring_volume);
|
|
|
|
@ -3629,7 +3614,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
}
|
|
|
|
|
d = d->next;
|
|
|
|
|
}
|
|
|
|
|
@@ -4294,7 +5116,7 @@ static int unistim_senddigit_end(struct ast_channel *a
|
|
|
|
|
@@ -4293,7 +5115,7 @@ static int unistim_senddigit_end(struct ast_channel *a
|
|
|
|
|
struct ast_frame f = { 0, };
|
|
|
|
|
struct unistim_subchannel *sub;
|
|
|
|
|
|
|
|
|
@ -3638,7 +3623,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
|
|
|
|
|
if (!sub->owner || sub->alreadygone) {
|
|
|
|
|
ast_log(LOG_WARNING, "Unable to find subchannel in dtmf senddigit_end\n");
|
|
|
|
|
@@ -4429,7 +5251,7 @@ static int unistim_sendtext(struct ast_channel *ast, c
|
|
|
|
|
@@ -4428,7 +5250,7 @@ static int unistim_sendtext(struct ast_channel *ast, c
|
|
|
|
|
if (pte->device->height == 1) {
|
|
|
|
|
send_text(TEXT_LINE0, TEXT_NORMAL, pte, text);
|
|
|
|
|
} else {
|
|
|
|
@ -3647,7 +3632,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
send_text(TEXT_LINE1, TEXT_NORMAL, pte, text);
|
|
|
|
|
}
|
|
|
|
|
if (size <= TEXT_LENGTH_MAX) {
|
|
|
|
|
@@ -4457,7 +5279,7 @@ static int unistim_send_mwi_to_peer(struct unistimsess
|
|
|
|
|
@@ -4456,7 +5278,7 @@ static int unistim_send_mwi_to_peer(struct unistimsess
|
|
|
|
|
struct ast_event *event;
|
|
|
|
|
int new;
|
|
|
|
|
char *mailbox, *context;
|
|
|
|
@ -3656,7 +3641,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
|
|
|
|
|
context = mailbox = ast_strdupa(peer->mailbox);
|
|
|
|
|
strsep(&context, "@");
|
|
|
|
|
@@ -4511,9 +5333,9 @@ static struct ast_channel *unistim_new(struct unistim_
|
|
|
|
|
@@ -4510,9 +5332,9 @@ static struct ast_channel *unistim_new(struct unistim_
|
|
|
|
|
}
|
|
|
|
|
l = sub->parent;
|
|
|
|
|
tmp = ast_channel_alloc(1, state, l->cid_num, NULL, l->accountcode, l->exten,
|
|
|
|
@ -3668,7 +3653,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
if (!tmp) {
|
|
|
|
|
ast_log(LOG_WARNING, "Unable to allocate channel structure\n");
|
|
|
|
|
return NULL;
|
|
|
|
|
@@ -4551,8 +5373,8 @@ static struct ast_channel *unistim_new(struct unistim_
|
|
|
|
|
@@ -4550,8 +5372,8 @@ static struct ast_channel *unistim_new(struct unistim_
|
|
|
|
|
tmp->rawreadformat = fmt;
|
|
|
|
|
tmp->tech_pvt = sub;
|
|
|
|
|
tmp->tech = &unistim_tech;
|
|
|
|
@ -3679,7 +3664,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
sub->owner = tmp;
|
|
|
|
|
ast_mutex_lock(&usecnt_lock);
|
|
|
|
|
usecnt++;
|
|
|
|
|
@@ -4576,14 +5398,14 @@ static struct ast_channel *unistim_new(struct unistim_
|
|
|
|
|
@@ -4575,14 +5397,14 @@ static struct ast_channel *unistim_new(struct unistim_
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
tmp->priority = 1;
|
|
|
|
@ -3702,7 +3687,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return tmp;
|
|
|
|
|
@@ -4632,8 +5454,8 @@ static void *do_monitor(void *data)
|
|
|
|
|
@@ -4631,8 +5453,8 @@ static void *do_monitor(void *data)
|
|
|
|
|
dw_timeout = cur->timeout - tick;
|
|
|
|
|
/* Checking if the phone is logged on for a new MWI */
|
|
|
|
|
if (cur->device) {
|
|
|
|
@ -3713,7 +3698,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
DEBUG_TIMER("Checking mailbox for MWI\n");
|
|
|
|
|
unistim_send_mwi_to_peer(cur, tick);
|
|
|
|
|
break;
|
|
|
|
|
@@ -4703,7 +5525,8 @@ static struct ast_channel *unistim_request(const char
|
|
|
|
|
@@ -4702,7 +5524,8 @@ static struct ast_channel *unistim_request(const char
|
|
|
|
|
int *cause)
|
|
|
|
|
{
|
|
|
|
|
format_t oldformat;
|
|
|
|
@ -3723,7 +3708,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
struct ast_channel *tmpc = NULL;
|
|
|
|
|
char tmp[256];
|
|
|
|
|
char *dest = data;
|
|
|
|
|
@@ -4727,22 +5550,39 @@ static struct ast_channel *unistim_request(const char
|
|
|
|
|
@@ -4726,22 +5549,39 @@ static struct ast_channel *unistim_request(const char
|
|
|
|
|
ast_log(LOG_NOTICE, "Unistim channels require a device\n");
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
@ -3769,7 +3754,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
sub->parent->capability = format;
|
|
|
|
|
tmpc = unistim_new(sub, AST_STATE_DOWN, requestor ? requestor->linkedid : NULL);
|
|
|
|
|
if (!tmpc)
|
|
|
|
|
@@ -4761,7 +5601,6 @@ static char *unistim_info(struct ast_cli_entry *e, int
|
|
|
|
|
@@ -4760,7 +5600,6 @@ static char *unistim_info(struct ast_cli_entry *e, int
|
|
|
|
|
struct unistim_line *line;
|
|
|
|
|
struct unistim_subchannel *sub;
|
|
|
|
|
struct unistimsession *s;
|
|
|
|
@ -3777,7 +3762,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
struct ast_channel *tmp;
|
|
|
|
|
|
|
|
|
|
switch (cmd) {
|
|
|
|
|
@@ -4779,44 +5618,55 @@ static char *unistim_info(struct ast_cli_entry *e, int
|
|
|
|
|
@@ -4778,44 +5617,55 @@ static char *unistim_info(struct ast_cli_entry *e, int
|
|
|
|
|
if (a->argc != e->args)
|
|
|
|
|
return CLI_SHOWUSAGE;
|
|
|
|
|
|
|
|
|
@ -3861,7 +3846,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
s->device, s);
|
|
|
|
|
s = s->next;
|
|
|
|
|
}
|
|
|
|
|
@@ -4974,7 +5824,7 @@ static void unquote(char *out, const char *src, int ma
|
|
|
|
|
@@ -4973,7 +5823,7 @@ static void unquote(char *out, const char *src, int ma
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -3870,7 +3855,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
{
|
|
|
|
|
char line[256];
|
|
|
|
|
char *at;
|
|
|
|
|
@@ -5049,7 +5899,7 @@ static int ParseBookmark(const char *text, struct unis
|
|
|
|
|
@@ -5048,7 +5898,7 @@ static int ParseBookmark(const char *text, struct unis
|
|
|
|
|
ast_copy_string(d->softkeylabel[p], line, sizeof(d->softkeylabel[p]));
|
|
|
|
|
ast_copy_string(d->softkeynumber[p], number, sizeof(d->softkeynumber[p]));
|
|
|
|
|
if (unistimdebug)
|
|
|
|
@ -3879,7 +3864,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
p, d->softkeylabel[p], d->softkeynumber[p], d->softkeyicon[p]);
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
@@ -5080,15 +5930,29 @@ static void finish_bookmark(void)
|
|
|
|
|
@@ -5079,15 +5929,29 @@ static void finish_bookmark(void)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -3912,7 +3897,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
|
|
|
|
|
/* First, we need to know if we already have this name in our list */
|
|
|
|
|
/* Get a lock for the device chained list */
|
|
|
|
|
@@ -5105,22 +5969,39 @@ static struct unistim_device *build_device(const char
|
|
|
|
|
@@ -5104,22 +5968,39 @@ static struct unistim_device *build_device(const char
|
|
|
|
|
}
|
|
|
|
|
/* we're reloading right now */
|
|
|
|
|
create = 0;
|
|
|
|
@ -3959,7 +3944,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
ast_copy_string(context, DEFAULTCONTEXT, sizeof(context));
|
|
|
|
|
d->contrast = -1;
|
|
|
|
|
d->output = OUTPUT_HANDSET;
|
|
|
|
|
@@ -5128,12 +6009,16 @@ static struct unistim_device *build_device(const char
|
|
|
|
|
@@ -5127,12 +6008,16 @@ static struct unistim_device *build_device(const char
|
|
|
|
|
d->volume = VOLUME_LOW;
|
|
|
|
|
d->mute = MUTE_OFF;
|
|
|
|
|
d->height = DEFAULTHEIGHT;
|
|
|
|
@ -3976,7 +3961,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
nbsoftkey = 0;
|
|
|
|
|
while (v) {
|
|
|
|
|
if (!strcasecmp(v->name, "rtp_port"))
|
|
|
|
|
@@ -5174,19 +6059,25 @@ static struct unistim_device *build_device(const char
|
|
|
|
|
@@ -5173,19 +6058,25 @@ static struct unistim_device *build_device(const char
|
|
|
|
|
ringvolume = atoi(v->value);
|
|
|
|
|
else if (!strcasecmp(v->name, "ringstyle"))
|
|
|
|
|
ringstyle = atoi(v->value);
|
|
|
|
@ -4008,7 +3993,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
else if (!strcasecmp(v->name, "amaflags")) {
|
|
|
|
|
int y;
|
|
|
|
|
y = ast_cdr_amaflags2int(v->value);
|
|
|
|
|
@@ -5194,17 +6085,17 @@ static struct unistim_device *build_device(const char
|
|
|
|
|
@@ -5193,17 +6084,17 @@ static struct unistim_device *build_device(const char
|
|
|
|
|
ast_log(LOG_WARNING, "Invalid AMA flags: %s at line %d\n", v->value,
|
|
|
|
|
v->lineno);
|
|
|
|
|
else
|
|
|
|
@ -4032,7 +4017,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
else if (!strcasecmp(v->name, "linelabel"))
|
|
|
|
|
unquote(linelabel, v->value, sizeof(linelabel) - 1);
|
|
|
|
|
else if (!strcasecmp(v->name, "extension")) {
|
|
|
|
|
@@ -5221,103 +6112,93 @@ static struct unistim_device *build_device(const char
|
|
|
|
|
@@ -5220,103 +6111,93 @@ static struct unistim_device *build_device(const char
|
|
|
|
|
ast_log(LOG_WARNING,
|
|
|
|
|
"More than 6 softkeys defined. Ignoring new entries.\n");
|
|
|
|
|
else {
|
|
|
|
@ -4193,7 +4178,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
if ((autoprovisioning == AUTOPROVISIONING_TN) &&
|
|
|
|
|
(!ast_strlen_zero(d->extension_number))) {
|
|
|
|
|
d->extension = EXTENSION_TN;
|
|
|
|
|
@@ -5330,8 +6211,6 @@ static struct unistim_device *build_device(const char
|
|
|
|
|
@@ -5329,8 +6210,6 @@ static struct unistim_device *build_device(const char
|
|
|
|
|
} else if (ast_strlen_zero(d->id)) {
|
|
|
|
|
if (strcmp(d->name, "template")) {
|
|
|
|
|
ast_log(LOG_ERROR, "You must specify the mac address with device=\n");
|
|
|
|
@ -4202,7 +4187,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
if (d->tz) {
|
|
|
|
|
d->tz = ast_tone_zone_unref(d->tz);
|
|
|
|
|
}
|
|
|
|
|
@@ -5344,8 +6223,6 @@ static struct unistim_device *build_device(const char
|
|
|
|
|
@@ -5343,8 +6222,6 @@ static struct unistim_device *build_device(const char
|
|
|
|
|
d->rtp_port = 10000;
|
|
|
|
|
if (d->contrast == -1)
|
|
|
|
|
d->contrast = 8;
|
|
|
|
@ -4211,7 +4196,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
if (ast_strlen_zero(d->maintext1))
|
|
|
|
|
strcpy(d->maintext1, d->name);
|
|
|
|
|
if (ast_strlen_zero(d->titledefault)) {
|
|
|
|
|
@@ -5431,8 +6308,13 @@ static int reload_config(void)
|
|
|
|
|
@@ -5430,8 +6307,13 @@ static int reload_config(void)
|
|
|
|
|
} else if (!strcasecmp(v->name, "cos_audio")) {
|
|
|
|
|
if (ast_str2cos(v->value, &qos.cos_audio))
|
|
|
|
|
ast_log(LOG_WARNING, "Invalid cos_audio value at line %d, refer to QoS documentation\n", v->lineno);
|
|
|
|
@ -4226,7 +4211,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
autoprovisioning = AUTOPROVISIONING_NO;
|
|
|
|
|
else if (!strcasecmp(v->value, "yes"))
|
|
|
|
|
autoprovisioning = AUTOPROVISIONING_YES;
|
|
|
|
|
@@ -5490,44 +6372,57 @@ static int reload_config(void)
|
|
|
|
|
@@ -5489,44 +6371,57 @@ static int reload_config(void)
|
|
|
|
|
d = devices;
|
|
|
|
|
while (d) {
|
|
|
|
|
if (d->to_delete) {
|
|
|
|
@ -4315,7 +4300,7 @@ $OpenBSD: patch-channels_chan_unistim_c,v 1.2 2011/06/24 13:50:09 sthen Exp $
|
|
|
|
|
if (d->session) {
|
|
|
|
|
if (sessions == d->session)
|
|
|
|
|
sessions = d->session->next;
|
|
|
|
|
@@ -5571,9 +6466,15 @@ static int reload_config(void)
|
|
|
|
|
@@ -5570,9 +6465,15 @@ static int reload_config(void)
|
|
|
|
|
ast_mutex_lock(&sessionlock);
|
|
|
|
|
s = sessions;
|
|
|
|
|
while (s) {
|
|
|
|
|