44 #if defined(__CYGWIN__) || defined(__NetBSD__) 83 #define DEFAULTCONTEXT "default" 84 #define DEFAULTCALLERID "Unknown" 85 #define DEFAULTCALLERNAME " " 86 #define DEFAULTHEIGHT 3 87 #define USTM_LOG_DIR "unistimHistory" 88 #define USTM_LANG_DIR "unistimLang" 91 #define MAX_BUF_SIZE 64 93 #define MAX_BUF_NUMBER 150 95 #define MAX_SCREEN_NUMBER 15 97 #define MONTH_LABEL_SIZE 3 99 #define NB_MAX_RETRANSMIT 8 101 #define IDLE_WAIT 1000 103 #define RETRANSMIT_TIMER 2000 105 #define TIMER_MWI 5000 107 #define DEFAULT_INTERDIGIT_TIMER 4000 110 #define DEFAULT_CODEC 0x00 111 #define SIZE_PAGE 4096 112 #define DEVICE_NAME_LEN 16 113 #define AST_CONFIG_MAX_PATH 255 114 #define MAX_ENTRY_LOG 30 118 #define SUB_THREEWAY 2 138 #define OUTPUT_HANDSET 0xC0 139 #define OUTPUT_HEADPHONE 0xC1 140 #define OUTPUT_SPEAKER 0xC2 142 #define VOLUME_LOW 0x01 143 #define VOLUME_LOW_SPEAKER 0x03 144 #define VOLUME_NORMAL 0x02 145 #define VOLUME_INSANELY_LOUD 0x07 147 #define MUTE_OFF 0x00 149 #define MUTE_ON_DISCRET 0xCE 151 #define LED_BAR_OFF 0x00 152 #define LED_BAR_ON 0x01 153 #define LED_BAR_P2 0x02 154 #define LED_BAR_P3 0x03 155 #define LED_BAR_P4 0x04 156 #define LED_BAR_P5 0x05 157 #define LED_BAR_P6 0x06 158 #define LED_BAR_P7 0x07 159 #define LED_SPEAKER_OFF 0x08 160 #define LED_SPEAKER_ON 0x09 161 #define LED_HEADPHONE_OFF 0x010 162 #define LED_HEADPHONE_ON 0x011 163 #define LED_MUTE_OFF 0x018 164 #define LED_MUTE_ON 0x019 165 #define LED_MUTE_BLINK 0x1A 167 #define SIZE_HEADER 6 168 #define SIZE_MAC_ADDR 17 169 #define TEXT_LENGTH_MAX 24 170 #define TEXT_LINE0 0x00 171 #define TEXT_LINE1 0x20 172 #define TEXT_LINE2 0x40 173 #define TEXT_NORMAL 0x05 174 #define TEXT_INVERSE 0x25 175 #define STATUS_LENGTH_MAX 28 177 #define FAV_ICON_NONE 0x00 178 #define FAV_ICON_ONHOOK_BLACK 0x20 179 #define FAV_ICON_ONHOOK_WHITE 0x21 180 #define FAV_ICON_SPEAKER_ONHOOK_BLACK 0x22 181 #define FAV_ICON_SPEAKER_ONHOOK_WHITE 0x23 182 #define FAV_ICON_OFFHOOK_BLACK 0x24 183 #define FAV_ICON_OFFHOOK_WHITE 0x25 184 #define FAV_ICON_ONHOLD_BLACK 0x26 185 #define FAV_ICON_ONHOLD_WHITE 0x27 186 #define FAV_ICON_SPEAKER_OFFHOOK_BLACK 0x28 187 #define FAV_ICON_SPEAKER_OFFHOOK_WHITE 0x29 188 #define FAV_ICON_PHONE_BLACK 0x2A 189 #define FAV_ICON_PHONE_WHITE 0x2B 190 #define FAV_ICON_SPEAKER_ONHOLD_BLACK 0x2C 191 #define FAV_ICON_SPEAKER_ONHOLD_WHITE 0x2D 192 #define FAV_ICON_HEADPHONES 0x2E 193 #define FAV_ICON_HEADPHONES_ONHOLD 0x2F 194 #define FAV_ICON_HOME 0x30 195 #define FAV_ICON_CITY 0x31 196 #define FAV_ICON_SHARP 0x32 197 #define FAV_ICON_PAGER 0x33 198 #define FAV_ICON_CALL_CENTER 0x34 199 #define FAV_ICON_FAX 0x35 200 #define FAV_ICON_MAILBOX 0x36 201 #define FAV_ICON_REFLECT 0x37 202 #define FAV_ICON_COMPUTER 0x38 203 #define FAV_ICON_FORWARD 0x39 204 #define FAV_ICON_LOCKED 0x3A 205 #define FAV_ICON_TRASH 0x3B 206 #define FAV_ICON_INBOX 0x3C 207 #define FAV_ICON_OUTBOX 0x3D 208 #define FAV_ICON_MEETING 0x3E 209 #define FAV_ICON_BOX 0x3F 211 #define FAV_BLINK_FAST 0x20 212 #define FAV_BLINK_SLOW 0x40 214 #define FAV_MAX_LENGTH 0x0A 218 #define FAV_LINE_ICON FAV_ICON_ONHOOK_BLACK 220 static void dummy(
char *unused, ...)
231 .resync_threshold = 1000,
241 #define DEBUG_TIMER dummy 254 }
qos = { 0, 0, 0, 0 };
345 static const int dtmf_row[] = { 697, 770, 852, 941 };
346 static const float dtmf_col[] = { 1209, 1336, 1477, 1633 };
448 char extension_number[11];
460 struct sockaddr_in sin;
461 struct sockaddr_in sout;
507 { 0xff, 0xff, 0xff, 0xff, 0x02, 0x02, 0xff, 0xff, 0xff, 0xff, 0x9e, 0x03, 0x08 };
509 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 };
512 { 0x00, 0x00, 0x00, 0x13, 0x9a, 0x0a, 0x02 };
514 { 0x00, 0x00, 0x00, 0x13, 0x9a, 0x04, 0x03 };
516 { 0x00, 0x00, 0x00, 0x13, 0x99, 0x04, 0x00 };
518 { 0x00, 0x00, 0x00, 0x13, 0x99, 0x03, 0x04 };
520 { 0x00, 0x00, 0x00, 0x13, 0x99, 0x03, 0x03 };
521 static const unsigned char packet_recv_r2[] = { 0x00, 0x00, 0x00, 0x13, 0x96, 0x03, 0x03 };
525 { 0x00, 0x00, 0x00, 0x13, 0x89, 0x04, 0x59 };
529 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 };
534 { 0xff, 0xff, 0xff, 0xff, 0x9e, 0x03, 0x08 };
536 { 0xff, 0xff, 0xff, 0xff, 0x9a, 0x0d, 0x07 };
539 { 0x11, 0x09, 0x02, 0x02, 0x05, 0x06, 0x07,
543 { 0x11, 0x09, 0x02, 0x0a, 0x05, 0x06, 0x07,
544 0x08, 0x32, 0x17, 0x04, 0x24, 0x07, 0x19,
545 0x04, 0x07, 0x00, 0x19, 0x05, 0x09, 0x3e, 0x0f, 0x16, 0x05, 0x00, 0x80, 0x00, 0x1e,
546 0x05, 0x12, 0x00, 0x78
550 { 0x16, 0x04, 0x1a, 0x00, 0x16, 0x04, 0x11, 0x00 };
552 { 0x16, 0x04, 0x1a, 0x00, 0x16, 0x04, 0x11, 0x00, 0x16, 0x06, 0x32, 0xdf, 0x00, 0xff,
553 0x16, 0x05, 0x1c, 0x00, 0x00, 0x17, 0x05,
554 0x0b, 0x00, 0x00, 0x19, 0x04, 0x00, 0x00, 0x19, 0x04, 0x00, 0x08, 0x19, 0x04, 0x00,
555 0x10, 0x19, 0x04, 0x00, 0x18, 0x16, 0x05,
556 0x31, 0x00, 0x00, 0x16, 0x05, 0x04, 0x00, 0x00
559 { 0x16, 0x04, 0x1a, 0x00, 0x16, 0x04, 0x11, 0x00, 0x16, 0x06, 0x32, 0xdf,
560 0x00, 0xff, 0x16, 0x05, 0x1c, 0x00, 0x00, 0x16, 0x0a, 0x38, 0x00, 0x12, 0xca, 0x03,
561 0xc0, 0xc3, 0xc5, 0x16, 0x16, 0x30, 0x00,
562 0x00, 0x12, 0x12, 0x01, 0x5c, 0x00,
563 0x0f, 0xa0, 0x9c, 0x41,
564 0x0f, 0xa0, 0x9c, 0x41, 0x0a, 0x01,
568 { 0x16, 0x05, 0x1c, 0x00, 0x00 };
572 static const unsigned char packet_send_CloseAudioStreamRX[] = { 0x16, 0x05, 0x31, 0x00, 0xff };
573 static const unsigned char packet_send_CloseAudioStreamTX[] = { 0x16, 0x05, 0x31, 0xff, 0x00 };
576 { 0x16, 0x06, 0x1b, 0x00, 0x00, 0x05 };
578 { 0x16, 0x06, 0x1d, 0x00, 0x01, 0xb8 };
580 { 0x16, 0x08, 0x1d, 0x00, 0x01, 0xb8, 0x01, 0x5e };
582 { 0x16, 0x06, 0x32, 0xc0, 0x01, 0x00 };
585 { 0x16, 0x06, 0x32, 0xdf, 0x00, 0xff, 0x16, 0x05, 0x1c, 0x00, 0x00, 0x16,
586 0x04, 0x1a, 0x01, 0x16, 0x05, 0x12, 0x13 , 0x18, 0x16, 0x04, 0x18,
587 0x20, 0x16, 0x04, 0x10, 0x00
593 { 0x16, 0x06, 0x32, 0xdf, 0x00, 0xff, 0x16, 0x05, 0x31, 0x00, 0x00, 0x16, 0x04, 0x37, 0x10 };
595 { 0x16, 0x06, 0x32, 0xdf, 0x00, 0xff, 0x19, 0x04, 0x00, 0x10, 0x16, 0x05, 0x1c, 0x00,
598 { 0x16, 0x08, 0x38, 0x00, 0x00, 0xe0, 0x00, 0xa0 };
600 { 0x16, 0x0e, 0x3a, 0x00, 0x02, 0x04, 0x00, 0x00,
602 0x00, 0x00, 0x3e, 0x80
609 { 0x16, 0x1a, 0x30, 0x00, 0xff, 0x00, 0x00, 0x01, 0x00, 0xb8, 0xb8, 0x0e,
610 0x0e, 0x01, 0x14, 0x50, 0x00,
611 0x00, 0x14, 0x50, 0x00, 0x00, 0x0a, 0x93, 0x69, 0x05
614 { 0x16, 0x1a, 0x30, 0xff, 0x00, 0x00, 0x00, 0x01, 0x00, 0xb8, 0xb8, 0x0e,
615 0x0e, 0x01, 0x14, 0x50,
616 0x00, 0x00, 0x14, 0x50, 0x00, 0x00, 0x0a, 0x93, 0x69, 0x05
620 { 0x16, 0x1a, 0x30, 0x00, 0xff, 0x00, 0x00, 0x02, 0x01, 0xb8, 0xb8, 0x06,
621 0x06, 0x81, 0x14, 0x50,
623 0x51, 0x14, 0x50, 0x00, 0x00, 0x0a, 0x93,
627 { 0x16, 0x1a, 0x30, 0xff, 0x00, 0x00, 0x00, 0x02, 0x01, 0xb8, 0xb8, 0x06,
628 0x06, 0x81, 0x14, 0x50,
629 0x00, 0x00, 0x14, 0x50, 0x00, 0x00,
630 0x0a, 0x93, 0x69, 0x05
636 0x06, 0x07, 0x08, 0x32
639 { 0x17, 0x04, 0x24, 0x08 };
641 { 0x17, 0x05, 0x0b, 0x05, 0x00, 0x17, 0x08, 0x16,
642 'T',
'i',
'm',
'e',
'r' };
645 static const unsigned char packet_send_S7[] = { 0x17, 0x06, 0x0f, 0x30, 0x07, 0x07 };
647 { 0x17, 0x06, 0x10, 0x81, 0x04, 0x20 };
650 {
'J',
'a',
'n',
'F',
'e',
'b',
'M',
'a',
'r',
'A',
'p',
'r',
'M',
'a',
'y',
'J',
'u',
'n',
651 'J',
'u',
'l',
'A',
'u',
'g',
'S',
'e',
'p',
'O',
'c',
't',
'N',
'o',
'v',
'D',
'e',
'c' };
653 { 0x17, 0x0a, 0x15,
'-',
'-',
'-',
'-',
'-',
'-', 0x20 };
655 { 0x17, 0x0f, 0x19, 0x10, 0x01, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
656 0x20, 0x20, 0x20, 0x20, 0x19,
657 0x05, 0x0f, 0x01, 0x00
660 { 0x17, 0x10, 0x19, 0x02, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
661 0x20, 0x20, 0x20, 0x20 };
663 { 0x17, 0x1e, 0x1b, 0x04, 0x00, 0x25, 0x20, 0x20,
664 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
665 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
666 0x17, 0x04, 0x10, 0x87
669 { 0x17, 0x20, 0x19, 0x08, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
670 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
671 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20
674 { 0x17, 0x0b, 0x19, 0x00, 0x20, 0x20, 0x20, 0x20,
680 { 0x17, 0x08, 0x21, 0x1b, 0x2d, 0x41, 0x1b, 0x00 };
683 { 0x17, 0x08, 0x21, 0x1b, 0x2d, 0x42, 0x1b, 0x00 };
686 { 0x17, 0x08, 0x21, 0x1b, 0x2d, 0x44, 0x1b, 0x00 };
689 { 0x17, 0x08, 0x21, 0x1b, 0x2d, 0x4c, 0x1b, 0x00 };
692 { 0x17, 0x08, 0x21, 0x1b, 0x29, 0x49, 0x1b, 0x7e };
699 static const unsigned char packet_send_S1[] = { 0x1a, 0x07, 0x07, 0x00, 0x00, 0x00, 0x13 };
702 { 0x1e, 0x05, 0x12, 0x00, 0x78 };
704 #define BUFFSEND unsigned char buffsend[64] = { 0x00, 0x00, 0xaa, 0xbb, 0x02, 0x01 } 706 static const char tdesc[] =
"UNISTIM Channel Driver";
718 const char *dest,
int *cause);
729 unsigned int duration);
738 .description =
tdesc,
815 char tmp[1024], *p, *p_orig =
NULL, *p_trans =
NULL;
831 while (fgets(tmp,
sizeof(tmp), f)) {
832 if (!(p = strchr(tmp,
'\n'))) {
837 if (!(p = strchr(tmp,
'"'))) {
840 if (tmp == strstr(tmp,
"msgid")) {
842 p = strchr(p_orig,
'"');
843 }
else if (tmp == strstr(tmp,
"msgstr")) {
845 p = strchr(p_trans,
'"');
850 if (!p_trans || !p_orig) {
899 return (now.tv_sec * 1000) + (now.tv_usec / 1000);
903 static void send_raw_client(
int size,
const unsigned char *data,
struct sockaddr_in *addr_to,
904 const struct sockaddr_in *addr_ourip)
907 struct iovec msg_iov;
909 char buffer[CMSG_SPACE(
sizeof(
struct in_pktinfo))];
910 struct cmsghdr *ip_msg = (
struct cmsghdr *) buffer;
911 struct in_pktinfo *pki = (
struct in_pktinfo *) CMSG_DATA(ip_msg);
918 msg_iov.iov_base = (
char *) data;
919 msg_iov.iov_len = size;
921 msg.msg_name = addr_to;
922 msg.msg_namelen =
sizeof(
struct sockaddr_in);
923 msg.msg_iov = &msg_iov;
925 msg.msg_control = ip_msg;
926 msg.msg_controllen =
sizeof(buffer);
929 ip_msg->cmsg_len = CMSG_LEN(
sizeof(*pki));
930 ip_msg->cmsg_level = IPPROTO_IP;
931 ip_msg->cmsg_type = IP_PKTINFO;
932 pki->ipi_ifindex = 0;
933 pki->ipi_spec_dst.s_addr = addr_ourip->sin_addr.s_addr;
939 ast_verb(0,
"\n**> From %s sending %d bytes to %s ***\n",
942 for (tmp = 0; tmp < size; tmp++)
944 ast_verb(0,
"\n******************************************\n");
953 if (sendto(
unistimsock, data, size, 0, (
struct sockaddr *) addr_to,
sizeof(*addr_to))
973 memcpy((
void *)data +
sizeof(
unsigned short), (
void *)&seq,
sizeof(
unsigned short));
982 ast_verb(0,
"Sending datas with seq #0x%04x Using slot #%d :\n", (
unsigned)pte->
seq_server, buf_pos);
1007 struct cmsghdr *cmsg;
1008 struct sockaddr_in peeraddr;
1009 struct in_addr addr;
1010 struct msghdr mh = {
1011 .msg_name = &peeraddr,
1012 .msg_namelen =
sizeof(peeraddr),
1013 .msg_control = cmbuf,
1014 .msg_controllen =
sizeof(cmbuf),
1016 memset(&addr, 0,
sizeof(addr));
1018 err = recvmsg(fd, &mh, MSG_PEEK);
1023 for(cmsg = CMSG_FIRSTHDR(&mh);
1025 cmsg = CMSG_NXTHDR(&mh, cmsg))
1027 if (cmsg->cmsg_level == IPPROTO_IP && cmsg->cmsg_type == IP_PKTINFO) {
1028 struct in_pktinfo *pkt = (
struct in_pktinfo*)CMSG_DATA(cmsg);
1029 addr = pkt->ipi_addr;
1035 memcpy(&toAddr->sin_addr, &addr,
sizeof(
struct in_addr));
1038 memcpy(toAddr, &
public_ip,
sizeof(*toAddr));
1054 memcpy(&s->
sin, addr_from,
sizeof(
struct sockaddr_in));
1059 s->
sout.sin_family = AF_INET;
1061 ast_verb(0,
"Creating a new entry for the phone from %s received via server ip %s\n",
1092 unsigned int tick = 0;
1106 ast_verb(0,
"Our single packet was ACKed.\n");
1115 ast_verb(0,
"Our send queue is completely ACKed.\n");
1122 ast_verb(0,
"We still have packets in our send queue\n");
1131 ast_verb(0,
"Sending start timer\n");
1141 ast_verb(0,
"Sending stop timer\n");
1151 ast_verb(0,
"Sending icon pos %d with status 0x%02hhx\n", pos, status);
1171 ast_verb(0,
"Sending expansion icon pos %d with status 0x%02hhx\n", pos, status);
1185 ast_log(
LOG_ERROR,
"[expansion] Asked to display NULL text (pos %d)\n", pos);
1189 ast_verb(0,
"[expansion] Sending text at pos %d\n", pos);
1197 memcpy(buffsend + 11, text, i);
1206 ast_verb(0,
"Sending Stream Based Tone Off\n");
1219 ast_verb(0,
"Sending Stream Based Tone Frequency Component List Download %d %d\n", tone1, tone2);
1239 ast_verb(0,
"Sending Stream Based Tone On\n");
1280 ast_verb(0,
"Sending favorite pos %d with status 0x%02hhx\n", pos, status);
1315 if(d->
height == 1 && num % 3 == 2) {
1323 unsigned char i = 0;
1329 ast_verb(0,
"Refreshing all favorite\n");
1331 for (i = 0; i <
FAVNUM; i++) {
1346 for (i = 0; i <
EXPNUM; i++) {
1354 if ((fav < 0) || (fav >=
FAVNUM)) {
1357 if (d->
sline[fav]) {
1368 if ((fav < 0) || (fav >=
FAVNUM)) {
1371 if (!d->
sline[fav]) {
1392 for (i = 0; i <
FAVNUM; i++) {
1407 ast_verb(0,
"Found softkey %d for device %s\n", i, name);
1425 if (softkeylinepos != -1) {
1431 for (i = 0; i <
FAVNUM; i++) {
1450 ast_verb(0,
"Trying to register extension '%s' into context '%s' to %s\n",
1462 ast_verb(0,
"Trying to unregister extension '%s' context '%s'\n",
1488 ast_verb(0,
"close_client session %p device %p\n", s, s->
device);
1520 ast_verb(0,
"Freeing an unregistered client\n");
1545 ast_verb(0,
"Too many retransmit - freeing client\n");
1557 "Asked to retransmit an ACKed slot ! last_buf_available=%d, seq_server = #0x%04x last_seq_ack = #0x%04x\n",
1563 unsigned short *sbuf = (
unsigned short *) pte->
wsabufsend[i].
buf;
1566 seq = ntohs(sbuf[1]);
1567 ast_verb(0,
"Retransmit slot #%d (seq=#0x%04x), last ack was #0x%04x\n", i,
1584 ast_log(
LOG_ERROR,
"Asked to display NULL text (pos %d, inverse flag %d)\n", pos, inverse);
1591 ast_verb(0,
"Sending text at pos %d, inverse flag %d\n", pos, inverse);
1595 buffsend[11] = inverse;
1600 memcpy(buffsend + 12, text, i);
1609 ast_verb(0,
"Sending status text\n");
1613 int n = strlen(text);
1616 for (i = 0, j = 0; i < 4; i++, j += 7) {
1617 int pos = 0x08 + (i * 0x20);
1622 memcpy(buffsend + 10, (j < n) ? (text + j) :
" ", 7);
1634 memcpy(buffsend + 10, text, i);
1643 ast_verb(0,
"Sending led_update (%x)\n", (
unsigned)led);
1658 ast_verb(0,
"Sending mute packet (%x)\n", (
unsigned)mute);
1676 ast_verb(0,
"Sending select output packet output=%x volume=%x mute=%x\n",
1677 (
unsigned)output, (
unsigned)volume, (
unsigned)mute);
1681 buffsend[9] = output;
1685 buffsend[10] = volume;
1689 buffsend[11] =
mute;
1711 if (mute_icon != -1) {
1723 ast_verb(0,
"Sending ring packet\n");
1726 buffsend[24] = style + 0x10;
1727 buffsend[29] = volume * 0x10;
1735 ast_verb(0,
"Sending no ring packet\n");
1746 ast_verb(0,
"Sending title text\n");
1753 memcpy(buffsend + 10, text, i);
1768 ast_verb(0,
"Sending Month Labels\n");
1774 memcpy(buffsend +
SIZE_HEADER + 3 + i*MONTH_LABEL_SIZE,
ustmtext(month_name, pte), MONTH_LABEL_SIZE);
1777 month = (month + 1)%12;
1788 struct ast_tm atm = { 0, };
1791 ast_verb(0,
"Sending Time & Date\n");
1795 buffsend[10] = (
unsigned char) atm.
tm_mon + 1;
1796 buffsend[11] = (
unsigned char) atm.
tm_mday;
1797 buffsend[12] = (
unsigned char) atm.
tm_hour;
1798 buffsend[13] = (
unsigned char) atm.
tm_min;
1807 struct ast_tm atm = { 0, };
1810 ast_verb(0,
"Sending Time & Date #2\n");
1819 buffsend[14] = (
unsigned char) atm.
tm_mon + 1;
1820 buffsend[15] = (
unsigned char) atm.
tm_mday;
1821 buffsend[16] = (
unsigned char) atm.
tm_hour;
1822 buffsend[17] = (
unsigned char) atm.
tm_min;
1830 struct ast_tm atm = { 0, };
1833 ast_verb(0,
"Sending Time & Date #3\n");
1837 buffsend[10] = (
unsigned char) atm.
tm_mon + 1;
1838 buffsend[11] = (
unsigned char) atm.
tm_mday;
1839 buffsend[12] = (
unsigned char) atm.
tm_hour;
1840 buffsend[13] = (
unsigned char) atm.
tm_min;
1848 ast_verb(0,
"Sending set blink\n");
1860 ast_verb(0,
"Sending set cursor position\n");
1871 const unsigned char* packet_send_charset;
1875 ast_verb(0,
"Sending set default charset\n");
1902 memcpy(buffsend +
SIZE_HEADER, packet_send_charset, packet_size);
1911 ast_verb(0,
"ResumeConnectionWithServer received\n");
1912 ast_verb(0,
"Sending packet_send_query_mac_address\n");
1950 memcpy(dst, src,
sizeof(*dst));
1996 ast_verb(3,
"Allocating UNISTIM subchannel #%d on %s ptr=%p\n", x, d->
name, sub);
2058 return "SELECTOPTION";
2060 return "SELECTCODEC";
2062 return "SELECTLANGUAGE";
2078 sprintf(&addrmac[i],
"%02hhx", buf[tmp]);
2082 ast_verb(0,
"MAC Address received: %s\n", addrmac);
2084 strcpy(pte->
macaddr, addrmac);
2097 ast_verb(0,
"New phone, autoprovisioning on\n");
2103 if (strcasecmp(d->
name,
"template")) {
2112 memcpy(newd, d,
sizeof(*newd));
2114 newd->lines.first =
NULL;
2115 newd->lines.last =
NULL;
2125 newl->
name, newd->name);
2126 snprintf(l->name,
sizeof(l->name),
"%d", atoi(l->name) + 1);
2146 newd->session = pte;
2147 newd->language[0] =
'\0';
2148 newd->to_delete = -1;
2184 ast_log(
LOG_ERROR,
"Subchannel lost sice reboot. Hanged channel may apear!\n");
2243 ast_verb(0,
"Sending query_basic_manager_04\n");
2250 ast_verb(0,
"Sending query_basic_manager_10\n");
2262 if (fwrite(&c, 1, 1, f) != 1) {
2285 char count = 0, *histbuf;
2289 struct ast_tm atm = { 0, };
2319 snprintf(line1,
sizeof(line1),
"%04d/%02d/%02d %02d:%02d:%02d %s",
2325 if ((f = fopen(tmp,
"r"))) {
2326 struct stat bufstat;
2328 if (stat(tmp, &bufstat)) {
2334 if (bufstat.st_size != size) {
2336 "History file %s has an incorrect size (%d instead of %d). It will be replaced by a new one.",
2337 tmp, (
int) bufstat.st_size, size);
2349 if ((
errno != ENOENT) && (count == 0)) {
2353 f = fopen(tmp,
"w");
2376 if (fread(&count, 1, 1, f) != 1) {
2389 if (!(f2 = fopen(tmp2,
"w"))) {
2410 if (fread(histbuf, size, 1, f) != 1) {
2417 if (fwrite(histbuf, size, 1, f2) != 1) {
2434 if (rename(tmp2, tmp)) {
2486 size = strlen(callerid);
2490 memcpy(data, callerid, size);
2538 ast_verb(0,
"Starting silence generator\n");
2549 ast_verb(0,
"Stopping silence generator\n");
2616 ast_verb(0,
"attempt_transfer failed.\n");
2623 if (sub_transf->
owner) {
2690 struct sockaddr_in us = { 0, };
2700 if (htons(us.sin_port)) {
2701 rtp_start = htons(us.sin_port) + 1;
2715 struct sockaddr_in public = { 0, };
2716 struct sockaddr_in us = { 0, };
2717 struct sockaddr_in sin = { 0, };
2729 memcpy(&
public, &us,
sizeof(
public));
2731 memcpy(&
public, &
public_ip,
sizeof(
public));
2734 ast_verb(0,
"RTP started : Our IP/port is : %s:%hd with codec %s\n",
2737 ast_verb(0,
"Starting phone RTP stack. Our public IP is %s\n",
2747 ast_verb(0,
"Sending packet_send_rtp_packet_size for codec %d\n", codec);
2751 buffsend[10] = (int) codec & 0xffffffffLL;
2755 ast_verb(0,
"Sending Jitter Buffer Parameters Configuration\n");
2761 uint16_t rtcpsin_port = ntohs(us.sin_port) + 1;
2774 memcpy(buffsend + 28, &
public.sin_addr,
sizeof(
public.sin_addr));
2780 memcpy(buffsend + 23, &
public.sin_addr,
sizeof(
public.sin_addr));
2784 buffsend[11] = codec;
2785 buffsend[12] = codec;
2789 ast_verb(0,
"Sending OpenAudioStreamRX\n");
2799 memcpy(buffsend + 28, &
public.sin_addr,
sizeof(
public.sin_addr));
2805 memcpy(buffsend + 23, &
public.sin_addr,
sizeof(
public.sin_addr));
2809 buffsend[11] = codec;
2810 buffsend[12] = codec;
2813 uint16_t rtcpsin_port = htons(us.sin_port) + 1;
2816 ast_verb(0,
"Sending packet_send_call default method\n");
2820 memcpy(buffsend + 53, &
public.sin_addr,
sizeof(
public.sin_addr));
2826 buffsend[40] = codec;
2827 buffsend[41] = codec;
2849 struct sockaddr_in sin = { 0, };
2850 struct sockaddr_in sout = { 0, };
2897 sin.sin_family = AF_INET;
2900 sizeof(sin.sin_addr));
2911 "Our read/writeformat has been changed to something incompatible: %s, using %s best codec from %s\n",
2937 ast_verb(0,
"Country code found (%s), freq1=%u freq2=%u\n",
2947 const char *tmp_number =
ustmtext(
"Number:", pte);
2948 int line, tmp_copy, offset = 0, i;
2953 if (offset > strlen(tmp_number)) {
2954 offset = strlen(tmp_number);
2956 tmp_copy = strlen(tmp_number) - offset + 1;
2957 if (tmp_copy >
sizeof(tmp)) {
2958 tmp_copy =
sizeof(
tmp);
2960 memcpy(tmp, tmp_number + offset, tmp_copy);
2969 offset = strlen(tmp);
3034 ast_verb(0,
"Swapping %p and %p\n", a, b);
3038 "Attempted to swap subchannels with a null owner : sub #%p=%p sub #%p=%p\n",
3064 if (!sub || !sub->
owner) {
3088 if (!sub || !sub->
owner) {
3094 ast_verb(0,
"Transfer canceled, hangup our threeway channel\n");
3168 ast_verb(0,
"Started three way call on channel %p (%s) subchan %u\n",
3175 if (softkey == -1) {
3198 const char *pickupexten;
3208 ast_log(
LOG_ERROR,
"Unable to retrieve pickup configuration options. Unable to detect call pickup extension\n");
3211 pickupexten =
ast_strdupa(pickup_cfg->pickupexten);
3217 ast_verb(0,
"Try to pickup in unistim_new\n");
3276 for (i = 0; i <
FAVNUM; i++) {
3334 ast_verb(0,
"Phone Play Digit %c\n", digit);
3337 row = (digit -
'1') % 3;
3338 col = (digit -
'1' - row) / 3;
3339 if (digit >=
'1' && digit <=
'9') {
3341 }
else if (digit >=
'A' && digit <=
'D') {
3343 }
else if (digit ==
'*') {
3345 }
else if (digit ==
'0') {
3347 }
else if (digit ==
'#') {
3392 ast_verb(0,
"Handle line w/o sub - dialpage\n");
3402 ast_verb(0,
"Handle favorite w/o sub - dialing\n");
3634 if (sub && sub->
owner) {
3729 #define SELECTCODEC_START_ENTRY_POS 15 3730 #define SELECTCODEC_MAX_LENGTH 2 3731 #define SELECTCODEC_MSG "Codec number : .." 3740 strcat(buf,
" (G711u=0,");
3762 if ((keycode >=
KEY_0) && (keycode <=
KEY_9)) {
3769 while (i < pte->size_buff_entry) {
3810 while (options_languages[i].lang_short !=
NULL) {
3811 if(!strcmp(options_languages[i].lang_short, lang)) {
3821 char tmp_language[40];
3829 lang = options_languages[(int)pte->
buff_entry[0]];
3873 #define SELECTEXTENSION_START_ENTRY_POS 0 3874 #define SELECTEXTENSION_MAX_LENGTH 10 3875 #define SELECTEXTENSION_MSG ".........." 3900 if ((keycode >=
KEY_0) && (keycode <=
KEY_9)) {
3907 while (i < pte->size_buff_entry) {
3933 if (d->
id[0] ==
'T') {
3995 line[
sizeof(line) - 1] =
'\0';
4009 line[
sizeof(line) - 1] =
'\0';
4025 line[
sizeof(line) - 1] =
'\0';
4035 snprintf(line,
sizeof(line),
"%s %03d/%03d",
ustmtext(
"Call", pte), pte->
buff_entry[2],
4054 snprintf(status,
sizeof(status),
"%s%s%s%s", func1, func2, func3,
ustmtext(
"Cancel", pte));
4065 *f = fopen(tmp,
"r");
4070 if (fread(&count, 1, 1, *f) != 1) {
4132 char tmp_field[100];
4168 text =
ustmtext(
"unanswered call", pte);
4170 text =
ustmtext(
"unanswered calls", pte);
4179 strcpy(tmpbuf,
"IP : ");
4255 ast_log(
LOG_ERROR,
"Unable to retrieve pickup configuration options. Unable to detect call pickup extension\n");
4370 if (fseek(f, offset, SEEK_CUR)) {
4420 ast_verb(0,
"Sending init language\n");
4433 for (i = 1; i <
FAVNUM; i++) {
4438 strcpy(tmp,
"MAC = ");
4481 ast_verb(0,
"Got the firmware version : '%s'\n", buf + 13);
4488 char type = buf[13];
4490 ast_verb(0,
"Got the equipment type: '%d'\n", type);
4514 ast_verb(0,
"Request not authorized in this state\n");
4519 char keycode = buf[13];
4522 ast_verb(0,
"Expansion key pressed: keycode = 0x%02hhx - current state: %s\n", (
unsigned char)keycode,
4527 char keycode = buf[13];
4530 ast_verb(0,
"Key pressed: keycode = 0x%02hhx - current state: %s\n", (
unsigned char)keycode,
4536 switch (pte->
state) {
4539 ast_verb(0,
"No keys allowed in the init state\n");
4544 ast_verb(0,
"No keys allowed in authdeny state\n");
4626 strcat(tmpbuf,
" Unknown request packet\n");
4634 struct sockaddr_in *addr_from)
4636 unsigned short *sbuf = (
unsigned short *) buf;
4650 if (sbuf[0] == 0xffff) {
4656 ast_verb(0,
"Discovery packet received - Sending Discovery ACK\n");
4661 ast_verb(1,
"Duplicated Discovery packet\n");
4688 ast_verb(0,
"%s Not a discovery packet from an unknown source : ignoring\n", tmpbuf);
4698 ast_log(
LOG_NOTICE,
"%s Wrong direction : got 0x%02hhx expected 0x02\n", tmpbuf, buf[5]);
4701 seq = ntohs(sbuf[1]);
4705 ast_verb(0,
"ACK received for packet #0x%04x\n", (
unsigned)seq);
4717 ast_verb(0,
"ACK at 0xffff, restarting counter.\n");
4721 "%s Warning : ACK received for an already ACKed packet : #0x%04x we are at #0x%04x\n",
4729 "%s Error : ACK received for a non-existent packet : #0x%04x\n",
4735 ast_verb(0,
"%s ACK gap : Received ACK #0x%04x, previous was #0x%04x\n",
4759 "%s Warning : received a retransmitted packet : #0x%04x (we are at #0x%04x)\n",
4760 tmpbuf, (
unsigned)seq, (
unsigned)pte->
seq_phone);
4769 "%s Warning : we lost a packet : received #0x%04x (we are at #0x%04x)\n",
4770 tmpbuf, (
unsigned)seq, (
unsigned)pte->
seq_phone);
4774 ast_log(
LOG_NOTICE,
"%s Retransmit request for packet #0x%04x\n", tmpbuf, (
unsigned)seq);
4777 "%s Error : received a request for an already ACKed packet : #0x%04x\n",
4783 "%s Error : received a request for a non-existent packet : #0x%04x\n",
4790 ast_log(
LOG_NOTICE,
"%s Unknown request : got 0x%02hhx expected 0x00,0x01 or 0x02\n", tmpbuf, buf[4]);
4840 if (strlen(cidnum_str) == 0) {
4850 if (strlen(cidname_str) == 0) {
4856 snprintf(tmpstr,
sizeof(tmpstr),
"%s %s", cidnum_str,
ustmtext(cidname_str, pte));
4872 signed char ringstyle, ringvolume;
4903 send_ring(session, ringvolume, ringstyle);
4906 for (i = 0; i <
FAVNUM; i++) {
4934 ast_verb(0,
"Destroying RTP session\n");
4958 ast_debug(1,
"Asked to hangup channel not connected\n");
4969 ast_verb(0,
"Threeway call disconnected, switching to real call\n");
4983 ast_verb(0,
"Real call disconnected, stay in call\n");
4995 for (i = 0; i <
FAVNUM; i++) {
4999 if (d->
ssub[i] != sub) {
5020 for (i = 0; i <
FAVNUM; i++) {
5021 if (d->
ssub[i] == sub) {
5091 struct sockaddr_in addr_from = { 0, };
5095 int dw_num_bytes_rcvd;
5096 unsigned int size_addr_from;
5098 int dw_num_bytes_rcvdd;
5101 size_addr_from =
sizeof(addr_from);
5105 if (dw_num_bytes_rcvd == -1) {
5106 if (
errno == EAGAIN) {
5108 }
else if (
errno != ECONNREFUSED) {
5118 if (cur->
sin.sin_addr.s_addr == addr_from.sin_addr.s_addr) {
5129 ast_verb(0,
"\n*** Dump %d bytes from %s - phone_table[%d] ***\n",
5131 for (dw_num_bytes_rcvdd = 0; dw_num_bytes_rcvdd < dw_num_bytes_rcvd;
5132 dw_num_bytes_rcvdd++)
5134 ast_verb(0,
"\n******************************************\n");
5139 ast_verb(0,
"Received a packet from an unknown source\n");
5141 parsing(dw_num_bytes_rcvd,
buff,
NULL, (
struct sockaddr_in *) &addr_from);
5144 parsing(dw_num_bytes_rcvd,
buff, cur, (
struct sockaddr_in *) &addr_from);
5185 "Oooh, format changed from %s to %s\n",
5234 "Asked to transmit frame type %s, while native formats is %s (read/write = (%s/%s)\n",
5261 ast_debug(1,
"New owner for channel USTM/%s@%s-%u is %s\n", l->
name,
5264 if (p->
owner != oldchan) {
5283 return "Other end has hungup";
5285 return "Local ring";
5287 return "Remote end is ringing";
5289 return "Remote end has answered";
5291 return "Remote end is busy";
5293 return "Make it go off hook";
5295 return "Line is off hook";
5297 return "Congestion (circuits busy)";
5299 return "Flash hook";
5303 return "Set a low-level option";
5307 return "Un-Key Radio";
5309 return "Remote end changed";
5311 return "RTP source updated";
5313 return "Source of media changed";
5321 const char *indication)
5340 ast_verb(3,
"Asked to indicate '%s' (%d) condition on channel %s\n",
5431 at = strchr(line,
'@');
5441 at = strchr(device,
'/');
5446 if (!strcasecmp(d->
name, device)) {
5454 if (!strcasecmp(l->
name, line)) {
5473 if ((*at <
'0') || (*at >
'7')) {
5476 signed char ring_volume = -1;
5477 signed char ring_style = *at -
'0';
5479 if ((*at >=
'0') && (*at <=
'3')) {
5480 ring_volume = *at -
'0';
5483 ast_verb(0,
"Distinctive ring: style #%d volume %d\n",
5484 ring_style, ring_volume);
5528 ast_verb(0,
"Send Digit off %c (duration %d)\n", digit, duration);
5543 ast_verb(0,
"unistim_sendtext called\n");
5554 size = strlen(text);
5555 if (text[0] ==
'@') {
5556 int pos = 0, i = 1, tok = 0, sz = 0;
5562 memset(label, 0, 11);
5563 memset(number, 0, 16);
5568 if ((cur <
'0') && (cur >
'5')) {
5570 "sendtext failed : position must be a number beetween 0 and 5\n");
5584 if ((cur <
'3') && (cur >
'6')) {
5586 "sendtext failed : icon must be a number beetween 32 and 63 (first digit invalid)\n");
5589 icon = (cur -
'0') * 10;
5593 if ((cur <
'0') && (cur >
'9')) {
5595 "sendtext failed : icon must be a number beetween 32 and 63 (second digit invalid)\n");
5598 icon += (cur -
'0');
5604 "sendtext failed : icon must be a number beetween 32 and 63 (too many digits)\n");
5624 "sendtext failed : extension too long = %d (15 car max)\n",
5660 tmp[
sizeof(
tmp) - 1] =
'\0';
5666 tmp[
sizeof(
tmp) - 1] =
'\0';
5669 tmp[
sizeof(
tmp) - 1] =
'\0';
5687 ast_debug(3,
"MWI Status for mailbox %s is %d, lastmsgsent:%d\n",
5729 ast_verb(0,
"unistim_new sub=%u (%p) chan=%p line=%s\n", sub->
subtype, sub, tmp, l->
name);
5754 ast_verb(0,
"Best codec = %s from nativeformats %s (line cap=%s global=%s)\n",
5762 ast_verb(0,
"New unistim channel with a previous rtp handle ?\n");
5795 char *
name, *loc, *instr;
5815 ast_verb(0,
"Starting pbx in unistim_new\n");
5838 unsigned int dw_timeout = 0;
5852 dw_timeout = UINT_MAX;
5855 DEBUG_TIMER(
"checking timeout for session %p with tick = %u\n", cur, tick);
5857 DEBUG_TIMER(
"checking timeout for session %p timeout = %u\n", cur,
5867 DEBUG_TIMER(
"The chained link was modified, restarting...\n");
5869 dw_timeout = UINT_MAX;
5874 if (dw_timeout > cur->
timeout - tick) {
5875 dw_timeout = cur->
timeout - tick;
5911 ast_verb(1,
"Reloading unistim.conf...\n");
5914 pthread_testcancel();
5923 pthread_attr_t attr;
5941 pthread_attr_init(&attr);
5942 pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
5968 "Asked to get a channel of unsupported format %s while capability is %s\n",
5994 if (sub_ring || sub_trans) {
5996 ast_verb(0,
"Can't create channel, request already in progress: Busy!\n");
6004 ast_verb(0,
"Can't create channel, user on dialpage: Busy!\n");
6013 ast_verb(0,
"Can't create channel for line %s, all lines busy\n", sub->
parent->
name);
6045 e->
command =
"unistim show info";
6047 "Usage: unistim show info\n" 6048 " Dump internal structures.\n\n" 6062 ast_cli(a->
fd,
"Dumping internal structures:\n");
6067 ast_cli(a->
fd,
"\nname=%s id=%s ha=%p sess=%p device=%p selected=%d height=%d\n",
6073 "->name=%s fullname=%s exten=%s callid=%s cap=%s line=%p\n",
6085 "-->subtype=%s chan=%p rtp=%p line=%p alreadygone=%d softkey=%d\n",
6091 for (i = 0; i <
FAVNUM; i++) {
6095 ast_cli(a->
fd,
"==> %d. dev=%s icon=%#-4x label=%-10s number=%-5s sub=%p line=%p\n",
6099 device = device->
next;
6107 "sin=%s timeout=%d state=%s macaddr=%s device=%p session=%p\n",
6123 e->
command =
"unistim show devices";
6125 "Usage: unistim show devices\n" 6126 " Lists all known Unistim devices.\n";
6135 ast_cli(a->
fd,
"%-20.20s %-20.20s %-15.15s %-15.15s %s\n",
"Name/username",
"MAC",
"Host",
"Firmware",
"Status");
6138 ast_cli(a->
fd,
"%-20.20s %-20.20s %-15.15s %-15.15s %s\n",
6139 device->
name, device->
id,
6142 (!device->
session) ?
"UNKNOWN" :
"OK");
6143 device = device->
next;
6155 unsigned char c, cc;
6160 e->
command =
"unistim send packet";
6162 "Usage: unistim send packet USTM/line@name hexa\n" 6163 " unistim send packet USTM/1000@hans 19040004\n";
6173 if (strlen(a->
argv[3]) < 9) {
6183 ast_cli(a->
fd,
"Can't find '%s'\n", tmp);
6187 ast_cli(a->
fd,
"'%s' is not connected\n", tmp);
6191 for (i = 0; i <
len; i++) {
6205 tmp[j++] = (c << 4) | cc;
6216 e->
command =
"unistim set debug {on|off}";
6218 "Usage: unistim set debug\n" 6219 " Display debug messages.\n";
6229 if (!strcasecmp(a->
argv[3],
"on")) {
6231 ast_cli(a->
fd,
"UNISTIM Debugging Enabled\n");
6232 }
else if (!strcasecmp(a->
argv[3],
"off")) {
6234 ast_cli(a->
fd,
"UNISTIM Debugging Disabled\n");
6249 e->
command =
"unistim reload";
6251 "Usage: unistim reload\n" 6252 " Reloads UNISTIM configuration from unistim.conf\n";
6259 if (e && a && a->
argc != e->
args) {
6277 int len = strlen(src);
6281 if ((len > 1) && src[0] ==
'\"') {
6286 if (maxlen > len - 1) {
6289 memcpy(out, src, maxlen);
6290 ((
char *) out)[maxlen] =
'\0';
6292 memcpy(out, src, maxlen);
6304 int len = strlen(text);
6308 if ((len > 2) && (line[1] ==
'@')) {
6310 if ((p >=
'0') && (p <=
'5')) {
6314 "Invalid position for bookmark : must be between 0 and 5\n");
6321 memmove(line, line + 2,
sizeof(line) - 2);
6324 for (p = 0; p <
FAVNUM; p++) {
6334 at = strchr(line,
'@');
6342 at = strchr(at,
'@');
6352 at = strchr(number,
'@');
6363 if (strncmp(icon,
"USTM/", 5)) {
6373 ast_verb(0,
"New bookmark at pos %d label='%s' number='%s' icon=%#x\n",
6386 for (i = 0; i < 6; i++) {
6413 if (!strcmp(l->
name, val)) {
6436 "Device '%s' was not deleted : a call is in progress. Try again later.\n",
6444 "Device '%s' with threeway call subchannels allocated, aborting.\n",
6487 if (d2->
next == d) {
6506 int nbsoftkey,
dateformat, timeformat, callhistory, sharpdial, linecnt;
6508 signed char ringvolume, ringstyle, cwvolume, cwstyle;
6515 if (!strcmp(d->
name, cat)) {
6564 memset(d->
ssub, 0,
sizeof(d->
ssub));
6566 memset(d->
sp, 0,
sizeof(d->
sp));
6568 linelabel[0] =
'\0';
6581 if (!strcasecmp(v->
name,
"rtp_port")) {
6583 }
else if (!strcasecmp(v->
name,
"rtp_method")) {
6585 }
else if (!strcasecmp(v->
name,
"status_method")) {
6587 }
else if (!strcasecmp(v->
name,
"device")) {
6589 }
else if (!strcasecmp(v->
name,
"tn")) {
6591 }
else if (!strcasecmp(v->
name,
"permit") || !strcasecmp(v->
name,
"deny")) {
6595 ast_log(
LOG_ERROR,
"Invalid ACL '%s' specified for device '%s' on line %d. Deleting device\n",
6600 }
else if (!strcasecmp(v->
name,
"context")) {
6602 }
else if (!strcasecmp(v->
name,
"maintext0")) {
6604 }
else if (!strcasecmp(v->
name,
"maintext1")) {
6606 }
else if (!strcasecmp(v->
name,
"maintext2")) {
6608 }
else if (!strcasecmp(v->
name,
"titledefault")) {
6610 }
else if (!strcasecmp(v->
name,
"dateformat")) {
6611 dateformat = atoi(v->
value);
6612 }
else if (!strcasecmp(v->
name,
"timeformat")) {
6613 timeformat = atoi(v->
value);
6614 }
else if (!strcasecmp(v->
name,
"contrast")) {
6620 }
else if (!strcasecmp(v->
name,
"nat")) {
6622 }
else if (!strcasecmp(v->
name,
"hasexp")) {
6624 }
else if (!strcasecmp(v->
name,
"ringvolume")) {
6625 ringvolume = atoi(v->
value);
6626 }
else if (!strcasecmp(v->
name,
"ringstyle")) {
6627 ringstyle = atoi(v->
value);
6628 }
else if (!strcasecmp(v->
name,
"cwvolume")) {
6629 cwvolume = atoi(v->
value);
6630 }
else if (!strcasecmp(v->
name,
"cwstyle")) {
6631 cwstyle = atoi(v->
value);
6632 }
else if (!strcasecmp(v->
name,
"callhistory")) {
6633 callhistory = atoi(v->
value);
6634 }
else if (!strcasecmp(v->
name,
"sharpdial")) {
6636 }
else if (!strcasecmp(v->
name,
"interdigit_timer")) {
6638 }
else if (!strcasecmp(v->
name,
"dtmf_duration")) {
6643 }
else if (!strcasecmp(v->
name,
"callerid")) {
6644 if (!strcasecmp(v->
value,
"asreceived")) {
6645 lt->cid_num[0] =
'\0';
6649 }
else if (!strcasecmp(v->
name,
"language")) {
6651 }
else if (!strcasecmp(v->
name,
"country")) {
6653 }
else if (!strcasecmp(v->
name,
"accountcode")) {
6655 }
else if (!strcasecmp(v->
name,
"amaflags")) {
6664 }
else if (!strcasecmp(v->
name,
"musiconhold")) {
6666 }
else if (!strcasecmp(v->
name,
"callgroup")) {
6668 }
else if (!strcasecmp(v->
name,
"pickupgroup")) {
6670 }
else if (!strcasecmp(v->
name,
"mailbox")) {
6672 }
else if (!strcasecmp(v->
name,
"parkinglot")) {
6674 }
else if (!strcasecmp(v->
name,
"linelabel")) {
6676 }
else if (!strcasecmp(v->
name,
"extension")) {
6677 if (!strcasecmp(v->
value,
"none")) {
6679 }
else if (!strcasecmp(v->
value,
"ask")) {
6681 }
else if (!strcasecmp(v->
value,
"line")) {
6686 }
else if (!strcasecmp(v->
name,
"bookmark")) {
6687 if (nbsoftkey > 5) {
6689 "More than 6 softkeys defined. Ignoring new entries.\n");
6695 }
else if (!strcasecmp(v->
name,
"line")) {
6696 int len = strlen(linelabel);
6697 int create_line = 0;
6707 memcpy(l, lt,
sizeof(*l));
6714 d->
sline[nbsoftkey] = l;
6719 int softkeylinepos = 0;
6720 if ((len > 2) && (linelabel[1] ==
'@')) {
6721 softkeylinepos = linelabel[0];
6722 if ((softkeylinepos >=
'0') && (softkeylinepos <=
'5')) {
6723 softkeylinepos -=
'0';
6727 "Invalid position for linelabel : must be between 0 and 5\n");
6754 }
else if (!strcasecmp(v->
name,
"height")) {
6787 "tn= and device= can't be used together. Ignoring device= entry\n");
6793 if (strcmp(d->
name,
"template")) {
6801 strcpy(d->
id,
"000000000000");
6814 struct ast_tm tm = { 0, };
6824 }
else if (strlen(tm.
tm_zone) < 9) {
6852 struct sockaddr_in bindaddr = { 0, };
6853 char *
config =
"unistim.conf";
6856 const int reuseFlag = 1;
6866 ast_log(
LOG_ERROR,
"Config file %s is in an invalid format. Aborting.\n", config);
6881 if (!strcasecmp(v->
name,
"keepalive")) {
6883 }
else if (!strcasecmp(v->
name,
"port")) {
6885 }
else if (!strcasecmp(v->
name,
"tos")) {
6889 }
else if (!strcasecmp(v->
name,
"tos_audio")) {
6893 }
else if (!strcasecmp(v->
name,
"cos")) {
6897 }
else if (!strcasecmp(v->
name,
"cos_audio")) {
6901 }
else if (!strcasecmp(v->
name,
"debug")) {
6902 if (!strcasecmp(v->
value,
"no")) {
6904 }
else if (!strcasecmp(v->
value,
"yes")) {
6907 }
else if (!strcasecmp(v->
name,
"autoprovisioning")) {
6908 if (!strcasecmp(v->
value,
"no")) {
6910 }
else if (!strcasecmp(v->
value,
"yes")) {
6912 }
else if (!strcasecmp(v->
value,
"tn")) {
6917 }
else if (!strcasecmp(v->
name,
"public_ip")) {
6957 if (strcasecmp(cat,
"general")) {
6993 bindaddr.sin_addr.s_addr = INADDR_ANY;
6995 bindaddr.sin_family = AF_INET;
7003 const int pktinfoFlag = 1;
7004 setsockopt(
unistimsock, IPPROTO_IP, IP_PKTINFO, &pktinfoFlag,
7005 sizeof(pktinfoFlag));
7010 "Your OS does not support IP_PKTINFO, you must set public_ip.\n");
7015 setsockopt(
unistimsock, SOL_SOCKET, SO_REUSEADDR, (
const char *) &reuseFlag,
7017 if (bind(
unistimsock, (
struct sockaddr *) &bindaddr,
sizeof(bindaddr)) < 0) {
7024 ast_verb(2,
"UNISTIM Listening on %s:%d\n",
ast_inet_ntoa(bindaddr.sin_addr), htons(bindaddr.sin_port));
7042 *instance = sub->
rtp;
7050 struct sockaddr_in them = { 0, };
7051 struct sockaddr_in us = { 0, };
7124 goto chanreg_failed;
int ast_io_wait(struct io_context *ioc, int howlong)
Waits for IO.
static void rcv_mac_addr(struct unistimsession *pte, const unsigned char *buf)
static const unsigned char packet_send_query_basic_manager_10[]
static const char channel_type[]
struct ast_party_caller * ast_channel_caller(struct ast_channel *chan)
static struct lines lines
struct unistim_device::@152 subs
static char musicclass[MAX_MUSICCLASS]
static const unsigned char packet_send_select_output[]
static const unsigned char packet_send_icon[]
struct ast_variable * next
struct ast_channel * owner
#define SELECTEXTENSION_START_ENTRY_POS
char call_forward[AST_MAX_EXTENSION]
int ast_queue_hangup(struct ast_channel *chan)
Queue a hangup frame.
static void send_expansion_text(unsigned char pos, struct unistimsession *pte, const char *text)
unsigned long long ast_group_t
static void handle_select_codec(struct unistimsession *)
static int soft_key_visible(struct unistim_device *d, unsigned char num)
static char * unistim_do_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static char accountcode[AST_MAX_ACCOUNT_CODE]
void ast_channel_pickupgroup_set(struct ast_channel *chan, ast_group_t value)
static int write_history(struct unistimsession *pte, char way, char ismissed)
static const unsigned char packet_send_S1[]
int ast_matchmore_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid)
Looks to see if adding anything to this extension might match something. (exists ^ canmatch) ...
#define ast_channel_lock(chan)
static struct unistimsession * sessions
static char exten[AST_MAX_EXTENSION]
struct unistim_device * sp[FAVNUM]
Main Channel structure associated with a channel.
#define FAV_ICON_SPEAKER_ONHOOK_WHITE
static void show_history(struct unistimsession *pte, char way)
static void send_expansion_next(struct unistimsession *pte)
#define AST_CLI_DEFINE(fn, txt,...)
char * str
Subscriber phone number (Malloced)
static void send_client(int size, const unsigned char *data, struct unistimsession *pte)
struct unistim_line::@151 list
#define AST_LIST_LOCK(head)
Locks a list.
char softkeylabel[FAVNUM][11]
Asterisk main include file. File version handling, generic pbx functions.
#define AST_LIST_FIRST(head)
Returns the first entry contained in a list.
static int unistim_fixup(struct ast_channel *oldchan, struct ast_channel *newchan)
static struct ast_frame * unistim_rtp_read(const struct ast_channel *ast, const struct unistim_subchannel *sub)
enum ast_transfer_result ast_bridge_transfer_attended(struct ast_channel *to_transferee, struct ast_channel *to_transfer_target)
Attended transfer.
#define AST_LIST_HEAD(name, type)
Defines a structure to be used to hold a list of specified type.
struct ast_features_pickup_config * ast_get_chan_features_pickup_config(struct ast_channel *chan)
Get the pickup configuration options for a channel.
static char parkinglot[AST_MAX_CONTEXT]
int ast_queue_control(struct ast_channel *chan, enum ast_control_frame_type control)
Queue a control frame without payload.
static const unsigned char packet_send_stream_based_tone_off[]
static void rcv_resume_connection_with_server(struct unistimsession *pte)
static struct unistim_line * unistim_line_alloc(void)
A device containing one or more lines.
char name[DEVICE_NAME_LEN]
static pthread_t monitor_thread
void ast_rtp_instance_set_channel_id(struct ast_rtp_instance *instance, const char *uniqueid)
Set the channel that owns this RTP instance.
static struct ast_tone_zone * ast_tone_zone_unref(struct ast_tone_zone *tz)
Release a reference to an ast_tone_zone.
static struct unistim_line * unistim_line_destroy(struct unistim_line *l)
static void send_favorite_selected(unsigned char status, struct unistimsession *pte)
static const unsigned char packet_recv_it_type[]
Channels have this property if they can accept input with jitter; i.e. most VoIP channels.
static void send_dial_tone(struct unistimsession *pte)
void ast_rtp_instance_change_source(struct ast_rtp_instance *instance)
Indicate a new source of audio has dropped in and the ssrc should change.
CallerID (and other GR30) management and generation Includes code and algorithms from the Zapata libr...
void ast_channel_set_writeformat(struct ast_channel *chan, struct ast_format *format)
static struct ast_channel * unistim_new(struct unistim_subchannel *sub, int state, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor)
static const unsigned char packet_send_date_time2[]
#define FAV_ICON_ONHOLD_BLACK
struct ast_party_id id
Connected party ID.
char lst_cnm[TEXT_LENGTH_MAX]
struct ast_rtp_instance * rtp
int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len)
Unregister multiple commands.
void * ast_channel_tech_pvt(const struct ast_channel *chan)
#define ast_channel_unref(c)
Decrease channel reference count.
char country[MAX_TONEZONE_COUNTRY]
Country code that this set of tones is for.
struct unistim_device::@153 lines
static void key_select_language(struct unistimsession *pte, char keycode)
#define AST_CAUSE_SWITCH_CONGESTION
struct ast_variable * ast_variable_browse(const struct ast_config *config, const char *category_name)
static int is_key_favorite(struct unistim_device *d, int fav)
struct ast_party_name name
Subscriber name.
static void show_extension_page(struct unistimsession *pte)
void ast_channel_unregister(const struct ast_channel_tech *tech)
Unregister a channel technology.
#define FAV_ICON_HEADPHONES_ONHOLD
static struct unistim_line * find_line_by_number(struct unistim_device *d, const char *val)
static const unsigned char packet_send_s4[]
void ast_channel_hangupcause_set(struct ast_channel *chan, int value)
struct stasis_cache * ast_mwi_state_cache(void)
Backend cache for ast_mwi_topic_cached().
int ast_queue_unhold(struct ast_channel *chan)
Queue an unhold frame.
#define AST_CAUSE_NETWORK_OUT_OF_ORDER
void ast_channel_set_rawwriteformat(struct ast_channel *chan, struct ast_format *format)
static void check_send_queue(struct unistimsession *pte)
static int unistim_hangup_clean(struct ast_channel *ast, struct unistim_subchannel *sub)
struct ao2_container * trans
struct ast_rtp_codecs * ast_rtp_instance_get_codecs(struct ast_rtp_instance *instance)
Get the codecs structure of an RTP instance.
struct wsabuf wsabufsend[MAX_BUF_NUMBER]
static const unsigned char packet_send_Contrast[]
descriptor for a cli entry.
static int send_retransmit(struct unistimsession *pte)
enum ast_pbx_result ast_pbx_start(struct ast_channel *c)
Create a new thread and start the PBX.
unsigned short seq_server
#define AST_LIST_UNLOCK(head)
Attempts to unlock a list.
static struct ast_cli_entry unistim_cli[]
static const unsigned char packet_send_stream_based_tone_single_freq[]
char phone_number[AST_MAX_EXTENSION]
static void sub_hold(struct unistimsession *pte, struct unistim_subchannel *sub)
static void dummy(char *unused,...)
int ast_jb_read_conf(struct ast_jb_conf *conf, const char *varname, const char *value)
Sets jitterbuffer configuration property.
#define CONFIG_STATUS_FILEINVALID
static unsigned char packet_send_monthlabels_download[]
static void in_band_indication(struct ast_channel *ast, const struct ast_tone_zone *tz, const char *indication)
A description of a part of a tone.
static const unsigned char packet_send_stream_based_tone_dual_freq[]
static struct io_context * io
#define AST_CONFIG_MAX_PATH
struct ast_tm * ast_localtime(const struct timeval *timep, struct ast_tm *p_tm, const char *zone)
Timezone-independent version of localtime_r(3).
static void change_favorite_icon(struct unistimsession *pte, unsigned char status)
Structure for variables, used for configurations and for channel variables.
static struct unistim_device * build_device(const char *cat, const struct ast_variable *v)
int ast_rtp_instance_set_qos(struct ast_rtp_instance *instance, int tos, int cos, const char *desc)
Set QoS parameters on an RTP session.
static void put_unaligned_uint16(void *p, unsigned short datum)
static int unregister_extension(const struct unistimsession *pte)
int ast_rtp_instance_write(struct ast_rtp_instance *instance, struct ast_frame *frame)
Send a frame out over RTP.
static void swap_subs(struct unistim_subchannel *a, struct unistim_subchannel *b)
static const unsigned char packet_recv_pick_up[]
#define ast_rtp_glue_register(glue)
static void discard_call(struct unistimsession *pte)
static void send_ping(struct unistimsession *pte)
static void unquote(char *out, const char *src, int maxlen)
static struct unistim_languages options_languages[]
static struct unistim_subchannel * get_sub_holding(struct unistim_device *device, int type, int holding)
Structure to pass both assignedid values to channel drivers.
static void send_select_output(struct unistimsession *pte, unsigned char output, unsigned char volume, unsigned char mute)
static void key_main_page(struct unistimsession *pte, char keycode)
void ast_channel_callgroup_set(struct ast_channel *chan, ast_group_t value)
ast_channel_state
ast_channel states
char * str
Subscriber name (Malloced)
int * ast_io_add(struct io_context *ioc, int fd, ast_io_cb callback, short events, void *data)
Adds an IO context.
static void close_call(struct unistimsession *pte)
static void set_ping_timer(struct unistimsession *pte)
static const struct adsi_event events[]
static void transfer_call_step1(struct unistimsession *pte)
static int find_rtp_port(struct unistim_subchannel *s)
static const unsigned char packet_send_set_pos_cursor[]
#define ast_cli_register_multiple(e, len)
Register multiple commands.
static const unsigned char packet_send_expansion_text[]
static void send_callerid_screen(struct unistimsession *, struct unistim_subchannel *)
static struct ast_threadstorage buf2
char expsoftkeylabel[EXPNUM][11]
unsigned char buf[MAX_BUF_NUMBER][MAX_BUF_SIZE]
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
char softkeynumber[FAVNUM][AST_MAX_EXTENSION]
#define ast_mutex_lock(a)
static void microphone_mute_toggle(struct unistimsession *pte)
static const unsigned char packet_send_expansion_next[]
int ast_channel_register(const struct ast_channel_tech *tech)
Register a channel technology (a new channel driver) Called by a channel module to register the kind ...
static const unsigned char packet_send_charset_iso_8859_5[]
#define ast_str_alloca(init_len)
#define ast_strdup(str)
A wrapper for strdup()
static const unsigned char packet_send_stream_based_tone_on[]
static void close_client(struct unistimsession *s)
static int attempt_transfer(struct unistim_subchannel *p1, struct unistim_subchannel *p2)
int ast_str2tos(const char *value, unsigned int *tos)
Convert a string to the appropriate TOS value.
char * ast_category_browse(struct ast_config *config, const char *prev_name)
Browse categories.
static int unistim_call(struct ast_channel *ast, const char *dest, int timeout)
void ast_playtones_stop(struct ast_channel *chan)
Stop playing tones on a channel.
static const unsigned char packet_send_query_mac_address[]
static const unsigned char packet_send_led_update[]
static void send_date_time3(struct unistimsession *pte)
static const unsigned char packet_send_open_audio_stream_tx[]
static void * unistim_ss(void *data)
void ast_cli(int fd, const char *fmt,...)
void ast_update_use_count(void)
Notify when usecount has been changed.
static const char * ustmtext(const char *str, struct unistimsession *pte)
static void unistim_line_copy(struct unistim_line *dst, struct unistim_line *src)
static const unsigned char packet_send_S7[]
void ast_moh_stop(struct ast_channel *chan)
Turn off music on hold on a given channel.
#define AST_LIST_TRAVERSE_SAFE_END
Closes a safe loop traversal block.
Socket address structure.
const char * ast_channel_call_forward(const struct ast_channel *chan)
static char cid_num[AST_MAX_EXTENSION]
static struct ast_frame * unistim_read(struct ast_channel *ast)
static const unsigned char packet_send_date_time[]
#define ast_verb(level,...)
int ast_rtp_codecs_payload_code_tx(struct ast_rtp_codecs *codecs, int asterisk_format, const struct ast_format *format, int code)
Retrieve a tx mapped payload type based on whether it is an Asterisk format and the code...
static void * do_monitor(void *data)
static ast_mutex_t sessionlock
static const unsigned char packet_send_expansion_icon[]
static int load_module(void)
static const unsigned char packet_send_open_audio_stream_rx3[]
static int unistim_answer(struct ast_channel *ast)
static int unistim_register(struct unistimsession *s)
struct ast_frame_subclass subclass
int ast_context_remove_extension(const char *context, const char *extension, int priority, const char *registrar)
Simply remove extension from context.
unsigned short last_seq_ack
int ast_queue_hangup_with_cause(struct ast_channel *chan, int cause)
Queue a hangup frame with hangupcause set.
#define FAV_ICON_HEADPHONES
int args
This gets set in ast_cli_register()
#define STATUS_LENGTH_MAX
static char * unistim_sp(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
#define ast_strlen_zero(foo)
static char * unistim_reload(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
— unistim_reload: Force reload of module from cli — Runs in the asterisk main thread, so don't do anything useful but setting a flag and waiting for do_monitor to do the job in our thread
static void send_blink_cursor(struct unistimsession *pte)
static struct unistim_subchannel * find_subchannel_by_name(const char *dest)
struct ast_format * ast_channel_readformat(struct ast_channel *chan)
struct unistim_device * device
struct unistimsession * next
void ast_channel_tech_set(struct ast_channel *chan, const struct ast_channel_tech *value)
static void send_icon(unsigned char pos, unsigned char status, struct unistimsession *pte)
static const float dtmf_col[]
#define AST_MAX_ACCOUNT_CODE
enum ama_flags ast_channel_string2amaflag(const char *flag)
Convert a string to a detail record AMA flag.
internal representation of ACL entries In principle user applications would have no need for this...
static int find_language(const char *)
static void send_texttitle(struct unistimsession *pte, const char *text)
struct ast_party_id id
Caller party ID.
static const char tdesc[]
struct unistim_line * next
Configuration File Parser.
static void refresh_all_favorite(struct unistimsession *pte)
static void unistim_set_owner(struct unistim_subchannel *sub, struct ast_channel *chan)
static void send_tone(struct unistimsession *pte, uint16_t tone1, uint16_t tone2)
static void handle_select_language(struct unistimsession *)
static char mailbox[AST_MAX_MAILBOX_UNIQUEID]
static ast_mutex_t devicelock
static void start_rtp(struct unistim_subchannel *sub)
static const unsigned char packet_recv_firm_version[]
#define ast_debug(level,...)
Log a DEBUG message.
Handle unaligned data access.
unsigned long tick_next_ping
void ast_channel_set_rawreadformat(struct ast_channel *chan, struct ast_format *format)
static void send_expansion_icon(unsigned char pos, unsigned char status, struct unistimsession *pte)
static const unsigned char packet_send_jitter_buffer_conf[]
#define FAV_ICON_PHONE_BLACK
void ast_rtp_instance_stop(struct ast_rtp_instance *instance)
Stop an RTP instance.
#define ast_config_load(filename, flags)
Load a config file.
static struct sockaddr_in public_ip
#define VOLUME_LOW_SPEAKER
static const unsigned char packet_send_ring[]
static const unsigned char packet_send_date_time3[]
General Asterisk PBX channel definitions.
void ast_channel_rings_set(struct ast_channel *chan, int value)
static void send_idle_clock(struct unistimsession *pte)
static struct ast_channel * unistim_request(const char *type, struct ast_format_cap *cap, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *dest, int *cause)
Asterisk file paths, configured in asterisk.conf.
void io_context_destroy(struct io_context *ioc)
Destroys a context.
#define ast_sockaddr_from_sin(addr, sin)
Converts a struct sockaddr_in to a struct ast_sockaddr.
int ast_set_read_format(struct ast_channel *chan, struct ast_format *format)
Sets read format on channel chan.
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
static const unsigned char packet_send_stop_timer[]
A set of tones for a given locale.
void ast_channel_nativeformats_set(struct ast_channel *chan, struct ast_format_cap *value)
#define DEFAULTCALLERNAME
static void send_charset_update(struct unistimsession *pte, int charset)
void ast_channel_stage_snapshot_done(struct ast_channel *chan)
Clear flag to indicate channel snapshot is being staged, and publish snapshot.
struct ast_party_connected_line * ast_channel_connected(struct ast_channel *chan)
static const unsigned char packet_send_favorite[]
static int reload_config(void)
#define AST_PTHREADT_NULL
static struct ast_mansession session
static struct unistim_subchannel * unistim_alloc_sub(struct unistim_device *d, int x)
#define AST_CAUSE_ANSWERED_ELSEWHERE
struct unistim_device * next
Access Control of various sorts.
static struct ao2_container * codecs
Registered codecs.
static int unload_module(void)
Global IO variables are now in a struct in order to be made threadsafe.
#define AST_MAX_EXTENSION
static int get_to_address(int fd, struct sockaddr_in *toAddr)
#define AST_CAUSE_NORMAL_CLEARING
struct unistimsession * session
#define AST_LIST_REMOVE_CURRENT(field)
Removes the current entry from a list during a traversal.
static void key_select_extension(struct unistimsession *pte, char keycode)
#define NB_MAX_RETRANSMIT
structure to hold extensions
#define ao2_ref(o, delta)
void ast_channel_set_readformat(struct ast_channel *chan, struct ast_format *format)
static struct ast_jb_conf default_jbconf
Global jitterbuffer configuration - by default, jb is disabled.
#define S_COR(a, b, c)
returns the equivalent of logic or for strings, with an additional boolean check: second one if not e...
char mailbox[AST_MAX_EXTENSION]
void ast_config_destroy(struct ast_config *config)
Destroys a config.
static void show_phone_number(struct unistimsession *pte)
static char * control2str(int ind)
static int unistim_keepalive
#define ast_strdupa(s)
duplicate a string in memory from the stack
static struct ast_tone_zone_sound * ast_tone_zone_sound_unref(struct ast_tone_zone_sound *ts)
Release a reference to an ast_tone_zone_sound.
static const unsigned char packet_send_query_basic_manager_04[]
static int get_avail_softkey(struct unistimsession *pte, const char *name)
static void handle_dial_page(struct unistimsession *pte)
static char language[MAX_LANGUAGE]
static int unistim_sendtext(struct ast_channel *ast, const char *text)
#define ast_malloc(len)
A wrapper for malloc()
int ast_set_write_format(struct ast_channel *chan, struct ast_format *format)
Sets write format on channel chan.
static const unsigned char packet_send_open_audio_stream_tx3[]
static int unistim_free_sub(struct unistim_subchannel *)
ast_group_t ast_get_group(const char *s)
struct ast_tone_zone * tz
static void send_month_labels(struct unistimsession *pte, int month)
static void key_select_option(struct unistimsession *pte, char keycode)
int ast_exists_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid)
Determine whether an extension exists.
static int lang_cmp_fn(void *obj, void *arg, int flags)
static void send_favorite_short(unsigned char pos, unsigned char status, struct unistimsession *pte)
int ast_queue_hold(struct ast_channel *chan, const char *musicclass)
Queue a hold frame.
#define FAV_ICON_SPEAKER_ONHOLD_BLACK
Structure to describe a channel "technology", ie a channel driver See for examples: ...
void ast_channel_adsicpe_set(struct ast_channel *chan, enum ast_channel_adsicpe value)
Core PBX routines and definitions.
int ast_queue_frame(struct ast_channel *chan, struct ast_frame *f)
Queue one or more frames to a channel's frame queue.
enum autoprov_extn extension
char cid_num[AST_MAX_EXTENSION]
char musicclass[MAX_MUSICCLASS]
static struct unistimsession * create_client(const struct sockaddr_in *addr_from)
#define FAV_ICON_SPEAKER_ONHOOK_BLACK
static int unistim_do_senddigit(struct unistimsession *pte, char digit)
static void send_stop_timer(struct unistimsession *pte)
Wrapper for network related headers, masking differences between various operating systems...
static void ignore_call(struct unistimsession *pte)
struct ast_sched_context * ast_sched_context_create(void)
Create a scheduler context.
int ast_channel_fdno(const struct ast_channel *chan)
const char * ast_channel_uniqueid(const struct ast_channel *chan)
static void send_favorite(unsigned char pos, unsigned char status, struct unistimsession *pte, const char *text)
static const unsigned char packet_send_status2[]
struct ast_silence_generator * ast_channel_start_silence_generator(struct ast_channel *chan)
Starts a silence generator on the given channel.
static struct ast_jb_conf global_jbconf
static const char * subtype_tostr(const int type)
void ast_channel_stage_snapshot(struct ast_channel *chan)
Set flag to indicate channel snapshot is being staged.
#define AST_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
#define ao2_container_alloc_hash(ao2_options, container_options, n_buckets, hash_fn, sort_fn, cmp_fn)
static const unsigned char packet_send_charset_iso_2022_jp[]
static void send_text_status(struct unistimsession *pte, const char *text)
int ast_pickup_call(struct ast_channel *chan)
Pickup a call.
int attribute_pure ast_true(const char *val)
Make sure something is true. Determine if a string containing a boolean value is "true". This function checks to see whether a string passed to it is an indication of an "true" value. It checks to see if the string is "yes", "true", "y", "t", "on" or "1".
static const unsigned char packet_send_call[]
#define FAV_ICON_CALL_CENTER
The descriptor of a dynamic string XXX storage will be optimized later if needed We use the ts field ...
static const unsigned char packet_send_no_ring[]
static const unsigned char packet_recv_resume_connection_with_server[]
static const unsigned char packet_recv_hangup[]
#define DEFAULT_INTERDIGIT_TIMER
static void show_main_page(struct unistimsession *pte)
void * stasis_message_data(const struct stasis_message *msg)
Get the data contained in a message.
static const unsigned char packet_recv_pressed_key[]
int ast_set_qos(int sockfd, int tos, int cos, const char *desc)
Set type of service.
struct ast_tone_zone * ast_get_indication_zone(const char *country)
locate ast_tone_zone
#define ast_rtp_instance_set_remote_address(instance, address)
Set the address of the remote endpoint that we are sending RTP to.
static void key_history(struct unistimsession *pte, char keycode)
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
char softkeydevice[FAVNUM][16]
struct ast_tone_zone_sound * ast_get_indication_tone(const struct ast_tone_zone *zone, const char *indication)
Locate a tone zone sound.
#define FAV_ICON_SPEAKER_OFFHOOK_BLACK
static void transfer_cancel_step2(struct unistimsession *pte)
static const char * ptestate_tostr(const int type)
struct unistim_line * sline[FAVNUM]
def ignore(key=None, val=None, section=None, pjsip=None, nmapped=None, type='endpoint')
int ast_moh_start(struct ast_channel *chan, const char *mclass, const char *interpclass)
Turn on music on hold on a given channel.
static const unsigned char packet_send_s9[]
static const unsigned char packet_send_text[]
#define MAX_SCREEN_NUMBER
#define ao2_alloc(data_size, destructor_fn)
static int unistim_set_rtp_peer(struct ast_channel *chan, struct ast_rtp_instance *rtp, struct ast_rtp_instance *vrtp, struct ast_rtp_instance *trtp, const struct ast_format_cap *codecs, int nat_active)
char * ast_trim_blanks(char *str)
Trims trailing whitespace characters from a string.
static void handle_key_fav(struct unistimsession *pte, char keycode)
const char * ast_config_AST_LOG_DIR
struct ast_format_cap * capabilities
int ast_softhangup_nolock(struct ast_channel *chan, int reason)
Softly hangup up a channel (no channel lock)
static int register_extension(const struct unistimsession *pte)
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
#define AST_LIST_ENTRY(type)
Declare a forward link structure inside a list entry.
static const unsigned char packet_send_title[]
static int get_active_softkey(struct unistimsession *pte)
static int lang_hash_fn(const void *obj, const int flags)
static char open_history(struct unistimsession *pte, char way, FILE **f)
#define ast_channel_unlock(chan)
void ast_channel_stop_silence_generator(struct ast_channel *chan, struct ast_silence_generator *state)
Stops a previously-started silence generator on the given channel.
static const int dtmf_row[]
const char * ast_inet_ntoa(struct in_addr ia)
thread-safe replacement for inet_ntoa().
static int unistim_send_mwi_to_peer(struct unistim_line *peer, unsigned int tick)
static void handle_call_outgoing(struct unistimsession *s)
#define ast_calloc(num, len)
A wrapper for calloc()
#define ast_pthread_create(a, b, c, d)
static const unsigned char packet_send_end_call[]
static char * unistim_show_devices(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
#define SELECTEXTENSION_MAX_LENGTH
int ast_str2cos(const char *value, unsigned int *cos)
Convert a string to the appropriate COS value.
void ast_hangup(struct ast_channel *chan)
Hang up a channel.
static const unsigned char packet_send_rtp_packet_size[]
int ast_rtp_instance_fd(struct ast_rtp_instance *instance, int rtcp)
Get the file descriptor for an RTP session (or RTCP)
static const unsigned char packet_recv_expansion_pressed_key[]
static struct unistim_device * devices
struct stasis_message_type * ast_mwi_state_type(void)
Get the Stasis Message Bus API message type for MWI messages.
Module has failed to load, may be in an inconsistent state.
static void send_led_update(struct unistimsession *pte, unsigned char led)
static int parse_bookmark(const char *text, struct unistim_device *d)
#define ao2_find(container, arg, flags)
static int unistim_hangup(struct ast_channel *ast)
char lst_cid[TEXT_LENGTH_MAX]
unsigned int flags
Combination of the AST_JB_ENABLED, AST_JB_FORCED and AST_JB_LOG flags.
int ast_db_get(const char *family, const char *key, char *value, int valuelen)
Get key value specified by family/key.
static const unsigned char packet_send_charset_iso_8859_4[]
void ast_rtp_instance_get_local_address(struct ast_rtp_instance *instance, struct ast_sockaddr *address)
Get the local address that we are expecting RTP on.
Structure used to handle boolean flags.
int ast_rtp_instance_destroy(struct ast_rtp_instance *instance)
Destroy an RTP instance.
static struct unistim_subchannel * get_sub(struct unistim_device *device, int type)
int ast_app_has_voicemail(const char *mailboxes, const char *folder)
Determine if a given mailbox has any voicemail If folder is NULL, defaults to "INBOX". If folder is "INBOX", includes the number of messages in the "Urgent" folder.
static int unistim_reloading
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS|AST_MODFLAG_LOAD_ORDER, "HTTP Phone Provisioning",.support_level=AST_MODULE_SUPPORT_EXTENDED,.load=load_module,.unload=unload_module,.reload=reload,.load_pri=AST_MODPRI_CHANNEL_DEPEND,.requires="http",)
char exten[AST_MAX_EXTENSION]
void ast_jb_configure(struct ast_channel *chan, const struct ast_jb_conf *conf)
Configures a jitterbuffer on a channel.
static void send_text(unsigned char pos, unsigned char inverse, struct unistimsession *pte, const char *text)
static int unistim_unalloc_sub(struct unistim_device *d, struct unistim_subchannel *sub)
static int write_entry_history(struct unistimsession *pte, FILE *f, char c, char *line1)
void ast_channel_exten_set(struct ast_channel *chan, const char *value)
struct ast_format_cap * ast_channel_nativeformats(const struct ast_channel *chan)
struct ast_format_cap * global_cap
static int unistim_write(struct ast_channel *ast, struct ast_frame *frame)
char context[AST_MAX_EXTENSION]
static const unsigned char packet_send_blink_cursor[]
struct ast_frame ast_null_frame
static unsigned char monthlabels[]
static const unsigned char packet_send_start_timer[]
static void parsing(int size, unsigned char *buf, struct unistimsession *pte, struct sockaddr_in *addr_from)
int ast_channel_fd(const struct ast_channel *chan, int which)
static volatile unsigned int seq
static void key_select_codec(struct unistimsession *pte, char keycode)
static const unsigned char packet_send_open_audio_stream_rx[]
struct hostent * ast_gethostbyname(const char *host, struct ast_hostent *hp)
Thread-safe gethostbyname function to use in Asterisk.
static char dateformat[256]
static void key_call(struct unistimsession *pte, char keycode)
char * strsep(char **str, const char *delims)
static void send_no_ring(struct unistimsession *pte)
char accountcode[AST_MAX_ACCOUNT_CODE]
struct unistim_subchannel::@150 list
static void send_cursor_pos(struct unistimsession *pte, unsigned char pos)
#define ast_channel_ref(c)
Increase channel reference count.
static void sub_unhold(struct unistimsession *pte, struct unistim_subchannel *sub)
int ast_add_extension(const char *context, int replace, const char *extension, int priority, const char *label, const char *callerid, const char *application, void *data, void(*datad)(void *), const char *registrar)
Add and extension to an extension context.
Standard Command Line Interface.
int ast_channel_hangupcause(const struct ast_channel *chan)
static void process_request(int size, unsigned char *buf, struct unistimsession *pte)
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
struct unistim_line * parent
static unsigned char * buff
static enum autoprovision autoprovisioning
#define SELECTCODEC_START_ENTRY_POS
const char * ast_channel_name(const struct ast_channel *chan)
static void delete_device(struct unistim_device *d)
static const unsigned char packet_send_charset_iso_8859_1[]
static void send_date_time(struct unistimsession *pte)
int ast_setstate(struct ast_channel *chan, enum ast_channel_state)
Change the state of a channel.
#define AST_PTHREADT_STOP
int ast_rtp_glue_unregister(struct ast_rtp_glue *glue)
Unregister RTP glue.
static const unsigned char packet_send_status[]
enum ast_pbx_result ast_pbx_run(struct ast_channel *c)
Execute the PBX in the current thread.
struct unistim_device * parent
static const unsigned char packet_recv_mac_addr[]
struct stasis_forward * sub
static const unsigned char packet_send_mute[]
Data structure associated with a single frame of data.
Internal Asterisk hangup causes.
struct stasis_message * stasis_cache_get(struct stasis_cache *cache, struct stasis_message_type *type, const char *id)
Retrieve an item from the cache for the ast_eid_default entity.
#define SELECTCODEC_MAX_LENGTH
static void send_start_timer(struct unistimsession *pte)
static void send_mute(struct unistimsession *pte, unsigned char mute)
int ast_playtones_start(struct ast_channel *chan, int vol, const char *tonelist, int interruptible)
Start playing a list of tones on a channel.
static void handle_select_option(struct unistimsession *pte)
static void send_start_rtp(struct unistim_subchannel *)
static void finish_bookmark(void)
static unsigned int get_tick_count(void)
struct ast_ha * ast_append_ha(const char *sense, const char *stuff, struct ast_ha *path, int *error)
Add a new rule to a list of HAs.
char language[MAX_LANGUAGE]
const char * data
Description of a tone.
void ast_rtp_instance_set_prop(struct ast_rtp_instance *instance, enum ast_rtp_property property, int value)
Set the value of an RTP instance property.
static struct ast_sched_context * sched
#define ast_sockaddr_to_sin(addr, sin)
Converts a struct ast_sockaddr to a struct sockaddr_in.
union ast_frame::@263 data
static void show_entry_history(struct unistimsession *pte, FILE **f)
#define AST_LIST_TRAVERSE_SAFE_BEGIN(head, var, field)
Loops safely over (traverses) the entries in a list.
static void key_favorite(struct unistimsession *, char)
enum ast_frame_type frametype
static const unsigned char packet_send_arrow[]
static struct unistim_menu_item options_menu[]
static int unistim_indicate(struct ast_channel *ast, int ind, const void *data, size_t datalen)
#define ast_mutex_init(pmutex)
static void handle_call_incoming(struct unistimsession *s)
unsigned char valid
TRUE if the name information is valid/present.
static char context[AST_MAX_CONTEXT]
static void key_ringing(struct unistimsession *pte, char keycode)
static void key_dial_page(struct unistimsession *pte, char keycode)
#define ast_mutex_destroy(a)
void ast_channel_internal_fd_set(struct ast_channel *chan, int which, int value)
static void display_last_error(const char *sz_msg)
struct ast_format * format
static void change_callerid(struct unistimsession *pte, int type, char *callerid)
struct unistim_subchannel * ssub[FAVNUM]
static const unsigned char packet_rcv_discovery[]
#define LED_HEADPHONE_OFF
static int unistim_senddigit_end(struct ast_channel *ast, char digit, unsigned int duration)
static void init_phone_step2(struct unistimsession *pte)
static int restart_monitor(void)
The structure that contains MWI state.
struct ast_rtp_instance * ast_rtp_instance_new(const char *engine_name, struct ast_sched_context *sched, const struct ast_sockaddr *sa, void *data)
Create a new RTP instance.
struct ast_format_cap * cap
static struct unistimsession * channel_to_session(struct ast_channel *ast)
#define ASTERISK_GPL_KEY
The text the key() function should return.
#define AST_CAUSE_CALL_REJECTED
void ast_channel_priority_set(struct ast_channel *chan, int value)
Pluggable RTP Architecture.
#define ast_channel_alloc(needqueue, state, cid_num, cid_name, acctcode, exten, context, assignedids, requestor, amaflag,...)
Create a channel structure.
Asterisk module definitions.
static int is_key_line(struct unistim_device *d, int fav)
struct ast_format * ast_channel_writeformat(struct ast_channel *chan)
static struct hostent * hp
static void send_end_call(struct unistimsession *pte)
const char * ast_config_AST_VAR_DIR
#define SELECTEXTENSION_MSG
Persistant data storage (akin to *doze registry)
#define ast_rtp_instance_get_remote_address(instance, address)
Get the address of the remote endpoint that we are sending RTP to.
void ast_channel_tech_pvt_set(struct ast_channel *chan, void *value)
static const unsigned char packet_send_discovery_ack[]
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
static void send_date_time2(struct unistimsession *pte)
char extension_number[11]
unsigned char valid
TRUE if the number information is valid/present.
static int unistim_senddigit_begin(struct ast_channel *ast, char digit)
General jitterbuffer configuration.
struct ast_silence_generator * silence_generator
static enum ast_rtp_glue_result unistim_get_rtp_peer(struct ast_channel *chan, struct ast_rtp_instance **instance)
void ast_sched_context_destroy(struct ast_sched_context *c)
destroys a schedule context
static int send_dtmf_tone(struct unistimsession *pte, char digit)
#define AST_CAUSE_CONGESTION
static void send_expansion_short(unsigned char pos, unsigned char status, struct unistimsession *pte)
#define AST_MUTEX_DEFINE_STATIC(mutex)
int ast_tone_zone_part_parse(const char *s, struct ast_tone_zone_part *tone_data)
Parse a tone part.
static void sub_stop_silence(struct unistimsession *pte, struct unistim_subchannel *sub)
static const unsigned char packet_send_charset_iso_8859_2[]
Structure for mutex and tracking information.
static char * unistim_show_info(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static void sub_start_silence(struct unistimsession *pte, struct unistim_subchannel *sub)
char redial_number[AST_MAX_EXTENSION]
static void send_ring(struct unistimsession *pte, signed char volume, signed char style)
#define FAV_ICON_OFFHOOK_BLACK
struct ast_frame * ast_rtp_instance_read(struct ast_rtp_instance *instance, int rtcp)
Receive a frame over RTP.
static int unistimsock_read(int *id, int fd, short events, void *ignore)
static ast_mutex_t unistim_reload_lock
static struct ast_channel_tech unistim_tech
#define ast_mutex_unlock(a)
static ast_mutex_t monlock
static unsigned char packet_send_ping[]
Configuration relating to call pickup.
static force_inline int attribute_pure ast_str_hash(const char *str)
Compute a hash value on a string.
static const unsigned char packet_recv_r2[]
int ast_mkdir(const char *path, int mode)
Recursively create directory path.
int ast_callerid_parse(char *instr, char **name, char **location)
Destructively parse inbuf into name and location (or number)
Channels have this property if they can create jitter; i.e. most VoIP channels.
struct ast_party_number number
Subscriber phone number.
static char ustm_strcopy[1024]
#define ao2_link(container, obj)
static struct ast_rtp_glue unistim_rtp_glue
struct io_context * io_context_create(void)
Creates a context Create a context for I/O operations Basically mallocs an IO structure and sets up s...
static void send_raw_client(int size, const unsigned char *data, struct sockaddr_in *addr_to, const struct sockaddr_in *addr_ourip)