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 
  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 
  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 
  231    .resync_threshold = 1000,
 
 
  241#define DEBUG_TIMER dummy 
  345static const int dtmf_row[] = { 697,  770,  852,  941 };
 
  346static const float dtmf_col[] = { 1209, 1336, 1477, 1633 };
 
  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 };
 
 
  521static 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, 
 
  5440x08, 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,
 
  5530x16, 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 };
 
 
  572static const unsigned char packet_send_CloseAudioStreamRX[] = { 0x16, 0x05, 0x31, 0x00, 0xff };
 
  573static 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,
 
  6100x0e, 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,
 
  6150x0e, 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,
 
  6210x06, 0x81,  0x14, 0x50,
 
  623    0x51,  0x14, 0x50,  0x00, 0x00,  0x0a, 0x93,
 
 
  627    { 0x16, 0x1a, 0x30, 0xff, 0x00, 0x00,  0x00, 0x02, 0x01, 0xb8, 0xb8, 0x06,
 
  6280x06, 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' };
 
 
  645static 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,
 
  6560x20, 0x20, 0x20, 0x20,  0x19,
 
  657    0x05, 0x0f,  0x01,  0x00
 
 
  660    { 0x17, 0x10, 0x19, 0x02,  0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
 
  6610x20, 0x20, 0x20, 0x20   };
 
 
  663    { 0x17, 0x1e, 0x1b, 0x04,  0x00,  0x25,  0x20, 0x20,
 
  6640x20, 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,
 
  6700x20, 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 };
 
 
  699static 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 } 
  706static 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);
 
 
  903static 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))
 
   903static void send_raw_client(
int size, 
const unsigned char *data, 
struct sockaddr_in *addr_to, {
…}
 
  973    memcpy((
void *)data + 
sizeof(
unsigned short), (
void *)&
seq, 
sizeof(
unsigned short));
 
  982        ast_verb(0, 
"Sending data 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]) {
 
 1360    if (
d->softkeynumber[fav][0] == 
'\0') {
 
 
 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++) {
 
 1432            if (
d->sp[i] == pte->
device) {  
 
 1433                if (
d->softkeyicon[i] != 
status) {      
 
 
 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;
 
 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");
 
 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");
 
 
 1927        if (!strcasecmp(s->
macaddr, 
d->id)) {
 
 
 1950    memcpy(dst, src, 
sizeof(*dst)); 
 
 
 1981        ast_debug(1, 
"Released sub %u of channel %s@%s\n", 
sub->subtype, 
sub->parent->name, 
sub->parent->parent->name);
 
 
 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 appear!\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");
 
 
 2612        sub->alreadygone = 1;
 
 2616                ast_verb(0, 
"attempt_transfer failed.\n");
 
 2623            if (sub_transf->
owner) {
 
 2629            ast_verb(0, 
"USTM(%s@%s-%d) channel already destroyed\n", 
sub->parent->name,
 
 
 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",
 
 2741    pte = 
sub->parent->parent->session;
 
 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, };
 
 2863    if (!
sub->parent->parent) {
 
 2867    if (!
sub->parent->parent->session) {
 
 2875    sout = 
sub->parent->parent->session->sout;
 
 2897    sin.sin_family = AF_INET;
 
 2899    memcpy(&sin.sin_addr, &
sub->parent->parent->session->sin.sin_addr,
 
 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);
 
 
 3036    if ((!
a->owner) || (!
b->owner)) {
 
 3038                "Attempted to swap subchannels with a null owner : sub #%p=%p sub #%p=%p\n",
 
 3039                a, 
a->owner, 
b, 
b->owner);
 
 
 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) {
 
 3189    sub->softkey = softkey;
 
 3192        ast_verb(0, 
"Using softkey %d, line %p\n", 
sub->softkey, 
sub->parent);
 
 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++) {
 
 3286        if (
sub->softkey == i) { 
 
 3289        if (
sub->softkey < 0) { 
 
 3296    if (
sub->softkey < 0) {
 
 3304        ast_verb(0, 
"Handle Call Incoming for %s@%s\n", 
sub->parent->name,
 
 
 3337        row = (
digit - 
'1') % 3;
 
 3338        col = (
digit - 
'1' - row) / 3;
 
 3343        } 
else if (
digit == 
'*') {
 
 3345        } 
else if (
digit == 
'0') {
 
 3347        } 
else if (
digit == 
'#') {
 
 
 3362    if (!
sub || !
sub->owner || 
sub->alreadygone) {
 
 
 3392                ast_verb(0, 
"Handle line w/o sub - dialpage\n");
 
 3402                ast_verb(0, 
"Handle favorite w/o sub - dialing\n");
 
 
 3729#define SELECTCODEC_START_ENTRY_POS 15 
 3730#define SELECTCODEC_MAX_LENGTH 2 
 3731#define SELECTCODEC_MSG "Codec number : .." 
 3734    char buf[30], buf2[6];
 
 3740    strcat(
buf, 
" (G711u=0,");
 
 
 3762    if ((keycode >= 
KEY_0) && (keycode <= 
KEY_9)) {
 
 3769        while (i < pte->size_buff_entry) {
 
 
 3821    char tmp_language[40];
 
 
 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],
 
 
 4065    *f = fopen(tmp, 
"r");
 
 4070    if (fread(&count, 1, 1, *f) != 1) {
 
 
 4132            char tmp_field[100];
 
 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);
 
 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);
 
 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",
 
 4769                "%s Warning : we lost a packet : received #0x%04x (we are at #0x%04x)\n",
 
 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]);
 
 
 4811    if (!
sub->parent->parent) {
 
 4816    if (!
sub->parent->parent->session) {
 
 4822    return sub->parent->parent->session;
 
 
 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;
 
 4897            ringstyle = 
session->device->cwstyle;
 
 4898            ringvolume = 
session->device->cwvolume;
 
 4900            ringstyle = (
sub->ringstyle == -1) ? 
session->device->ringstyle : 
sub->ringstyle;
 
 4901            ringvolume = (
sub->ringvolume == -1) ? 
session->device->ringvolume : 
sub->ringvolume;
 
 4906        for (i = 0; i < 
FAVNUM; i++) {
 
 4910            if (
session->device->ssub[i]) {
 
 4915                    ast_verb(0, 
"Found softkey %d for line %s\n", i, 
sub->parent->name);
 
 
 4931    sub->alreadygone = 0;
 
 4934            ast_verb(0, 
"Destroying RTP session\n");
 
 
 4958        ast_debug(1, 
"Asked to hangup channel not connected\n");
 
 4967    if (sub_trans && (sub_trans->owner) && (
sub->subtype == 
SUB_REAL)) { 
 
 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) {
 
 5000                if (
d->ssub[i] != 
NULL) { 
 
 5016    if (
sub->softkey >= 0) {
 
 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",
 
 5362            sub->alreadygone = 1;
 
 5375            sub->alreadygone = 1;
 
 
 5431    at = strchr(line, 
'@');
 
 5441    at = strchr(device, 
'/');       
 
 5446        if (!strcasecmp(
d->
name, device)) {
 
 5454                if (!strcasecmp(l->
name, line)) {
 
 5467                    sub->ringvolume = -1;
 
 5468                    sub->ringstyle = -1;
 
 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);
 
 5486                                sub->ringvolume = ring_volume;
 
 5487                                sub->ringstyle = ring_style;
 
 
 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);
 
 5568                if ((cur < 
'0') && (cur > 
'5')) {
 
 5570                            "sendtext failed : position must be a number between 0 and 5\n");
 
 5584                if ((cur < 
'3') && (cur > 
'6')) {
 
 5586                            "sendtext failed : icon must be a number between 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 between 32 and 63 (second digit invalid)\n");
 
 5598                icon += (cur - 
'0');
 
 5604                            "sendtext failed : icon must be a number between 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",
 
 5760    if ((
sub->rtp) && (
sub->subtype == 0)) {
 
 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",
 
 5985    d = 
sub->parent->parent;
 
 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);
 
 6028        ast_verb(0, 
"unistim_request owner = %p\n", 
sub->owner);
 
 
 6045        e->
command = 
"unistim show info";
 
 6047            "Usage: unistim show info\n" 
 6048            "       Dump internal structures.\n\n" 
 6059    if (
a->argc != e->
args) {
 
 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",
 
 6087                    sub->alreadygone, 
sub->softkey);
 
 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";
 
 6132    if (
a->argc != e->
args)
 
 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) {
 
 6176    len = strlen(
a->argv[4]);
 
 6183        ast_cli(
a->fd, 
"Can't find '%s'\n", tmp);
 
 6186    if (!
sub->parent->parent->session) {
 
 6187        ast_cli(
a->fd, 
"'%s' is not connected\n", tmp);
 
 6190    ast_cli(
a->fd, 
"Sending '%s' to %s (%p)\n", 
a->argv[4], tmp, 
sub->parent->parent->session);
 
 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";
 
 6226    if (
a->argc != e->
args) {
 
 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);
 
 
 6308    if ((
len > 2) && (line[1] == 
'@')) {
 
 6310        if ((p >= 
'0') && (p <= 
'5')) {
 
 6314                    "Invalid position for bookmark : must be between 0 and 5\n");
 
 6317        if (
d->softkeyicon[p] != 0) {
 
 6321        memmove(line, line + 2, 
sizeof(line) - 2);
 
 6324        for (p = 0; p < 
FAVNUM; p++) {
 
 6325            if (!
d->softkeyicon[p]) {
 
 6334    at = strchr(line, 
'@');
 
 6342    at = strchr(at, 
'@');
 
 6352    at = strchr(
number, 
'@');
 
 6363        if (strncmp(icon, 
"USTM/", 5)) {
 
 6364            d->softkeyicon[p] = atoi(icon);
 
 6366            d->softkeyicon[p] = 1;
 
 6373        ast_verb(0, 
"New bookmark at pos %d label='%s' number='%s' icon=%#x\n",
 
 6374                    p, 
d->softkeylabel[p], 
d->softkeynumber[p], (
unsigned)
d->softkeyicon[p]);
 
 
 6386        for (i = 0; i < 6; i++) {
 
 6387            if (
d->softkeyicon[i] == 1) {   
 
 6390                    if (!strcmp(
d->softkeydevice[i], d2->
name)) {
 
 6392                        d->softkeyicon[i] = 0;
 
 6397                if (
d->sp[i] == 
NULL) {
 
 6399                            d->softkeydevice[i]);
 
 
 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",
 
 6472                if (s->
next == 
d->session) {
 
 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)) {
 
 6560        memset(
d->softkeylabel, 0, 
sizeof(
d->softkeylabel));
 
 6561        memset(
d->softkeynumber, 0, 
sizeof(
d->softkeynumber));
 
 6562        memset(
d->softkeyicon, 0, 
sizeof(
d->softkeyicon));
 
 6563        memset(
d->softkeydevice, 0, 
sizeof(
d->softkeydevice));
 
 6564        memset(
d->ssub, 0, 
sizeof(
d->ssub));
 
 6565        memset(
d->sline, 0, 
sizeof(
d->sline));
 
 6566        memset(
d->sp, 0, 
sizeof(
d->sp));
 
 6568    linelabel[0] = 
'\0';
 
 6579    d->dtmfduration = 0;
 
 6581        if (!strcasecmp(v->
name, 
"rtp_port")) {
 
 6582            d->rtp_port = atoi(v->
value);
 
 6583        } 
else if (!strcasecmp(v->
name, 
"rtp_method")) {
 
 6584            d->rtp_method = atoi(v->
value);
 
 6585        } 
else if (!strcasecmp(v->
name, 
"status_method")) {
 
 6586            d->status_method = atoi(v->
value);
 
 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")) {
 
 6612        } 
else if (!strcasecmp(v->
name, 
"timeformat")) {
 
 6613            timeformat = atoi(v->
value);
 
 6614        } 
else if (!strcasecmp(v->
name, 
"contrast")) {
 
 6615            d->contrast = atoi(v->
value);
 
 6616            if ((
d->contrast < 0) || (
d->contrast > 15)) {
 
 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")) {
 
 6637            d->interdigit_timer = atoi(v->
value);
 
 6638        } 
else if (!strcasecmp(v->
name, 
"dtmf_duration")) {
 
 6639            d->dtmfduration = atoi(v->
value);
 
 6640            if (
d->dtmfduration > 150) {
 
 6641                d->dtmfduration = 150;
 
 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");
 
 6730                                    sizeof(
d->softkeylabel[softkeylinepos]));
 
 6734                                    sizeof(
d->softkeylabel[nbsoftkey]));
 
 6754        } 
else if (!strcasecmp(v->
name, 
"height")) {
 
 6757            d->height = atoi(v->
value);
 
 6769    d->ringvolume = ringvolume;
 
 6770    d->ringstyle = ringstyle;
 
 6771    d->cwvolume = cwvolume;
 
 6772    d->cwstyle = cwstyle;
 
 6773    d->callhistory = callhistory;
 
 6774    d->sharp_dial = sharpdial;
 
 6781    d->datetimeformat += timeformat;
 
 6787                    "tn= and device= can't be used together. Ignoring device= entry\n");
 
 6791        d->extension_number[0] = 
'\0';
 
 6793        if (strcmp(
d->
name, 
"template")) {
 
 6801            strcpy(
d->id, 
"000000000000");
 
 6805        d->rtp_port = 10000;
 
 6807    if (
d->contrast == -1) {
 
 6811        strcpy(
d->maintext1, 
d->
name);
 
 6814        struct ast_tm tm = { 0, };
 
 6822                strcpy(
d->titledefault, 
"TimeZone ");
 
 6823                strcat(
d->titledefault, tm.
tm_zone);
 
 6824            } 
else if (strlen(tm.
tm_zone) < 9) {
 
 6825                strcpy(
d->titledefault, 
"TZ ");
 
 6826                strcat(
d->titledefault, tm.
tm_zone);
 
 
 6850    struct sockaddr_in 
bindaddr = { 0, };
 
 6851    char *
config = 
"unistim.conf";
 
 6854    const int reuseFlag = 1;
 
 6879        if (!strcasecmp(v->
name, 
"keepalive")) {
 
 6881        } 
else if (!strcasecmp(v->
name, 
"port")) {
 
 6883        } 
else if (!strcasecmp(v->
name, 
"tos")) {
 
 6887                } 
else if (!strcasecmp(v->
name, 
"tos_audio")) {
 
 6891                } 
else if (!strcasecmp(v->
name, 
"cos")) {
 
 6895                } 
else if (!strcasecmp(v->
name, 
"cos_audio")) {
 
 6899        } 
else if (!strcasecmp(v->
name, 
"debug")) {
 
 6900            if (!strcasecmp(v->
value, 
"no")) {
 
 6902            } 
else if (!strcasecmp(v->
value, 
"yes")) {
 
 6905        } 
else if (!strcasecmp(v->
name, 
"autoprovisioning")) {
 
 6906            if (!strcasecmp(v->
value, 
"no")) {
 
 6908            } 
else if (!strcasecmp(v->
value, 
"yes")) {
 
 6910            } 
else if (!strcasecmp(v->
value, 
"tn")) {
 
 6915        } 
else if (!strcasecmp(v->
name, 
"public_ip")) {
 
 6946        if (
d->to_delete >= 0) {
 
 6955        if (strcasecmp(cat, 
"general")) {
 
 6991    bindaddr.sin_addr.s_addr = INADDR_ANY;
 
 7001        const int pktinfoFlag = 1;
 
 7002        setsockopt(
unistimsock, IPPROTO_IP, IP_PKTINFO, &pktinfoFlag,
 
 7003                   sizeof(pktinfoFlag));
 
 7008                "Your OS does not support IP_PKTINFO, you must set public_ip.\n");
 
 7013    setsockopt(
unistimsock, SOL_SOCKET, SO_REUSEADDR, (
const char *) &reuseFlag,
 
 
 7040    *instance = 
sub->rtp;
 
 
 7048    struct sockaddr_in them = { 0, };
 
 7049    struct sockaddr_in us = { 0, };
 
 
 7122        goto chanreg_failed;
 
 
void ast_jb_configure(struct ast_channel *chan, const struct ast_jb_conf *conf)
Configures a jitterbuffer on a channel.
int ast_jb_read_conf(struct ast_jb_conf *conf, const char *varname, const char *value)
Sets jitterbuffer configuration property.
Access Control of various sorts.
int ast_str2tos(const char *value, unsigned int *tos)
Convert a string to the appropriate TOS value.
int ast_str2cos(const char *value, unsigned int *cos)
Convert a string to the appropriate COS value.
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.
void ast_cli_unregister_multiple(void)
static const struct adsi_event events[]
static volatile unsigned int seq
Persistent data storage (akin to *doze registry)
int ast_db_get(const char *family, const char *key, char *value, int valuelen)
Get key value specified by family/key.
char * strsep(char **str, const char *delims)
Asterisk main include file. File version handling, generic pbx functions.
static struct ast_mansession session
#define ast_strdup(str)
A wrapper for strdup()
#define ast_strdupa(s)
duplicate a string in memory from the stack
#define ast_calloc(num, len)
A wrapper for calloc()
#define ast_malloc(len)
A wrapper for malloc()
#define ao2_link(container, obj)
Add an object to a container.
@ AO2_ALLOC_OPT_LOCK_MUTEX
#define ao2_find(container, arg, flags)
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
#define ao2_alloc(data_size, destructor_fn)
#define ao2_container_alloc_hash(ao2_options, container_options, n_buckets, hash_fn, sort_fn, cmp_fn)
Allocate and initialize a hash container with the desired number of buckets.
@ AST_BRIDGE_TRANSFER_NOT_PERMITTED
@ AST_BRIDGE_TRANSFER_SUCCESS
@ AST_BRIDGE_TRANSFER_INVALID
@ AST_BRIDGE_TRANSFER_FAIL
enum ast_transfer_result ast_bridge_transfer_attended(struct ast_channel *to_transferee, struct ast_channel *to_transfer_target)
Attended transfer.
CallerID (and other GR30) management and generation Includes code and algorithms from the Zapata libr...
int ast_callerid_parse(char *instr, char **name, char **location)
Destructively parse inbuf into name and location (or number)
Internal Asterisk hangup causes.
#define AST_CAUSE_SWITCH_CONGESTION
#define AST_CAUSE_CONGESTION
#define AST_CAUSE_CALL_REJECTED
#define AST_CAUSE_NETWORK_OUT_OF_ORDER
#define AST_CAUSE_ANSWERED_ELSEWHERE
#define AST_CAUSE_NORMAL_CLEARING
struct ast_sockaddr bindaddr
static const char config[]
static char * unistim_show_info(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static struct unistim_subchannel * get_sub_holding(struct unistim_device *device, int type, int holding)
static const unsigned char packet_recv_pressed_key[]
static void key_ringing(struct unistimsession *pte, char keycode)
static ast_mutex_t unistim_reload_lock
static struct unistimsession * sessions
static void transfer_call_step1(struct unistimsession *pte)
static void send_client(int size, const unsigned char *data, struct unistimsession *pte)
static void handle_select_option(struct unistimsession *pte)
static void set_ping_timer(struct unistimsession *pte)
static int get_avail_softkey(struct unistimsession *pte, const char *name)
static const unsigned char packet_send_date_time3[]
static const unsigned char packet_recv_resume_connection_with_server[]
static void init_phone_step2(struct unistimsession *pte)
static void show_history(struct unistimsession *pte, char way)
static void in_band_indication(struct ast_channel *ast, const struct ast_tone_zone *tz, const char *indication)
static const char * subtype_tostr(const int type)
static const unsigned char packet_send_expansion_icon[]
static int unistim_call(struct ast_channel *ast, const char *dest, int timeout)
static void handle_call_incoming(struct unistimsession *s)
static struct ast_channel * unistim_new(struct unistim_subchannel *sub, int state, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor)
static void send_led_update(struct unistimsession *pte, unsigned char led)
static const unsigned char packet_send_discovery_ack[]
static const unsigned char packet_send_expansion_next[]
static struct unistim_line * find_line_by_number(struct unistim_device *d, const char *val)
static void * unistim_ss(void *data)
static void handle_call_outgoing(struct unistimsession *s)
static void sub_stop_silence(struct unistimsession *pte, struct unistim_subchannel *sub)
static void send_ring(struct unistimsession *pte, signed char volume, signed char style)
static const unsigned char packet_send_date_time2[]
static int find_rtp_port(struct unistim_subchannel *s)
static void key_select_language(struct unistimsession *pte, char keycode)
static void handle_select_codec(struct unistimsession *)
static const unsigned char packet_send_s4[]
static void sub_unhold(struct unistimsession *pte, struct unistim_subchannel *sub)
static struct ast_frame * unistim_rtp_read(const struct ast_channel *ast, const struct unistim_subchannel *sub)
static enum autoprovision autoprovisioning
static const unsigned char packet_send_arrow[]
static void unistim_line_copy(struct unistim_line *dst, struct unistim_line *src)
static struct ast_frame * unistim_read(struct ast_channel *ast)
static struct unistim_line * unistim_line_destroy(struct unistim_line *l)
static void key_call(struct unistimsession *pte, char keycode)
static void send_dial_tone(struct unistimsession *pte)
static void send_callerid_screen(struct unistimsession *, struct unistim_subchannel *)
static struct ast_jb_conf default_jbconf
Global jitterbuffer configuration - by default, jb is disabled.
static void check_send_queue(struct unistimsession *pte)
static void key_history(struct unistimsession *pte, char keycode)
static void send_text(unsigned char pos, unsigned char inverse, struct unistimsession *pte, const char *text)
static const unsigned char packet_recv_it_type[]
static const unsigned char packet_send_end_call[]
static struct unistim_line * unistim_line_alloc(void)
static int unistim_keepalive
static void key_select_option(struct unistimsession *pte, char keycode)
static struct ast_sched_context * sched
static struct unistim_device * devices
#define STATUS_LENGTH_MAX
static int register_extension(const struct unistimsession *pte)
static const unsigned char packet_send_start_timer[]
static char * unistim_sp(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static void send_idle_clock(struct unistimsession *pte)
static void sub_hold(struct unistimsession *pte, struct unistim_subchannel *sub)
static const unsigned char packet_send_charset_iso_2022_jp[]
static char * unistim_show_devices(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static const unsigned char packet_send_s9[]
static void handle_select_language(struct unistimsession *)
static void key_select_codec(struct unistimsession *pte, char keycode)
static struct ast_cli_entry unistim_cli[]
#define SELECTEXTENSION_MAX_LENGTH
static void show_entry_history(struct unistimsession *pte, FILE **f)
static int unistim_senddigit_begin(struct ast_channel *ast, char digit)
static char * unistim_do_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static void send_raw_client(int size, const unsigned char *data, struct sockaddr_in *addr_to, const struct sockaddr_in *addr_ourip)
static void send_charset_update(struct unistimsession *pte, int charset)
static void send_blink_cursor(struct unistimsession *pte)
static ast_mutex_t devicelock
static void start_rtp(struct unistim_subchannel *sub)
#define FAV_ICON_SPEAKER_ONHOOK_BLACK
static void delete_device(struct unistim_device *d)
static struct unistimsession * channel_to_session(struct ast_channel *ast)
static void send_mute(struct unistimsession *pte, unsigned char mute)
static const unsigned char packet_send_mute[]
static void send_tone(struct unistimsession *pte, uint16_t tone1, uint16_t tone2)
#define FAV_ICON_SPEAKER_ONHOOK_WHITE
static void send_date_time(struct unistimsession *pte)
static struct unistim_subchannel * find_subchannel_by_name(const char *dest)
static int load_module(void)
static const unsigned char packet_send_S7[]
#define FAV_ICON_SPEAKER_ONHOLD_BLACK
static const char * ptestate_tostr(const int type)
static int is_key_line(struct unistim_device *d, int fav)
static void send_end_call(struct unistimsession *pte)
static int attempt_transfer(struct unistim_subchannel *p1, struct unistim_subchannel *p2)
static struct unistimsession * create_client(const struct sockaddr_in *addr_from)
static unsigned int get_tick_count(void)
static int write_entry_history(struct unistimsession *pte, FILE *f, char c, char *line1)
static char open_history(struct unistimsession *pte, char way, FILE **f)
#define SELECTCODEC_MAX_LENGTH
static void key_main_page(struct unistimsession *pte, char keycode)
static void process_request(int size, unsigned char *buf, struct unistimsession *pte)
static int lang_hash_fn(const void *obj, const int flags)
static void show_extension_page(struct unistimsession *pte)
static void send_expansion_text(unsigned char pos, struct unistimsession *pte, const char *text)
static const unsigned char packet_send_query_basic_manager_04[]
#define FAV_ICON_HEADPHONES
static int unistim_senddigit_end(struct ast_channel *ast, char digit, unsigned int duration)
static struct ast_channel_tech unistim_tech
static void send_favorite_short(unsigned char pos, unsigned char status, struct unistimsession *pte)
static const unsigned char packet_send_expansion_text[]
static void send_date_time2(struct unistimsession *pte)
static const char * ustmtext(const char *str, struct unistimsession *pte)
static void swap_subs(struct unistim_subchannel *a, struct unistim_subchannel *b)
static int unistim_reloading
static const char tdesc[]
static int is_key_favorite(struct unistim_device *d, int fav)
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)
static const unsigned char packet_send_ring[]
static void * do_monitor(void *data)
static int unistim_unalloc_sub(struct unistim_device *d, struct unistim_subchannel *sub)
#define FAV_ICON_OFFHOOK_BLACK
static void show_main_page(struct unistimsession *pte)
static const unsigned char packet_send_call[]
static int unistim_hangup(struct ast_channel *ast)
static int unistim_write(struct ast_channel *ast, struct ast_frame *frame)
static void send_favorite(unsigned char pos, unsigned char status, struct unistimsession *pte, const char *text)
static const unsigned char packet_send_charset_iso_8859_5[]
static void display_last_error(const char *sz_msg)
#define SELECTEXTENSION_START_ENTRY_POS
static void send_ping(struct unistimsession *pte)
static int unistimsock_read(int *id, int fd, short events, void *ignore)
static int write_history(struct unistimsession *pte, char way, char ismissed)
static int restart_monitor(void)
static void send_select_output(struct unistimsession *pte, unsigned char output, unsigned char volume, unsigned char mute)
static const unsigned char packet_send_query_basic_manager_10[]
static char * control2str(int ind)
static int find_language(const char *)
static const unsigned char packet_send_stop_timer[]
#define FAV_ICON_CALL_CENTER
static const unsigned char packet_rcv_discovery[]
#define FAV_ICON_PHONE_BLACK
static const unsigned char packet_recv_hangup[]
static void handle_dial_page(struct unistimsession *pte)
#define SELECTEXTENSION_MSG
#define DEFAULTCALLERNAME
#define AST_CONFIG_MAX_PATH
static void send_favorite_selected(unsigned char status, struct unistimsession *pte)
static const unsigned char packet_send_open_audio_stream_tx[]
static const unsigned char packet_send_charset_iso_8859_4[]
static int lang_cmp_fn(void *obj, void *arg, int flags)
static int get_to_address(int fd, struct sockaddr_in *toAddr)
static int get_active_softkey(struct unistimsession *pte)
static const unsigned char packet_send_stream_based_tone_on[]
static const unsigned char packet_send_charset_iso_8859_2[]
static const unsigned char packet_send_open_audio_stream_tx3[]
static void unistim_set_owner(struct unistim_subchannel *sub, struct ast_channel *chan)
static void handle_key_fav(struct unistimsession *pte, char keycode)
static const unsigned char packet_send_led_update[]
static const unsigned char packet_recv_pick_up[]
static const unsigned char packet_send_set_pos_cursor[]
static int send_retransmit(struct unistimsession *pte)
static unsigned char packet_send_ping[]
static const unsigned char packet_send_text[]
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)
#define FAV_ICON_SPEAKER_OFFHOOK_BLACK
#define VOLUME_LOW_SPEAKER
static const unsigned char packet_send_S1[]
static int send_dtmf_tone(struct unistimsession *pte, char digit)
static int unistim_register(struct unistimsession *s)
static unsigned char packet_send_monthlabels_download[]
static const unsigned char packet_send_rtp_packet_size[]
static void key_select_extension(struct unistimsession *pte, char keycode)
static void close_client(struct unistimsession *s)
static char ustm_strcopy[1024]
static const unsigned char packet_send_jitter_buffer_conf[]
static void finish_bookmark(void)
static struct unistim_languages options_languages[]
static void close_call(struct unistimsession *pte)
static const char channel_type[]
static void send_text_status(struct unistimsession *pte, const char *text)
#define NB_MAX_RETRANSMIT
static int unistim_send_mwi_to_peer(struct unistim_line *peer, unsigned int tick)
static void send_stop_timer(struct unistimsession *pte)
static ast_mutex_t monlock
static void show_phone_number(struct unistimsession *pte)
#define DEFAULT_INTERDIGIT_TIMER
static int reload_config(void)
static void refresh_all_favorite(struct unistimsession *pte)
static void transfer_cancel_step2(struct unistimsession *pte)
static void send_date_time3(struct unistimsession *pte)
static int unistim_sendtext(struct ast_channel *ast, const char *text)
#define FAV_ICON_HEADPHONES_ONHOLD
#define FAV_ICON_ONHOLD_BLACK
static const unsigned char packet_send_title[]
static void send_texttitle(struct unistimsession *pte, const char *text)
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,...
static void send_start_timer(struct unistimsession *pte)
static struct ast_jb_conf global_jbconf
static struct unistim_menu_item options_menu[]
static void dummy(char *unused,...)
static void key_dial_page(struct unistimsession *pte, char keycode)
static void send_expansion_short(unsigned char pos, unsigned char status, struct unistimsession *pte)
static struct io_context * io
static const unsigned char packet_send_favorite[]
static void key_favorite(struct unistimsession *, char)
static void send_start_rtp(struct unistim_subchannel *)
static const unsigned char packet_send_Contrast[]
#define SELECTCODEC_START_ENTRY_POS
static const unsigned char packet_send_blink_cursor[]
static const unsigned char packet_recv_firm_version[]
static const unsigned char packet_send_icon[]
static struct sockaddr_in public_ip
static const unsigned char packet_send_stream_based_tone_dual_freq[]
static void microphone_mute_toggle(struct unistimsession *pte)
static struct unistim_device * build_device(const char *cat, const struct ast_variable *v)
static const unsigned char packet_send_status[]
static void parsing(int size, unsigned char *buf, struct unistimsession *pte, struct sockaddr_in *addr_from)
static void change_callerid(struct unistimsession *pte, int type, char *callerid)
static unsigned char monthlabels[]
static void change_favorite_icon(struct unistimsession *pte, unsigned char status)
static void send_expansion_icon(unsigned char pos, unsigned char status, struct unistimsession *pte)
static int unload_module(void)
static int parse_bookmark(const char *text, struct unistim_device *d)
static const unsigned char packet_send_open_audio_stream_rx3[]
static struct unistim_subchannel * get_sub(struct unistim_device *device, int type)
static const unsigned char packet_send_charset_iso_8859_1[]
#define MAX_SCREEN_NUMBER
static int unistim_fixup(struct ast_channel *oldchan, struct ast_channel *newchan)
static void send_month_labels(struct unistimsession *pte, int month)
static const unsigned char packet_send_status2[]
static void rcv_mac_addr(struct unistimsession *pte, const unsigned char *buf)
static void ignore_call(struct unistimsession *pte)
static const unsigned char packet_send_stream_based_tone_single_freq[]
static struct unistim_subchannel * unistim_alloc_sub(struct unistim_device *d, int x)
static void sub_start_silence(struct unistimsession *pte, struct unistim_subchannel *sub)
static const float dtmf_col[]
static void send_expansion_next(struct unistimsession *pte)
static const unsigned char packet_send_select_output[]
static ast_mutex_t sessionlock
static const unsigned char packet_recv_mac_addr[]
static void rcv_resume_connection_with_server(struct unistimsession *pte)
static void send_cursor_pos(struct unistimsession *pte, unsigned char pos)
static const unsigned char packet_send_open_audio_stream_rx[]
struct ast_format_cap * global_cap
static int unistim_hangup_clean(struct ast_channel *ast, struct unistim_subchannel *sub)
static void discard_call(struct unistimsession *pte)
static int soft_key_visible(struct unistim_device *d, unsigned char num)
static int unistim_indicate(struct ast_channel *ast, int ind, const void *data, size_t datalen)
static int unistim_answer(struct ast_channel *ast)
static const unsigned char packet_recv_r2[]
static const int dtmf_row[]
static void send_no_ring(struct unistimsession *pte)
#define LED_HEADPHONE_OFF
static void send_icon(unsigned char pos, unsigned char status, struct unistimsession *pte)
static const unsigned char packet_send_date_time[]
static int unistim_free_sub(struct unistim_subchannel *)
static void unquote(char *out, const char *src, int maxlen)
static unsigned char * buff
static enum ast_rtp_glue_result unistim_get_rtp_peer(struct ast_channel *chan, struct ast_rtp_instance **instance)
static struct ast_rtp_glue unistim_rtp_glue
static const unsigned char packet_send_stream_based_tone_off[]
static int unregister_extension(const struct unistimsession *pte)
static int unistim_do_senddigit(struct unistimsession *pte, char digit)
static pthread_t monitor_thread
static const unsigned char packet_recv_expansion_pressed_key[]
static const unsigned char packet_send_query_mac_address[]
static const unsigned char packet_send_no_ring[]
General Asterisk PBX channel definitions.
void ast_channel_exten_set(struct ast_channel *chan, const char *value)
const char * ast_channel_name(const struct ast_channel *chan)
void ast_channel_rings_set(struct ast_channel *chan, int value)
void * ast_channel_tech_pvt(const struct ast_channel *chan)
void ast_hangup(struct ast_channel *chan)
Hang up a channel.
#define ast_channel_alloc(needqueue, state, cid_num, cid_name, acctcode, exten, context, assignedids, requestor, amaflag,...)
Create a channel structure.
int ast_queue_hangup(struct ast_channel *chan)
Queue a hangup frame.
void ast_channel_nativeformats_set(struct ast_channel *chan, struct ast_format_cap *value)
int ast_channel_fdno(const struct ast_channel *chan)
#define ast_channel_lock(chan)
struct ast_format_cap * ast_channel_nativeformats(const struct ast_channel *chan)
void ast_channel_unregister(const struct ast_channel_tech *tech)
Unregister a channel technology.
struct ast_silence_generator * ast_channel_start_silence_generator(struct ast_channel *chan)
Starts a silence generator on the given channel.
int ast_queue_control(struct ast_channel *chan, enum ast_control_frame_type control)
Queue a control frame without payload.
unsigned long long ast_group_t
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.
#define ast_channel_ref(c)
Increase channel reference count.
struct ast_party_connected_line * ast_channel_connected(struct ast_channel *chan)
int ast_queue_frame(struct ast_channel *chan, struct ast_frame *f)
Queue one or more frames to a channel's frame queue.
const char * ast_channel_uniqueid(const struct ast_channel *chan)
int ast_channel_fd(const struct ast_channel *chan, int which)
int ast_set_read_format(struct ast_channel *chan, struct ast_format *format)
Sets read format on channel chan.
void ast_channel_internal_fd_set(struct ast_channel *chan, int which, int value)
int ast_queue_hangup_with_cause(struct ast_channel *chan, int cause)
Queue a hangup frame with hangupcause set.
void ast_channel_set_rawreadformat(struct ast_channel *chan, struct ast_format *format)
void ast_channel_tech_pvt_set(struct ast_channel *chan, void *value)
void ast_channel_callgroup_set(struct ast_channel *chan, ast_group_t value)
int ast_channel_hangupcause(const struct ast_channel *chan)
void ast_channel_set_rawwriteformat(struct ast_channel *chan, struct ast_format *format)
#define AST_MAX_ACCOUNT_CODE
int ast_queue_unhold(struct ast_channel *chan)
Queue an unhold frame.
int ast_queue_hold(struct ast_channel *chan, const char *musicclass)
Queue a hold frame.
void ast_channel_set_readformat(struct ast_channel *chan, struct ast_format *format)
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 ...
#define ast_channel_unref(c)
Decrease channel reference count.
struct ast_format * ast_channel_writeformat(struct ast_channel *chan)
int ast_set_write_format(struct ast_channel *chan, struct ast_format *format)
Sets write format on channel chan.
@ AST_CHAN_TP_WANTSJITTER
Channels have this property if they can accept input with jitter; i.e. most VoIP channels.
@ AST_CHAN_TP_CREATESJITTER
Channels have this property if they can create jitter; i.e. most VoIP channels.
int ast_softhangup_nolock(struct ast_channel *chan, int cause)
Softly hangup up a channel (no channel lock)
enum ama_flags ast_channel_string2amaflag(const char *flag)
Convert a string to a detail record AMA flag.
const char * ast_channel_call_forward(const struct ast_channel *chan)
struct ast_party_caller * ast_channel_caller(struct ast_channel *chan)
void ast_channel_priority_set(struct ast_channel *chan, int value)
void ast_channel_hangupcause_set(struct ast_channel *chan, int value)
void ast_channel_pickupgroup_set(struct ast_channel *chan, ast_group_t value)
void ast_channel_adsicpe_set(struct ast_channel *chan, enum ast_channel_adsicpe value)
ast_group_t ast_get_group(const char *s)
void ast_channel_tech_set(struct ast_channel *chan, const struct ast_channel_tech *value)
#define ast_channel_unlock(chan)
#define AST_MAX_EXTENSION
void ast_channel_set_writeformat(struct ast_channel *chan, struct ast_format *format)
struct ast_format * ast_channel_readformat(struct ast_channel *chan)
ast_channel_state
ast_channel states
int ast_setstate(struct ast_channel *chan, enum ast_channel_state)
Change the state of a channel.
Standard Command Line Interface.
#define AST_CLI_DEFINE(fn, txt,...)
void ast_cli(int fd, const char *fmt,...)
#define ast_cli_register_multiple(e, len)
Register multiple commands.
static struct ao2_container * codecs
Registered codecs.
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
void ast_channel_stage_snapshot_done(struct ast_channel *chan)
Clear flag to indicate channel snapshot is being staged, and publish snapshot.
void ast_channel_stage_snapshot(struct ast_channel *chan)
Set flag to indicate channel snapshot is being staged.
Application convenience functions, designed to give consistent look and feel to Asterisk apps.
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"....
Configuration File Parser.
#define ast_config_load(filename, flags)
Load a config file.
char * ast_category_browse(struct ast_config *config, const char *prev_name)
Browse categories.
#define CONFIG_STATUS_FILEINVALID
void ast_config_destroy(struct ast_config *cfg)
Destroys a config.
struct ast_variable * ast_variable_browse(const struct ast_config *config, const char *category_name)
struct ast_features_pickup_config * ast_get_chan_features_pickup_config(struct ast_channel *chan)
Get the pickup configuration options for a channel.
@ AST_CONTROL_RADIO_UNKEY
@ AST_CONTROL_TAKEOFFHOOK
@ AST_CONTROL_CONNECTED_LINE
@ AST_CONTROL_MASQUERADE_NOTIFY
@ AST_CONTROL_PVT_CAUSE_CODE
@ AST_CONTROL_UPDATE_RTP_PEER
struct ast_frame ast_null_frame
#define ast_debug(level,...)
Log a DEBUG message.
#define ast_verb(level,...)
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.
int ast_playtones_start(struct ast_channel *chan, int vol, const char *tonelist, int interruptible)
Start playing a list of tones on a channel.
int ast_tone_zone_part_parse(const char *s, struct ast_tone_zone_part *tone_data)
Parse a tone part.
void ast_playtones_stop(struct ast_channel *chan)
Stop playing tones on a channel.
struct ast_tone_zone_sound * ast_get_indication_tone(const struct ast_tone_zone *zone, const char *indication)
Locate a tone zone sound.
static struct ast_tone_zone * ast_tone_zone_unref(struct ast_tone_zone *tz)
Release a reference to an ast_tone_zone.
struct ast_tone_zone * ast_get_indication_zone(const char *country)
locate ast_tone_zone
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...
int * ast_io_add(struct io_context *ioc, int fd, ast_io_cb callback, short events, void *data)
Adds an IO context.
void io_context_destroy(struct io_context *ioc)
Destroys a context.
int ast_io_wait(struct io_context *ioc, int howlong)
Waits for IO.
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
#define AST_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
#define AST_LIST_ENTRY(type)
Declare a forward link structure inside a list entry.
#define AST_LIST_TRAVERSE_SAFE_END
Closes a safe loop traversal block.
#define AST_LIST_LOCK(head)
Locks a list.
#define AST_LIST_TRAVERSE_SAFE_BEGIN(head, var, field)
Loops safely over (traverses) the entries in a list.
#define AST_LIST_REMOVE_CURRENT(field)
Removes the current entry from a list during a traversal.
#define AST_LIST_UNLOCK(head)
Attempts to unlock a list.
#define AST_LIST_HEAD(name, type)
Defines a structure to be used to hold a list of specified type.
#define AST_LIST_FIRST(head)
Returns the first entry contained in a list.
struct ast_tm * ast_localtime(const struct timeval *timep, struct ast_tm *p_tm, const char *zone)
Timezone-independent version of localtime_r(3).
#define AST_PTHREADT_NULL
#define ast_mutex_init(pmutex)
#define AST_PTHREADT_STOP
#define ast_mutex_unlock(a)
#define ast_mutex_destroy(a)
#define ast_mutex_lock(a)
#define AST_MUTEX_DEFINE_STATIC(mutex)
static char dateformat[256]
Asterisk module definitions.
void ast_update_use_count(void)
Notify when usecount has been changed.
#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)
@ AST_MODULE_SUPPORT_EXTENDED
#define ASTERISK_GPL_KEY
The text the key() function should return.
@ AST_MODULE_LOAD_SUCCESS
@ AST_MODULE_LOAD_DECLINE
Module has failed to load, may be in an inconsistent state.
int ast_moh_start(struct ast_channel *chan, const char *mclass, const char *interpclass)
Turn on music on hold on a given channel.
void ast_moh_stop(struct ast_channel *chan)
Turn off music on hold on a given channel.
struct stasis_message_type * ast_mwi_state_type(void)
Get the Stasis Message Bus API message type for MWI messages.
struct stasis_cache * ast_mwi_state_cache(void)
Backend cache for ast_mwi_topic_cached().
int ast_sockaddr_resolve_first_af(struct ast_sockaddr *addr, const char *name, int flag, int family)
Return the first entry from ast_sockaddr_resolve filtered by address family.
int ast_set_qos(int sockfd, int tos, int cos, const char *desc)
Set type of service.
#define ast_sockaddr_to_sin(addr, sin)
Converts a struct ast_sockaddr to a struct sockaddr_in.
#define ast_sockaddr_from_sin(addr, sin)
Converts a struct sockaddr_in to a struct ast_sockaddr.
Wrapper for network related headers, masking differences between various operating systems....
const char * ast_inet_ntoa(struct in_addr ia)
thread-safe replacement for inet_ntoa().
Asterisk file paths, configured in asterisk.conf.
const char * ast_config_AST_VAR_DIR
const char * ast_config_AST_LOG_DIR
Core PBX routines and definitions.
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.
enum ast_pbx_result ast_pbx_run(struct ast_channel *c)
Execute the PBX in the current thread.
int ast_exists_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid)
Determine whether an extension exists.
int ast_context_remove_extension(const char *context, const char *extension, int priority, const char *registrar)
Simply remove extension from context.
enum ast_pbx_result ast_pbx_start(struct ast_channel *c)
Create a new thread and start the PBX.
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)
int ast_pickup_call(struct ast_channel *chan)
Pickup a call.
static struct stasis_subscription * sub
Statsd channel stats. Exmaple of how to subscribe to Stasis events.
Pluggable RTP Architecture.
int ast_rtp_instance_destroy(struct ast_rtp_instance *instance)
Destroy an RTP instance.
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.
void ast_rtp_instance_stop(struct ast_rtp_instance *instance)
Stop an RTP instance.
@ AST_RTP_GLUE_RESULT_LOCAL
@ AST_RTP_GLUE_RESULT_FORBID
#define ast_rtp_instance_get_remote_address(instance, address)
Get the address of the remote endpoint that we are sending RTP to.
struct ast_frame * ast_rtp_instance_read(struct ast_rtp_instance *instance, int rtcp)
Receive a frame over RTP.
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.
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.
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.
int ast_rtp_instance_write(struct ast_rtp_instance *instance, struct ast_frame *frame)
Send a frame out over RTP.
#define ast_rtp_instance_set_remote_address(instance, address)
Set the address of the remote endpoint that we are sending RTP to.
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.
void ast_rtp_instance_set_channel_id(struct ast_rtp_instance *instance, const char *uniqueid)
Set the channel that owns this RTP instance.
#define ast_rtp_glue_register(glue)
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.
struct ast_rtp_codecs * ast_rtp_instance_get_codecs(struct ast_rtp_instance *instance)
Get the codecs structure of an RTP instance.
int ast_rtp_instance_fd(struct ast_rtp_instance *instance, int rtcp)
Get the file descriptor for an RTP session (or RTCP)
int ast_rtp_glue_unregister(struct ast_rtp_glue *glue)
Unregister RTP glue.
void ast_sched_context_destroy(struct ast_sched_context *c)
destroys a schedule context
struct ast_sched_context * ast_sched_context_create(void)
Create a scheduler context.
void * stasis_message_data(const struct stasis_message *msg)
Get the data contained in a message.
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.
static force_inline int attribute_pure ast_str_hash(const char *str)
Compute a hash value on a string.
int attribute_pure ast_true(const char *val)
Make sure something is true. Determine if a string containing a boolean value is "true"....
#define S_COR(a, b, c)
returns the equivalent of logic or for strings, with an additional boolean check: second one if not e...
static force_inline int attribute_pure ast_strlen_zero(const char *s)
#define ast_str_alloca(init_len)
char * ast_trim_blanks(char *str)
Trims trailing whitespace characters from a string.
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Structure to pass both assignedid values to channel drivers.
Structure to describe a channel "technology", ie a channel driver See for examples:
struct ast_format_cap * capabilities
Main Channel structure associated with a channel.
descriptor for a cli entry.
int args
This gets set in ast_cli_register()
Configuration relating to call pickup.
Structure used to handle boolean flags.
struct ast_format * format
Data structure associated with a single frame of data.
struct ast_frame_subclass subclass
enum ast_frame_type frametype
union ast_frame::@239 data
internal representation of ACL entries In principle user applications would have no need for this,...
General jitterbuffer configuration.
unsigned int flags
Combination of the AST_JB_ENABLED, AST_JB_FORCED and AST_JB_LOG flags.
Structure for mutex and tracking information.
The structure that contains MWI state.
struct ast_party_id id
Caller party ID.
struct ast_party_id id
Connected party ID.
struct ast_party_name name
Subscriber name.
struct ast_party_number number
Subscriber phone number.
unsigned char valid
TRUE if the name information is valid/present.
char * str
Subscriber name (Malloced)
unsigned char valid
TRUE if the number information is valid/present.
char * str
Subscriber phone number (Malloced)
Socket address structure.
Support for dynamic strings.
A description of a part of a tone.
const char * data
Description of a tone.
A set of tones for a given locale.
char country[MAX_TONEZONE_COUNTRY]
Country code that this set of tones is for.
Structure for variables, used for configurations and for channel variables.
struct ast_variable * next
Global IO variables are now in a struct in order to be made threadsafe.
A device containing one or more lines.
char softkeynumber[FAVNUM][AST_MAX_EXTENSION]
char redial_number[AST_MAX_EXTENSION]
struct unistim_device::@141 subs
enum autoprov_extn extension
char softkeylabel[FAVNUM][11]
char expsoftkeylabel[EXPNUM][11]
char context[AST_MAX_EXTENSION]
struct unistim_device::@142 lines
struct unistim_subchannel * ssub[FAVNUM]
struct unistim_device * sp[FAVNUM]
char call_forward[AST_MAX_EXTENSION]
char lst_cid[TEXT_LENGTH_MAX]
struct ast_silence_generator * silence_generator
struct unistim_line * sline[FAVNUM]
char name[DEVICE_NAME_LEN]
char softkeydevice[FAVNUM][16]
struct ast_tone_zone * tz
char extension_number[11]
struct unistimsession * session
struct unistim_device * next
char language[MAX_LANGUAGE]
char lst_cnm[TEXT_LENGTH_MAX]
char phone_number[AST_MAX_EXTENSION]
struct ao2_container * trans
struct unistim_line * next
char cid_num[AST_MAX_EXTENSION]
char parkinglot[AST_MAX_CONTEXT]
char exten[AST_MAX_EXTENSION]
struct ast_format_cap * cap
struct unistim_device * parent
char musicclass[MAX_MUSICCLASS]
char mailbox[AST_MAX_EXTENSION]
struct unistim_line::@140 list
char accountcode[AST_MAX_ACCOUNT_CODE]
struct unistim_line * parent
struct ast_rtp_instance * rtp
struct ast_channel * owner
struct unistim_subchannel::@139 list
unsigned char buf[MAX_BUF_NUMBER][MAX_BUF_SIZE]
struct wsabuf wsabufsend[MAX_BUF_NUMBER]
unsigned short seq_server
unsigned short last_seq_ack
struct unistim_device * device
unsigned long tick_next_ping
struct unistimsession * next
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
Handle unaligned data access.
static void put_unaligned_uint16(void *p, unsigned short datum)
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
#define ast_pthread_create(a, b, c, d)
int ast_mkdir(const char *path, int mode)
Recursively create directory path.