36 #include <sys/socket.h>
37 #include <netinet/in.h>
38 #include <netinet/tcp.h>
39 #include <sys/ioctl.h>
43 #include <arpa/inet.h>
44 #include <sys/signal.h>
134 #ifdef SKINNY_DEVMODE
135 #define SKINNY_DEVONLY(code) \
138 #define SKINNY_DEVONLY(code)
144 static const char tdesc[] =
"Skinny Client Control Protocol (Skinny)";
145 static const char config[] =
"skinny.conf";
160 #define DEFAULT_SKINNY_PORT 2000
161 #define DEFAULT_SKINNY_BACKLOG 2
162 #define SKINNY_MAX_PACKET 1000
163 #define DEFAULT_AUTH_TIMEOUT 30
164 #define DEFAULT_AUTH_LIMIT 50
173 }
qos = { 0, 0, 0, 0, 0, 0 };
185 #if __BYTE_ORDER == __LITTLE_ENDIAN
186 #define letohl(x) (x)
187 #define letohs(x) (x)
188 #define htolel(x) (x)
189 #define htoles(x) (x)
191 #if defined(HAVE_BYTESWAP_H)
192 #include <byteswap.h>
193 #define letohl(x) bswap_32(x)
194 #define letohs(x) bswap_16(x)
195 #define htolel(x) bswap_32(x)
196 #define htoles(x) bswap_16(x)
197 #elif defined(HAVE_SYS_ENDIAN_SWAP16)
198 #include <sys/endian.h>
199 #define letohl(x) __swap32(x)
200 #define letohs(x) __swap16(x)
201 #define htolel(x) __swap32(x)
202 #define htoles(x) __swap16(x)
203 #elif defined(HAVE_SYS_ENDIAN_BSWAP16)
204 #include <sys/endian.h>
205 #define letohl(x) bswap32(x)
206 #define letohs(x) bswap16(x)
207 #define htolel(x) bswap32(x)
208 #define htoles(x) bswap16(x)
210 #define __bswap_16(x) \
211 ((((x) & 0xff00) >> 8) | \
212 (((x) & 0x00ff) << 8))
213 #define __bswap_32(x) \
214 ((((x) & 0xff000000) >> 24) | \
215 (((x) & 0x00ff0000) >> 8) | \
216 (((x) & 0x0000ff00) << 8) | \
217 (((x) & 0x000000ff) << 24))
218 #define letohl(x) __bswap_32(x)
219 #define letohs(x) __bswap_16(x)
220 #define htolel(x) __bswap_32(x)
221 #define htoles(x) __bswap_16(x)
231 .resync_threshold = 1000,
237 #ifdef SKINNY_DEVMODE
239 #define MESSAGE2STR_BUFSIZE 35
243 #define DEVICE2STR_BUFSIZE 15
246 #define CONTROL2STR_BUFSIZE 100
252 #define KEEP_ALIVE_MESSAGE 0x0000
255 #define REGISTER_MESSAGE 0x0001
265 #define IP_PORT_MESSAGE 0x0002
267 #define KEYPAD_BUTTON_MESSAGE 0x0003
275 #define ENBLOC_CALL_MESSAGE 0x0004
280 #define STIMULUS_MESSAGE 0x0005
287 #define OFFHOOK_MESSAGE 0x0006
293 #define ONHOOK_MESSAGE 0x0007
299 #define CAPABILITIES_RES_MESSAGE 0x0010
309 #define SKINNY_MAX_CAPABILITIES 18
316 #define SPEED_DIAL_STAT_REQ_MESSAGE 0x000A
321 #define LINE_STATE_REQ_MESSAGE 0x000B
326 #define TIME_DATE_REQ_MESSAGE 0x000D
327 #define BUTTON_TEMPLATE_REQ_MESSAGE 0x000E
328 #define VERSION_REQ_MESSAGE 0x000F
329 #define SERVER_REQUEST_MESSAGE 0x0012
331 #define ALARM_MESSAGE 0x0020
339 #define OPEN_RECEIVE_CHANNEL_ACK_MESSAGE 0x0022
347 #define SOFT_KEY_SET_REQ_MESSAGE 0x0025
349 #define SOFT_KEY_EVENT_MESSAGE 0x0026
356 #define UNREGISTER_MESSAGE 0x0027
357 #define SOFT_KEY_TEMPLATE_REQ_MESSAGE 0x0028
358 #define HEADSET_STATUS_MESSAGE 0x002B
359 #define REGISTER_AVAILABLE_LINES_MESSAGE 0x002D
361 #define REGISTER_ACK_MESSAGE 0x0081
370 #define START_TONE_MESSAGE 0x0082
378 #define STOP_TONE_MESSAGE 0x0083
384 #define SET_RINGER_MESSAGE 0x0085
392 #define SET_LAMP_MESSAGE 0x0086
399 #define SET_SPEAKER_MESSAGE 0x0088
405 #define SET_MICROPHONE_MESSAGE 0x0089
410 #define START_MEDIA_TRANSMISSION_MESSAGE 0x008A
429 #define STOP_MEDIA_TRANSMISSION_MESSAGE 0x008B
436 #define CALL_INFO_MESSAGE 0x008F
458 #define FORWARD_STAT_MESSAGE 0x0090
470 #define SPEED_DIAL_STAT_RES_MESSAGE 0x0091
477 #define LINE_STAT_RES_MESSAGE 0x0092
485 #define DEFINETIMEDATE_MESSAGE 0x0094
498 #define BUTTON_TEMPLATE_RES_MESSAGE 0x0097
510 #define STIMULUS_REDIAL 0x01
511 #define STIMULUS_SPEEDDIAL 0x02
512 #define STIMULUS_HOLD 0x03
513 #define STIMULUS_TRANSFER 0x04
514 #define STIMULUS_FORWARDALL 0x05
515 #define STIMULUS_FORWARDBUSY 0x06
516 #define STIMULUS_FORWARDNOANSWER 0x07
517 #define STIMULUS_DISPLAY 0x08
518 #define STIMULUS_LINE 0x09
519 #define STIMULUS_VOICEMAIL 0x0F
520 #define STIMULUS_AUTOANSWER 0x11
521 #define STIMULUS_DND 0x3F
522 #define STIMULUS_CONFERENCE 0x7D
523 #define STIMULUS_CALLPARK 0x7E
524 #define STIMULUS_CALLPICKUP 0x7F
525 #define STIMULUS_NONE 0xFF
528 #define BT_REDIAL STIMULUS_REDIAL
529 #define BT_SPEEDDIAL STIMULUS_SPEEDDIAL
530 #define BT_HOLD STIMULUS_HOLD
531 #define BT_TRANSFER STIMULUS_TRANSFER
532 #define BT_FORWARDALL STIMULUS_FORWARDALL
533 #define BT_FORWARDBUSY STIMULUS_FORWARDBUSY
534 #define BT_FORWARDNOANSWER STIMULUS_FORWARDNOANSWER
535 #define BT_DISPLAY STIMULUS_DISPLAY
536 #define BT_LINE STIMULUS_LINE
537 #define BT_VOICEMAIL STIMULUS_VOICEMAIL
538 #define BT_AUTOANSWER STIMULUS_AUTOANSWER
539 #define BT_DND STIMULUS_DND
540 #define BT_CONFERENCE STIMULUS_CONFERENCE
541 #define BT_CALLPARK STIMULUS_CALLPARK
542 #define BT_CALLPICKUP STIMULUS_CALLPICKUP
548 #define BT_CUST_LINESPEEDDIAL 0xB0
549 #define BT_CUST_LINE 0xB1
558 #define VERSION_RES_MESSAGE 0x0098
563 #define DISPLAYTEXT_MESSAGE 0x0099
568 #define CLEAR_NOTIFY_MESSAGE 0x0115
569 #define CLEAR_DISPLAY_MESSAGE 0x009A
571 #define CAPABILITIES_REQ_MESSAGE 0x009B
573 #define REGISTER_REJ_MESSAGE 0x009D
578 #define SERVER_RES_MESSAGE 0x009E
589 #define RESET_MESSAGE 0x009F
594 #define KEEP_ALIVE_ACK_MESSAGE 0x0100
596 #define OPEN_RECEIVE_CHANNEL_MESSAGE 0x0105
607 #define CLOSE_RECEIVE_CHANNEL_MESSAGE 0x0106
614 #define SOFT_KEY_TEMPLATE_RES_MESSAGE 0x0108
621 #define KEYDEF_ONHOOK 0
622 #define KEYDEF_CONNECTED 1
623 #define KEYDEF_ONHOLD 2
624 #define KEYDEF_RINGIN 3
625 #define KEYDEF_OFFHOOK 4
626 #define KEYDEF_CONNWITHTRANS 5
627 #define KEYDEF_DADFD 6
628 #define KEYDEF_CONNWITHCONF 7
629 #define KEYDEF_RINGOUT 8
630 #define KEYDEF_OFFHOOKWITHFEAT 9
631 #define KEYDEF_UNKNOWN 10
633 #define SOFTKEY_NONE 0x00
634 #define SOFTKEY_REDIAL 0x01
635 #define SOFTKEY_NEWCALL 0x02
636 #define SOFTKEY_HOLD 0x03
637 #define SOFTKEY_TRNSFER 0x04
638 #define SOFTKEY_CFWDALL 0x05
639 #define SOFTKEY_CFWDBUSY 0x06
640 #define SOFTKEY_CFWDNOANSWER 0x07
641 #define SOFTKEY_BKSPC 0x08
642 #define SOFTKEY_ENDCALL 0x09
643 #define SOFTKEY_RESUME 0x0A
644 #define SOFTKEY_ANSWER 0x0B
645 #define SOFTKEY_INFO 0x0C
646 #define SOFTKEY_CONFRN 0x0D
647 #define SOFTKEY_PARK 0x0E
648 #define SOFTKEY_JOIN 0x0F
649 #define SOFTKEY_MEETME 0x10
650 #define SOFTKEY_PICKUP 0x11
651 #define SOFTKEY_GPICKUP 0x12
652 #define SOFTKEY_DND 0x13
653 #define SOFTKEY_IDIVERT 0x14
912 #define SOFT_KEY_SET_RES_MESSAGE 0x0109
927 #define SELECT_SOFT_KEYS_MESSAGE 0x0110
935 #define CALL_STATE_MESSAGE 0x0111
943 #define DISPLAY_PROMPT_STATUS_MESSAGE 0x0112
952 #define CLEAR_PROMPT_MESSAGE 0x0113
958 #define DISPLAY_NOTIFY_MESSAGE 0x0114
964 #define ACTIVATE_CALL_PLANE_MESSAGE 0x0116
969 #define DIALED_NUMBER_MESSAGE 0x011D
1048 static struct hostent *
hp;
1053 #define SKINNY_DEVICE_UNKNOWN -1
1054 #define SKINNY_DEVICE_NONE 0
1055 #define SKINNY_DEVICE_30SPPLUS 1
1056 #define SKINNY_DEVICE_12SPPLUS 2
1057 #define SKINNY_DEVICE_12SP 3
1058 #define SKINNY_DEVICE_12 4
1059 #define SKINNY_DEVICE_30VIP 5
1060 #define SKINNY_DEVICE_7910 6
1061 #define SKINNY_DEVICE_7960 7
1062 #define SKINNY_DEVICE_7940 8
1063 #define SKINNY_DEVICE_7935 9
1064 #define SKINNY_DEVICE_ATA186 12
1065 #define SKINNY_DEVICE_7941 115
1066 #define SKINNY_DEVICE_7971 119
1067 #define SKINNY_DEVICE_7914 124
1068 #define SKINNY_DEVICE_7985 302
1069 #define SKINNY_DEVICE_7911 307
1070 #define SKINNY_DEVICE_7961GE 308
1071 #define SKINNY_DEVICE_7941GE 309
1072 #define SKINNY_DEVICE_7931 348
1073 #define SKINNY_DEVICE_7921 365
1074 #define SKINNY_DEVICE_7906 369
1075 #define SKINNY_DEVICE_7962 404
1076 #define SKINNY_DEVICE_7937 431
1077 #define SKINNY_DEVICE_7942 434
1078 #define SKINNY_DEVICE_7945 435
1079 #define SKINNY_DEVICE_7965 436
1080 #define SKINNY_DEVICE_7975 437
1081 #define SKINNY_DEVICE_7905 20000
1082 #define SKINNY_DEVICE_7920 30002
1083 #define SKINNY_DEVICE_7970 30006
1084 #define SKINNY_DEVICE_7912 30007
1085 #define SKINNY_DEVICE_7902 30008
1086 #define SKINNY_DEVICE_CIPC 30016
1087 #define SKINNY_DEVICE_7961 30018
1088 #define SKINNY_DEVICE_7936 30019
1089 #define SKINNY_DEVICE_SCCPGATEWAY_AN 30027
1090 #define SKINNY_DEVICE_SCCPGATEWAY_BRI 30028
1092 #define SKINNY_SPEAKERON 1
1093 #define SKINNY_SPEAKEROFF 2
1095 #define SKINNY_MICON 1
1096 #define SKINNY_MICOFF 2
1098 #define SKINNY_OFFHOOK 1
1099 #define SKINNY_ONHOOK 2
1100 #define SKINNY_RINGOUT 3
1101 #define SKINNY_RINGIN 4
1102 #define SKINNY_CONNECTED 5
1103 #define SKINNY_BUSY 6
1104 #define SKINNY_CONGESTION 7
1105 #define SKINNY_HOLD 8
1106 #define SKINNY_CALLWAIT 9
1107 #define SKINNY_TRANSFER 10
1108 #define SKINNY_PARK 11
1109 #define SKINNY_PROGRESS 12
1110 #define SKINNY_CALLREMOTEMULTILINE 13
1111 #define SKINNY_INVALID 14
1113 #define SKINNY_SILENCE 0x00
1114 #define SKINNY_DIALTONE 0x21
1115 #define SKINNY_BUSYTONE 0x23
1116 #define SKINNY_ALERT 0x24
1117 #define SKINNY_REORDER 0x25
1118 #define SKINNY_CALLWAITTONE 0x2D
1119 #define SKINNY_NOTONE 0x7F
1121 #define SKINNY_LAMP_OFF 1
1122 #define SKINNY_LAMP_ON 2
1123 #define SKINNY_LAMP_WINK 3
1124 #define SKINNY_LAMP_FLASH 4
1125 #define SKINNY_LAMP_BLINK 5
1127 #define SKINNY_RING_OFF 1
1128 #define SKINNY_RING_INSIDE 2
1129 #define SKINNY_RING_OUTSIDE 3
1130 #define SKINNY_RING_FEATURE 4
1132 #define SKINNY_CFWD_ALL (1 << 0)
1133 #define SKINNY_CFWD_BUSY (1 << 1)
1134 #define SKINNY_CFWD_NOANSWER (1 << 2)
1137 #define SKINNY_CX_SENDONLY 0
1138 #define SKINNY_CX_RECVONLY 1
1139 #define SKINNY_CX_SENDRECV 2
1140 #define SKINNY_CX_CONF 3
1141 #define SKINNY_CX_CONFERENCE 3
1142 #define SKINNY_CX_MUTE 4
1143 #define SKINNY_CX_INACTIVE 4
1146 static const char *
const skinny_cxmodes[] = {
1202 #define SKINNY_LINE_OPTIONS \
1205 char accountcode[AST_MAX_ACCOUNT_CODE]; \
1206 char exten[AST_MAX_EXTENSION]; \
1207 char context[AST_MAX_CONTEXT]; \
1208 char language[MAX_LANGUAGE]; \
1209 char cid_num[AST_MAX_EXTENSION]; \
1210 char cid_name[AST_MAX_EXTENSION]; \
1211 char lastcallerid[AST_MAX_EXTENSION]; \
1213 char call_forward_all[AST_MAX_EXTENSION]; \
1214 char call_forward_busy[AST_MAX_EXTENSION]; \
1215 char call_forward_noanswer[AST_MAX_EXTENSION]; \
1216 char mailbox[AST_MAX_EXTENSION]; \
1217 char vmexten[AST_MAX_EXTENSION]; \
1218 char regexten[AST_MAX_EXTENSION]; \
1219 char regcontext[AST_MAX_CONTEXT]; \
1220 char parkinglot[AST_MAX_CONTEXT]; \
1221 char mohinterpret[MAX_MUSICCLASS]; \
1222 char mohsuggest[MAX_MUSICCLASS]; \
1223 char lastnumberdialed[AST_MAX_EXTENSION]; \
1225 ast_group_t callgroup; \
1226 ast_group_t pickupgroup; \
1229 int threewaycalling; \
1231 int cancallforward; \
1242 format_t confcapability; \
1243 struct ast_codec_pref confprefs; \
1244 format_t capability; \
1245 struct ast_codec_pref prefs; \
1246 int nonCodecCapability; \
1312 #define SKINNY_DEVICE_OPTIONS \
1315 char version_id[16]; \
1316 char exten[AST_MAX_EXTENSION]; \
1317 char vmexten[AST_MAX_EXTENSION]; \
1320 int lastlineinstance; \
1321 int lastcallreference; \
1322 format_t confcapability; \
1323 struct ast_codec_pref confprefs; \
1324 format_t capability; \
1337 struct sockaddr_in addr;
1338 struct in_addr ourip;
1368 struct sockaddr_in sin;
1394 .description =
tdesc,
1417 struct skinny_addon *a;
1424 for (i = 0; i < 4; i++)
1431 for (i = 0; i < 4; i++)
1432 (btn++)->buttonDefinition =
BT_NONE;
1433 for (i = 0; i < 13; i++)
1441 for (i = 0; i < 2; i++)
1443 for (i = 0; i < 4; i++)
1445 (btn++)->buttonDefinition =
BT_HOLD;
1453 (btn++)->buttonDefinition =
BT_LINE;
1454 (btn++)->buttonDefinition =
BT_HOLD;
1460 for (i = 0; i < 2; i++)
1469 for (i = 0; i < 6; i++)
1477 for (i = 0; i < 2; i++)
1482 for (i = 0; i < 2; i++)
1483 (btn++)->buttonDefinition =
BT_LINE;
1486 (btn++)->buttonDefinition =
BT_LINE;
1492 for (i = 0; i < 8; i++)
1502 (btn++)->buttonDefinition =
BT_LINE;
1503 (btn++)->buttonDefinition =
BT_HOLD;
1507 for (i = 0; i < 4; i++)
1511 for (i = 0; i < 6; i++)
1527 ast_log(
LOG_WARNING,
"Unsupported device type '%d (7914)' found. Expansion module registered by itself?\n", d->type);
1531 ast_log(
LOG_WARNING,
"Unsupported device type '%d (SCCP gateway)' found.\n", d->type);
1540 if (!strcasecmp(a->
type,
"7914")) {
1541 for (i = 0; i < 14; i++)
1556 if (!(req =
ast_calloc(1, skinny_header_size + size + 4)))
1560 req->
e =
htolel(response_message);
1576 if (l->instance == instance)
1581 ast_log(
LOG_WARNING,
"Could not find line with instance '%d' on device '%s'\n", instance, d->name);
1594 int checkdevice = 0;
1597 at = strchr(line,
'@');
1607 if (checkdevice && tmpl)
1609 else if (!checkdevice) {
1611 }
else if (!strcasecmp(d->name, device)) {
1613 ast_verb(2,
"Found device: %s\n", d->name);
1620 if (!strcasecmp(l->name, line)) {
1622 ast_verb(2,
"Ambiguous line name: %s\n", line);
1642 if ((varval = strchr(varname,
'='))) {
1669 if (sub->
callid == reference)
1674 ast_log(
LOG_WARNING,
"Could not find subchannel with reference '%d' on '%s'\n", reference, d->name);
1687 if (sub->
callid == reference)
1695 ast_log(
LOG_WARNING,
"Could not find any lines that contained a subchannel with reference '%d' on device '%s'\n", reference, d->name);
1698 ast_log(
LOG_WARNING,
"Could not find subchannel with reference '%d' on '%s@%s'\n", reference, l->name, d->name);
1714 ast_log(
LOG_WARNING,
"Could not find speeddial with instance '%d' on device '%s'\n", instance, d->name);
1721 switch (skinnycodec) {
1771 ast_copy_string(l->call_forward_all, cfwd,
sizeof(l->call_forward_all));
1775 ast_copy_string(l->call_forward_busy, cfwd,
sizeof(l->call_forward_busy));
1779 ast_copy_string(l->call_forward_noanswer, cfwd,
sizeof(l->call_forward_noanswer));
1783 l->cfwdtype &= ~SKINNY_CFWD_ALL;
1784 memset(l->call_forward_all, 0,
sizeof(l->call_forward_all));
1787 l->cfwdtype &= ~SKINNY_CFWD_BUSY;
1788 memset(l->call_forward_busy, 0,
sizeof(l->call_forward_busy));
1791 l->cfwdtype &= ~SKINNY_CFWD_NOANSWER;
1792 memset(l->call_forward_noanswer, 0,
sizeof(l->call_forward_noanswer));
1800 char *oldcontext, *newcontext, *stalecontext, *stringp, newlist[
AST_MAX_CONTEXT];
1802 while ((oldcontext =
strsep(&old,
"&"))) {
1803 stalecontext =
'\0';
1806 while ((newcontext =
strsep(&stringp,
"&"))) {
1807 if (strcmp(newcontext, oldcontext) == 0) {
1809 stalecontext =
'\0';
1811 }
else if (strcmp(newcontext, oldcontext)) {
1812 stalecontext = oldcontext;
1831 while ((ext =
strsep(&stringp,
"&"))) {
1832 if ((context = strchr(ext,
'@'))) {
1835 ast_log(
LOG_WARNING,
"Context %s must exist in regcontext= in skinny.conf!\n", context);
1856 while ((ext =
strsep(&stringp,
"&"))) {
1857 if ((context = strchr(ext,
'@'))) {
1860 ast_log(
LOG_WARNING,
"Context %s must exist in regcontext= in skinny.conf!\n", context);
1875 struct sockaddr_in sin;
1894 if (getsockname(s->
fd, (
struct sockaddr *)&sin, &slen)) {
1898 d->
ourip = sin.sin_addr;
1910 manager_event(
EVENT_FLAG_SYSTEM,
"PeerStatus",
"ChannelType: Skinny\r\nPeer: Skinny/%s@%s\r\nPeerStatus: Rejected\r\nCause: LINE_ALREADY_CONNECTED\r\n", l->name, l->
device->name);
1911 ast_verb(1,
"Line %s already connected to %s. Not connecting to %s.\n", l->name, l->
device->name, d->name);
1914 l->capability = l->confcapability & d->capability;
1915 l->prefs = l->confprefs;
1916 if (!l->prefs.order[0]) {
1917 l->prefs = d->confprefs;
1921 l->instance = instance;
1974 #ifdef SKINNY_DEVMODE
1975 static char *message2str(
int type)
1981 return "KEEP_ALIVE_MESSAGE";
1983 return "REGISTER_MESSAGE";
1985 return "IP_PORT_MESSAGE";
1987 return "KEYPAD_BUTTON_MESSAGE";
1989 return "ENBLOC_CALL_MESSAGE";
1991 return "STIMULUS_MESSAGE";
1993 return "OFFHOOK_MESSAGE";
1995 return "ONHOOK_MESSAGE";
1997 return "CAPABILITIES_RES_MESSAGE";
1999 return "SPEED_DIAL_STAT_REQ_MESSAGE";
2001 return "LINE_STATE_REQ_MESSAGE";
2003 return "TIME_DATE_REQ_MESSAGE";
2005 return "BUTTON_TEMPLATE_REQ_MESSAGE";
2007 return "VERSION_REQ_MESSAGE";
2009 return "SERVER_REQUEST_MESSAGE";
2011 return "ALARM_MESSAGE";
2013 return "OPEN_RECEIVE_CHANNEL_ACK_MESSAGE";
2015 return "SOFT_KEY_SET_REQ_MESSAGE";
2017 return "SOFT_KEY_EVENT_MESSAGE";
2019 return "UNREGISTER_MESSAGE";
2021 return "SOFT_KEY_TEMPLATE_REQ_MESSAGE";
2023 return "HEADSET_STATUS_MESSAGE";
2025 return "REGISTER_AVAILABLE_LINES_MESSAGE";
2027 return "REGISTER_ACK_MESSAGE";
2029 return "START_TONE_MESSAGE";
2031 return "STOP_TONE_MESSAGE";
2033 return "SET_RINGER_MESSAGE";
2035 return "SET_LAMP_MESSAGE";
2037 return "SET_SPEAKER_MESSAGE";
2039 return "SET_MICROPHONE_MESSAGE";
2041 return "START_MEDIA_TRANSMISSION_MESSAGE";
2043 return "STOP_MEDIA_TRANSMISSION_MESSAGE";
2045 return "CALL_INFO_MESSAGE";
2047 return "FORWARD_STAT_MESSAGE";
2049 return "SPEED_DIAL_STAT_RES_MESSAGE";
2051 return "LINE_STAT_RES_MESSAGE";
2053 return "DEFINETIMEDATE_MESSAGE";
2055 return "BUTTON_TEMPLATE_RES_MESSAGE";
2057 return "VERSION_RES_MESSAGE";
2059 return "DISPLAYTEXT_MESSAGE";
2061 return "CLEAR_NOTIFY_MESSAGE";
2063 return "CLEAR_DISPLAY_MESSAGE";
2065 return "CAPABILITIES_REQ_MESSAGE";
2067 return "REGISTER_REJ_MESSAGE";
2069 return "SERVER_RES_MESSAGE";
2071 return "RESET_MESSAGE";
2073 return "KEEP_ALIVE_ACK_MESSAGE";
2075 return "OPEN_RECEIVE_CHANNEL_MESSAGE";
2077 return "CLOSE_RECEIVE_CHANNEL_MESSAGE";
2079 return "SOFT_KEY_TEMPLATE_RES_MESSAGE";
2081 return "SOFT_KEY_SET_RES_MESSAGE";
2083 return "SELECT_SOFT_KEYS_MESSAGE";
2085 return "CALL_STATE_MESSAGE";
2087 return "DISPLAY_PROMPT_STATUS_MESSAGE";
2089 return "CLEAR_PROMPT_MESSAGE";
2091 return "DISPLAY_NOTIFY_MESSAGE";
2093 return "ACTIVATE_CALL_PLANE_MESSAGE";
2095 return "DIALED_NUMBER_MESSAGE";
2099 snprintf(tmp, MESSAGE2STR_BUFSIZE,
"UNKNOWN_MESSAGE-%d", type);
2126 memcpy(s->
outbuf, req, skinny_header_size);
2181 ast_verb(1,
"Setting Callinfo to %s(%s) from %s(%s) on %s(%d)\n", fromname, fromnum, toname, tonum, d->name, instance);
2274 ast_verb(1,
"Setting ringer mode to '%d'.\n", mode);
2340 ast_verb(1,
"Displaying notify '%s'\n", text);
2358 ast_verb(1,
"Displaying Prompt Status '%s'\n", text);
2595 for (y = 0; y < softkeymode->
count; y++) {
2597 if (defaults[y] == i+1) {
2601 ast_verbose(
"softKeySetDefinition : softKeyTemplateIndex: %d softKeyInfoIndex: %d\n", i+1, i+301);
2620 soft_key_template_default,
2621 sizeof(soft_key_template_default));
2697 l->cid_name, l->cid_num, l->instance, sub->
callid, 1);
2702 l->instance, sub->
callid, 2);
2710 l->cid_name, l->cid_num, l->instance, sub->
callid, 1);
2725 l->instance, sub->
callid, 2);
2763 ast_verb(3,
"Skinny mwi_event_cb found %d new messages\n", new_msgs);
2779 *instance = sub->
vrtp;
2791 ast_verb(1,
"skinny_get_rtp_peer() Channel = %s\n", c->
name);
2805 *instance = sub->
rtp;
2809 if (!l->directmedia || l->nat){
2812 ast_verb(1,
"skinny_get_rtp_peer() Using AST_RTP_GLUE_RESULT_LOCAL \n");
2827 struct sockaddr_in us = { 0, };
2828 struct sockaddr_in them = { 0, };
2859 if (!(l->directmedia) || (l->nat)){
2862 us.sin_addr.s_addr = us.sin_addr.s_addr ? us.sin_addr.s_addr : d->
ourip.s_addr;
2885 #ifdef SKINNY_DEVMODE
2886 e->
command =
"skinny set debug {off|on|packet}";
2888 "Usage: skinny set debug {off|on|packet}\n"
2889 " Enables/Disables dumping of Skinny packets for debugging purposes\n";
2891 e->
command =
"skinny set debug {off|on}";
2893 "Usage: skinny set debug {off|on}\n"
2894 " Enables/Disables dumping of Skinny packets for debugging purposes\n";
2904 if (!strncasecmp(a->
argv[e->
args - 1],
"on", 2)) {
2906 ast_cli(a->
fd,
"Skinny Debugging Enabled\n");
2908 }
else if (!strncasecmp(a->
argv[e->
args - 1],
"off", 3)) {
2910 ast_cli(a->
fd,
"Skinny Debugging Disabled\n");
2912 #ifdef SKINNY_DEVMODE
2913 }
else if (!strncasecmp(a->
argv[e->
args - 1],
"packet", 6)) {
2915 ast_cli(a->
fd,
"Skinny Debugging Enabled including Packets\n");
2929 "Usage: skinny reload\n"
2930 " Reloads the chan_skinny configuration\n";
2947 char *result = NULL;
2948 int wordlen = strlen(word), which = 0;
2951 if (!strncasecmp(word, d->id, wordlen) && ++which > state)
2972 char *result = NULL;
2973 int wordlen = strlen(word), which = 0;
2980 if (!strncasecmp(word, l->name, wordlen) && ++which > state)
2997 "Usage: skinny reset <DeviceId|DeviceName|all> [restart]\n"
2998 " Causes a Skinny device to reset itself, optionally with a full restart\n";
3009 int fullrestart = 0;
3010 if (!strcasecmp(a->
argv[2], d->id) || !strcasecmp(a->
argv[2], d->name) || !strcasecmp(a->
argv[2],
"all")) {
3017 if (a->
argc == 4 && !strcasecmp(a->
argv[3],
"restart"))
3025 ast_verb(3,
"%s device %s.\n", (fullrestart) ?
"Restarting" :
"Resetting", d->id);
3103 return "IP Communicator";
3109 return "SCCPGATEWAY_AN";
3111 return "SCCPGATEWAY_BRI";
3127 for(x = 0; x < 32 ; x++) {
3145 char idtext[256] =
"";
3146 int total_devices = 0;
3151 snprintf(idtext,
sizeof(idtext),
"ActionID: %s\r\n",
id);
3162 ast_cli(fd,
"Name DeviceId IP Type R NL\n");
3163 ast_cli(fd,
"-------------------- ---------------- --------------- --------------- - --\n");
3174 ast_cli(fd,
"%-20s %-16s %-15s %-15s %c %2d\n",
3179 d->registered?
'Y':
'N',
3183 "Event: DeviceEntry\r\n%s"
3184 "Channeltype: SKINNY\r\n"
3185 "ObjectName: %s\r\n"
3186 "ChannelObjectType: device\r\n"
3190 "Devicestatus: %s\r\n"
3191 "NumberOfLines: %d\r\n",
3197 d->registered?
"registered":
"unregistered",
3204 *total = total_devices;
3214 const char *a[] = {
"skinny",
"show",
"devices"};
3215 char idtext[256] =
"";
3219 snprintf(idtext,
sizeof(idtext),
"ActionID: %s\r\n",
id);
3226 "Event: DevicelistComplete\r\n"
3227 "EventList: Complete\r\n"
3230 "\r\n", total, idtext);
3239 e->
command =
"skinny show devices";
3241 "Usage: skinny show devices\n"
3242 " Lists all devices known to the Skinny subsystem.\n";
3256 struct skinny_addon *sa;
3257 char codec_buf[512];
3265 if (!strcasecmp(argv[3], d->id) || !strcasecmp(argv[3], d->name)) {
3266 int numlines = 0, numaddons = 0, numspeeddials = 0;
3281 ast_cli(fd,
"Name: %s\n", d->name);
3282 ast_cli(fd,
"Id: %s\n", d->id);
3283 ast_cli(fd,
"version: %s\n",
S_OR(d->version_id,
"Unknown"));
3289 ast_cli(fd,
"%s\n", codec_buf);
3292 ast_cli(fd,
"%s\n", codec_buf);
3293 ast_cli(fd,
"Registered: %s\n", (d->registered ?
"Yes" :
"No"));
3294 ast_cli(fd,
"Lines: %d\n", numlines);
3296 ast_cli(fd,
" %s (%s)\n", l->name, l->label);
3301 ast_cli(fd,
"Addons: %d\n", numaddons);
3308 ast_cli(fd,
"Speeddials: %d\n", numspeeddials);
3327 astman_append(s,
"Devicestatus: %s\r\n", (d->registered?
"registered":
"unregistered"));
3336 astman_append(s,
"NumberOfSpeeddials: %d\r\n", numspeeddials);
3372 e->
command =
"skinny show device";
3374 "Usage: skinny show device <DeviceId|DeviceName>\n"
3375 " Lists all deviceinformation of a specific device known to the Skinny subsystem.\n";
3388 int total_lines = 0;
3391 char idtext[256] =
"";
3396 snprintf(idtext,
sizeof(idtext),
"ActionID: %s\r\n",
id);
3411 ast_cli(fd,
"Name Device Name Instance Label \n");
3412 ast_cli(fd,
"-------------------- -------------------- -------- --------------------\n");
3418 ast_cli(fd,
"%-20s %-20s %8d %-20s\n",
3425 ast_cli(fd,
" %s> %s to %s\n",
3426 (sub == l->
activesub?
"Active ":
"Inactive"),
3434 "Event: LineEntry\r\n%s"
3435 "Channeltype: SKINNY\r\n"
3436 "ObjectName: %s\r\n"
3437 "ChannelObjectType: line\r\n"
3451 *total = total_lines;
3462 const char *a[] = {
"skinny",
"show",
"lines"};
3463 char idtext[256] =
"";
3467 snprintf(idtext,
sizeof(idtext),
"ActionID: %s\r\n",
id);
3474 "Event: LinelistComplete\r\n"
3475 "EventList: Complete\r\n"
3478 "\r\n", total, idtext);
3486 e->
command =
"skinny show lines [verbose]";
3488 "Usage: skinny show lines\n"
3489 " Lists all lines known to the Skinny subsystem.\n"
3490 " If 'verbose' is specified, the output includes\n"
3491 " information about subs for each line.\n";
3498 if (strcasecmp(a->
argv[e->
args-1],
"verbose")) {
3501 }
else if (a->
argc != e->
args - 1) {
3513 int x = 0, codec = 0;
3514 char codec_buf[512];
3515 char group_buf[256];
3531 if (argc == 6 && (strcasecmp(argv[5], d->id) && strcasecmp(argv[5], d->name))) {
3535 if (strcasecmp(argv[3], l->name)) {
3539 ast_cli(fd,
"Line: %s\n", l->name);
3540 ast_cli(fd,
"On Device: %s\n", d->name);
3541 ast_cli(fd,
"Line Label: %s\n", l->label);
3542 ast_cli(fd,
"Extension: %s\n",
S_OR(l->exten,
"<not set>"));
3543 ast_cli(fd,
"Context: %s\n", l->context);
3546 ast_cli(fd,
"Language: %s\n",
S_OR(l->language,
"<not set>"));
3547 ast_cli(fd,
"Accountcode: %s\n",
S_OR(l->accountcode,
"<not set>"));
3549 ast_cli(fd,
"CallerId Number: %s\n",
S_OR(l->cid_num,
"<not set>"));
3550 ast_cli(fd,
"CallerId Name: %s\n",
S_OR(l->cid_name,
"<not set>"));
3551 ast_cli(fd,
"Hide CallerId: %s\n", (l->hidecallerid ?
"Yes" :
"No"));
3555 ast_cli(fd,
"VoicemailBox: %s\n",
S_OR(l->mailbox,
"<not set>"));
3556 ast_cli(fd,
"VoicemailNumber: %s\n",
S_OR(l->vmexten,
"<not set>"));
3557 ast_cli(fd,
"MWIblink: %d\n", l->mwiblink);
3558 ast_cli(fd,
"Regextension: %s\n",
S_OR(l->regexten,
"<not set>"));
3559 ast_cli(fd,
"Regcontext: %s\n",
S_OR(l->regcontext,
"<not set>"));
3560 ast_cli(fd,
"MoHInterpret: %s\n",
S_OR(l->mohinterpret,
"<not set>"));
3561 ast_cli(fd,
"MoHSuggest: %s\n",
S_OR(l->mohsuggest,
"<not set>"));
3562 ast_cli(fd,
"Last dialed nr: %s\n",
S_OR(l->lastnumberdialed,
"<no calls made yet>"));
3563 ast_cli(fd,
"Last CallerID: %s\n",
S_OR(l->lastcallerid,
"<not set>"));
3564 ast_cli(fd,
"Transfer enabled: %s\n", (l->transfer ?
"Yes" :
"No"));
3565 ast_cli(fd,
"Callwaiting: %s\n", (l->callwaiting ?
"Yes" :
"No"));
3566 ast_cli(fd,
"3Way Calling: %s\n", (l->threewaycalling ?
"Yes" :
"No"));
3567 ast_cli(fd,
"Can forward: %s\n", (l->cancallforward ?
"Yes" :
"No"));
3568 ast_cli(fd,
"Do Not Disturb: %s\n", (l->dnd ?
"Yes" :
"No"));
3569 ast_cli(fd,
"NAT: %s\n", (l->nat ?
"Yes" :
"No"));
3570 ast_cli(fd,
"immediate: %s\n", (l->immediate ?
"Yes" :
"No"));
3571 ast_cli(fd,
"Group: %d\n", l->group);
3572 ast_cli(fd,
"Parkinglot: %s\n",
S_OR(l->parkinglot,
"<not set>"));
3575 ast_cli(fd,
"%s\n", codec_buf);
3578 ast_cli(fd,
"%s\n", codec_buf);
3579 ast_cli(fd,
"Codec Order: (");
3597 astman_append(s,
"HideCallerId: %s\r\n", (l->hidecallerid ?
"Yes" :
"No"));
3608 astman_append(s,
"LastDialedNr: %s\r\n",
S_OR(l->lastnumberdialed,
"<no calls made yet>"));
3610 astman_append(s,
"Transfer: %s\r\n", (l->transfer ?
"Yes" :
"No"));
3611 astman_append(s,
"Callwaiting: %s\r\n", (l->callwaiting ?
"Yes" :
"No"));
3612 astman_append(s,
"3WayCalling: %s\r\n", (l->threewaycalling ?
"Yes" :
"No"));
3613 astman_append(s,
"CanForward: %s\r\n", (l->cancallforward ?
"Yes" :
"No"));
3614 astman_append(s,
"DoNotDisturb: %s\r\n", (l->dnd ?
"Yes" :
"No"));
3616 astman_append(s,
"immediate: %s\r\n", (l->immediate ?
"Yes" :
"No"));
3623 for(x = 0; x < 32 ; x++) {
3665 e->
command =
"skinny show line";
3667 "Usage: skinny show line <Line> [ on <DeviceID|DeviceName> ]\n"
3668 " List all lineinformation of a specific line known to the Skinny subsystem.\n";
3682 e->
command =
"skinny show settings";
3684 "Usage: skinny show settings\n"
3685 " Lists all global configuration settings of the Skinny subsystem.\n";
3697 ast_cli(a->
fd,
" KeepAlive: %d\n", keep_alive);
3698 ast_cli(a->
fd,
" Date Format: %s\n", date_format);
3699 ast_cli(a->
fd,
" Voice Mail Extension: %s\n",
S_OR(global_vmexten,
"(not set)"));
3700 ast_cli(a->
fd,
" Reg. context: %s\n",
S_OR(regcontext,
"(not set)"));
3752 if (hasvideo && sub->
vrtp && sub->
owner) {
3783 l->hidecallerid ?
"" : l->cid_num,
3784 l->hidecallerid ?
"" : l->cid_name,
3815 int loop_pause = 100;
3822 ast_verb(3,
"Starting simple switch on '%s@%s'\n", l->name, d->name);
3824 len = strlen(d->exten);
3828 while (strlen(d->exten) == len){
3830 timeout -= loop_pause;
3831 if ( (timeout -= loop_pause) <= 0){
3839 len = strlen(d->exten);
3846 if (l->getforward) {
3849 ast_verb(3,
"Setting call forward (%d) to '%s' on channel %s\n",
3850 l->cfwdtype, d->exten, c->
name);
3858 memset(d->exten, 0,
sizeof(d->exten));
3868 ast_copy_string(l->lastnumberdialed, d->exten,
sizeof(l->lastnumberdialed));
3869 memset(d->exten, 0,
sizeof(d->exten));
3878 }
else if (res == 0) {
3879 ast_debug(1,
"Not enough digits (%s) (and no ambiguous match)...\n", d->exten);
3880 memset(d->exten, 0,
sizeof(d->exten));
3895 memset(d->exten, 0,
sizeof(d->exten));
3912 memset(d->exten, 0,
sizeof(d->exten));
3925 if (!d || !d->registered) {
3948 switch (l->hookstate) {
3955 ast_log(
LOG_ERROR,
"Don't know how to deal with hookstate %d\n", l->hookstate);
3965 l->cid_name, l->cid_num, l->instance, sub->
callid, 1);
3982 ast_debug(1,
"Asked to hangup channel not connected\n");
3999 if (d->registered) {
4080 ast_debug(1,
"skinny_answer(%s) on %s@%s-%u with BlindXFER, transferring\n",
4092 ast_verb(1,
"skinny_answer(%s) on %s@%s-%u\n", ast->
name, l->name, d->name, sub->
callid);
4104 l->lastnumberdialed, l->lastnumberdialed, l->instance, sub->
callid, 2);
4185 ast_log(
LOG_WARNING,
"Asked to transmit frame type %s, while native formats is %s (read/write = %s/%s)\n",
4207 if (sub->
owner != oldchan) {
4211 sub->
owner = newchan;
4228 sprintf(tmp,
"%d", digit);
4268 return "Other end has hungup";
4270 return "Local ring";
4272 return "Remote end is ringing";
4274 return "Remote end has answered";
4276 return "Remote end is busy";
4278 return "Make it go off hook";
4280 return "Line is off hook";
4282 return "Congestion (circuits busy)";
4284 return "Flash hook";
4288 return "Set a low-level option";
4292 return "Un-Key Radio";
4294 return "Remote end is making Progress";
4296 return "Remote end is proceeding";
4302 return "Media Source Update";
4304 return "Connected Line";
4306 return "Redirecting";
4308 return "Incomplete";
4335 ast_debug(1,
"Transferee channels (local/remote): %s and %s\n",
4337 ast_debug(1,
"Transferor channels (local/remote): %s and %s\n",
4352 ast_debug(1,
"Transfer Masquerading %s to %s\n",
4369 ast_debug(1,
"Transfer Masquerading %s to %s\n",
4379 ast_log(
LOG_DEBUG,
"Neither %s nor %s are in a bridge, nothing to transfer\n",
4410 ast_debug(1,
"Channel %s set up for Blind Xfer, so Xfer rather than ring device\n", ast->
name);
4427 l->instance, sub->
callid, 2);
4475 l->instance, sub->
callid, 2);
4522 tmp =
ast_channel_alloc(1, state, l->cid_num, l->cid_name, l->accountcode, l->exten, l->context, linkedid, l->amaflags,
"Skinny/%s@%s-%d", l->name, d->name, callnums);
4535 sub->
callid = callnums++;
4536 d->lastlineinstance = l->instance;
4537 d->lastcallreference = sub->
callid;
4558 ast_verb(1,
"skinny_new: tmp->nativeformats=%s fmt=%s\n",
4631 if (!sub || !sub->
owner) {
4641 ast_verb(1,
"Putting on Hold(%d)\n", l->instance);
4644 S_OR(l->mohsuggest, NULL),
4663 if (!sub || !sub->
owner) {
4673 ast_verb(1,
"Taking off Hold(%d)\n", l->instance);
4716 ast_verbose(
"Transfer: No subchannel to transfer\n");
4811 memcpy(s->
outbuf, req, skinny_header_size);
4826 ast_verb(3,
"Device '%s' successfully registered\n", name);
4842 ast_verb(1,
"Requesting capabilities\n");
4872 if (l->cfwdtype & cfwdtype) {
4890 l->getforward = cfwdtype;
4923 }
else if (digit == 15) {
4925 }
else if (digit >= 0 && digit <= 9) {
4943 if (lineInstance && callReference)
4972 ast_verb(1,
"No owner: %s\n", l->name);
4994 ast_verb(1,
"callreference in handle_stimulus_message is '%d'\n", callreference);
5012 ast_verb(1,
"Received Stimulus: Redial(%d/%d)\n", instance, callreference);
5059 ast_verb(1,
"Received Stimulus: SpeedDial(%d/%d)\n", instance, callreference);
5064 if (!sub || !sub->
owner)
5103 ast_verb(1,
"Received Stimulus: Hold(%d/%d)\n", instance, callreference);
5108 ast_verb(1,
"Received Stimulus: Transfer(%d/%d)\n", instance, callreference);
5116 ast_verb(1,
"Received Stimulus: Conference(%d/%d)\n", instance, callreference);
5121 ast_verb(1,
"Received Stimulus: Voicemail(%d/%d)\n", instance, callreference);
5123 if (!sub || !sub->
owner) {
5155 ast_copy_string(l->lastnumberdialed, l->vmexten,
sizeof(l->lastnumberdialed));
5170 ast_verb(1,
"Received Stimulus: Park Call(%d/%d)\n", instance, callreference);
5176 snprintf(message,
sizeof(message),
"Call Parked at: %d", extout);
5191 ast_verb(1,
"Received Stimulus: DND (%d/%d)\n", instance, callreference);
5195 ast_verb(3,
"Disabling DND on %s@%s\n", l->name, d->name);
5200 ast_verb(3,
"Enabling DND on %s@%s\n", l->name, d->name);
5208 ast_verb(1,
"Received Stimulus: Forward All(%d/%d)\n", instance, callreference);
5210 if (!sub || !sub->
owner) {
5225 ast_verb(1,
"Received Stimulus: Forward Busy (%d/%d)\n", instance, callreference);
5227 if (!sub || !sub->
owner) {
5242 ast_verb(1,
"Received Stimulus: Forward No Answer (%d/%d)\n", instance, callreference);
5245 if (!sub || !sub->
owner) {
5262 ast_verb(1,
"Received Stimulus: Display(%d/%d)\n", instance, callreference);
5266 ast_verb(1,
"Received Stimulus: Line(%d/%d)\n", instance, callreference);
5295 if (sub && sub->
owner) {
5321 ast_verb(1,
"RECEIVED UNKNOWN STIMULUS: %d(%d/%d)\n", event, instance, callreference);
5377 if (sub && sub->
onhold) {
5394 if (sub && sub->
owner) {
5432 if (instance && reference) {
5464 if (onlysub || sub->
xferor){
5467 ast_debug(1,
"Skinny %s@%s-%d went on hook\n", l->name, d->name, reference);
5502 l->name, d->name, sub->
callid);
5525 for (i = 0; i < count; i++) {
5531 ast_verb(1,
"Adding codec capability '%" PRId64
" (%d)'\n", acodec, scodec);
5535 d->capability = d->confcapability & codecs;
5539 l->capability = l->confcapability & d->capability;
5554 int lineInstance = 1;
5555 int speeddialInstance = 1;
5556 int buttonCount = 0;
5561 memset(&btn, 0,
sizeof(btn));
5565 for (i=0; i<42; i++) {
5574 if (l->instance == lineInstance) {
5605 if (l->instance == lineInstance) {
5630 speeddialInstance++;
5643 if (l->instance == lineInstance) {
5663 speeddialInstance++;
5673 ast_verb(0,
"Adding button: %d, %d\n", btn[i].buttonDefinition, 0);
5687 ast_verb(1,
"Sending %d template to %s\n",
5700 struct sockaddr_in sin = { 0, };
5701 struct sockaddr_in us = { 0, };
5718 sin.sin_family = AF_INET;
5719 sin.sin_addr.s_addr = addr;
5720 sin.sin_port = htons(port);
5734 us.sin_addr.s_addr = us.sin_addr.s_addr ? us.sin_addr.s_addr : d->
ourip.s_addr;
5822 if (callreference) {
5833 ast_verb(1,
"Received Softkey Event: %d(%d/%d)\n", event, instance, callreference);
5842 ast_verb(1,
"Received Softkey Event: None(%d/%d)\n", instance, callreference);
5846 ast_verb(1,
"Received Softkey Event: Redial(%d/%d)\n", instance, callreference);
5849 ast_log(
LOG_WARNING,
"Attempted redial, but no previously dialed number found. Ignoring button.\n");
5853 if (!sub || !sub->
owner) {
5886 ast_verb(1,
"Received Softkey Event: New Call(%d/%d)\n", instance, callreference);
5924 ast_verb(1,
"Received Softkey Event: Hold(%d/%d)\n", instance, callreference);
5929 ast_verb(1,
"Received Softkey Event: Transfer(%d/%d)\n", instance, callreference);
5938 ast_verb(1,
"Received Softkey Event: DND(%d/%d)\n", instance, callreference);
5942 ast_verb(3,
"Disabling DND on %s@%s\n", l->name, d->name);
5947 ast_verb(3,
"Enabling DND on %s@%s\n", l->name, d->name);
5955 ast_verb(1,
"Received Softkey Event: Forward All(%d/%d)\n", instance, callreference);
5957 if (!sub || !sub->
owner) {
5973 ast_verb(1,
"Received Softkey Event: Forward Busy (%d/%d)\n", instance, callreference);
5975 if (!sub || !sub->
owner) {
5991 ast_verb(1,
"Received Softkey Event: Forward No Answer (%d/%d)\n", instance, callreference);
5994 if (!sub || !sub->
owner) {
6011 ast_verb(1,
"Received Softkey Event: Backspace(%d/%d)\n", instance, callreference);
6015 ast_verb(1,
"Received Softkey Event: End Call(%d/%d)\n", instance, callreference);
6031 if (onlysub || sub->
xferor){
6034 ast_debug(1,
"Skinny %s@%s-%d went on hook\n", l->name, d->name, callreference);
6054 ast_verb(1,
"Skinny %s@%s went on hook\n", l->name, d->name);
6072 l->name, d->name, sub->
callid);
6082 ast_verb(1,
"Received Softkey Event: Resume(%d/%d)\n", instance, callreference);
6097 ast_verb(1,
"Received Softkey Event: Answer(%d/%d)\n", instance, callreference);
6120 ast_verb(1,
"Received Softkey Event: Info(%d/%d)\n", instance, callreference);
6124 ast_verb(1,
"Received Softkey Event: Conference(%d/%d)\n", instance, callreference);
6133 ast_verb(1,
"Received Softkey Event: Park Call(%d/%d)\n", instance, callreference);
6139 snprintf(message,
sizeof(message),
"Call Parked at: %d", extout);
6154 ast_verb(1,
"Received Softkey Event: Join(%d/%d)\n", instance, callreference);
6159 ast_verb(1,
"Received Softkey Event: Meetme(%d/%d)\n", instance, callreference);
6163 ast_verb(1,
"Received Softkey Event: Pickup(%d/%d)\n", instance, callreference);
6167 ast_verb(1,
"Received Softkey Event: Group Pickup(%d/%d)\n", instance, callreference);
6171 ast_verb(1,
"Received unknown Softkey Event: %d(%d/%d)\n", event, instance, callreference);
6193 ast_verb(4,
"Received %s from %s\n", message2str(req->
e), s->
device->name);
6234 }
else if (digit == 15) {
6236 }
else if (digit >= 0 && digit <= 9) {
6250 len = strlen(d->exten);
6251 if (len <
sizeof(d->exten) - 1) {
6252 d->exten[
len] = dgt;
6253 d->exten[len + 1] =
'\0';
6275 ast_verb(1,
"Received CapabilitiesRes\n");
6281 ast_verb(1,
"Received SpeedDialStatRequest\n");
6288 ast_verb(1,
"Received LineStatRequest\n");
6295 ast_verb(1,
"Received Time/Date Request\n");
6301 ast_verb(1,
"Buttontemplate requested\n");
6312 ast_verb(1,
"Received Server Request\n");
6322 ast_verb(1,
"Received Open Receive Channel Ack\n");
6328 ast_verb(1,
"Received SoftKeySetReq\n");
6337 ast_verb(1,
"Received Unregister Request\n");
6343 ast_verb(1,
"Received SoftKey Template Request\n");
6354 ast_verb(1,
"RECEIVED UNKNOWN MESSAGE TYPE: %x\n", (
unsigned)
letohl(req->
e));
6357 if (res >= 0 && req)
6390 int timeout = keep_alive * 1100;
6393 struct pollfd fds[1];
6396 if(time(&now) == -1) {
6401 timeout = (auth_timeout - (now - s->
start)) * 1000;
6405 ast_verb(1,
"Skinny Client failed to authenticate in %d seconds\n", auth_timeout);
6411 fds[0].events = POLLIN;
6417 if (
errno != EINTR) {
6421 }
else if (res == 0) {
6424 ast_verb(1,
"Skinny Client was lost, unregistering\n");
6426 ast_verb(1,
"Skinny Client failed to authenticate in %d seconds\n", auth_timeout);
6433 if (fds[0].revents) {
6436 res = read(s->
fd, s->
inbuf, 4);
6441 ast_verb(1,
"Skinny Client was lost, unregistering\n");
6446 }
else if (res != 4) {
6447 ast_log(
LOG_WARNING,
"Skinny Client sent less data than expected. Expected 4 but got %d.\n", res);
6452 ast_verb(1,
"Skinny Client was lost, unregistering\n");
6459 bufaddr = (
int *)s->
inbuf;
6462 ast_debug(1,
"Skinny Client sent invalid data.\n");
6466 if (dlen+8 >
sizeof(s->
inbuf)) {
6467 dlen =
sizeof(s->
inbuf) - 8;
6471 res = read(s->
fd, s->
inbuf+4, dlen+4);
6476 }
else if (res != (dlen+4)) {
6494 memcpy(req, s->
inbuf, skinny_header_size);
6495 bufaddr = (
int *)(s->
inbuf);
6548 struct sockaddr_in sin;
6555 sinlen =
sizeof(sin);
6556 as = accept(skinnysock, (
struct sockaddr *)&sin, &sinlen);
6568 p = getprotobyname(
"tcp");
6570 if( setsockopt(as, p->p_proto, TCP_NODELAY, (
char *)&arg,
sizeof(arg) ) < 0 ) {
6580 memcpy(&s->
sin, &sin,
sizeof(sin));
6584 if(time(&s->
start) == -1) {
6599 ast_verb(1,
"killing accept thread\n");
6612 pthread_testcancel();
6615 if ((res < 0) || (res > 1000)) {
6637 if (monitor_thread == pthread_self()) {
6644 pthread_kill(monitor_thread, SIGURG);
6691 ast_verb(3,
"skinny_request(%s)\n", tmp);
6700 #define TYPE_GENERAL 1
6701 #define TYPE_DEF_DEVICE 2
6702 #define TYPE_DEF_LINE 4
6703 #define TYPE_DEVICE 8
6704 #define TYPE_LINE 16
6706 #define CLINE_OPTS ((struct skinny_line_options *)item)
6707 #define CLINE ((struct skinny_line *)item)
6708 #define CDEV_OPTS ((struct skinny_device_options *)item)
6709 #define CDEV ((struct skinny_device *)item)
6714 int lineInstance = 1;
6715 int speeddialInstance = 1;
6724 char *stringp, *
context, *oldregcontext;
6729 if (!strcasecmp(v->
name,
"bindaddr")) {
6736 }
else if (!strcasecmp(v->
name,
"keepalive")) {
6737 keep_alive = atoi(v->
value);
6739 }
else if (!strcasecmp(v->
name,
"authtimeout")) {
6740 int timeout = atoi(v->
value);
6746 auth_timeout = timeout;
6749 }
else if (!strcasecmp(v->
name,
"authlimit")) {
6750 int limit = atoi(v->
value);
6759 }
else if (!strcasecmp(v->
name,
"regcontext")) {
6761 stringp = newcontexts;
6764 oldregcontext = oldcontexts;
6768 while ((context =
strsep(&stringp,
"&"))) {
6774 }
else if (!strcasecmp(v->
name,
"dateformat")) {
6775 memcpy(date_format, v->
value,
sizeof(date_format));
6777 }
else if (!strcasecmp(v->
name,
"tos")) {
6781 }
else if (!strcasecmp(v->
name,
"tos_audio")) {
6785 }
else if (!strcasecmp(v->
name,
"tos_video")) {
6789 }
else if (!strcasecmp(v->
name,
"cos")) {
6793 }
else if (!strcasecmp(v->
name,
"cos_audio")) {
6797 }
else if (!strcasecmp(v->
name,
"cos_video")) {
6801 }
else if (!strcasecmp(v->
name,
"bindport")) {
6802 if (sscanf(v->
value,
"%5d", &ourport) == 1) {
6803 bindaddr.sin_port = htons(ourport);
6808 }
else if (!strcasecmp(v->
name,
"allow")) {
6811 }
else if (!strcasecmp(v->
name,
"disallow")) {
6817 if (!strcasecmp(v->
name,
"transfer")) {
6825 }
else if (!strcasecmp(v->
name,
"callwaiting")) {
6833 }
else if (!strcasecmp(v->
name,
"directmedia") || !strcasecmp(v->
name,
"canreinvite")) {
6838 }
else if (!strcasecmp(v->
name,
"nat")) {
6843 }
else if (!strcasecmp(v->
name,
"context")) {
6848 }
else if (!strcasecmp(v->
name,
"vmexten")) {
6856 }
else if (!strcasecmp(v->
name,
"mwiblink")) {
6864 }
else if (!strcasecmp(v->
name,
"linelabel")) {
6869 }
else if (!strcasecmp(v->
name,
"callerid")) {
6871 if (!strcasecmp(v->
value,
"asreceived")) {
6879 }
else if (!strcasecmp(v->
name,
"amaflags")) {
6882 if (tempamaflags < 0) {
6889 }
else if (!strcasecmp(v->
name,
"regexten")) {
6894 }
else if (!strcasecmp(v->
name,
"language")) {
6899 }
else if (!strcasecmp(v->
name,
"accountcode")) {
6904 }
else if (!strcasecmp(v->
name,
"mohinterpret") || !strcasecmp(v->
name,
"musiconhold")) {
6909 }
else if (!strcasecmp(v->
name,
"mohsuggest")) {
6914 }
else if (!strcasecmp(v->
name,
"callgroup")) {
6919 }
else if (!strcasecmp(v->
name,
"pickupgroup")) {
6924 }
else if (!strcasecmp(v->
name,
"immediate")) {
6929 }
else if (!strcasecmp(v->
name,
"cancallforward")) {
6934 }
else if (!strcasecmp(v->
name,
"mailbox")) {
6939 }
else if ( !strcasecmp(v->
name,
"parkinglot")) {
6944 }
else if (!strcasecmp(v->
name,
"hasvoicemail")) {
6951 }
else if (!strcasecmp(v->
name,
"callreturn")) {
6956 }
else if (!strcasecmp(v->
name,
"threewaycalling")) {
6961 }
else if (!strcasecmp(v->
name,
"setvar")) {
6966 }
else if (!strcasecmp(v->
name,
"earlyrtp")) {
6971 }
else if (!strcasecmp(v->
name,
"host")) {
6975 CDEV_addr_tmp.
ss.ss_family = AF_INET;
6983 }
else if (!strcasecmp(v->
name,
"port")) {
6985 CDEV->addr.sin_port = htons(atoi(v->
value));
6988 }
else if (!strcasecmp(v->
name,
"device")) {
6993 }
else if (!strcasecmp(v->
name,
"permit") || !strcasecmp(v->
name,
"deny")) {
6998 }
else if (!strcasecmp(v->
name,
"allow")) {
7007 }
else if (!strcasecmp(v->
name,
"disallow")) {
7016 }
else if (!strcasecmp(v->
name,
"version")) {
7021 }
else if (!strcasecmp(v->
name,
"line")) {
7025 if (!strcasecmp(v->
value, l->name) && !l->prune) {
7033 if (l2 == l && strcasecmp(d->id,
CDEV->id)) {
7034 ast_log(
LOG_WARNING,
"Line %s already used by %s. Not connecting to %s.\n", l->name, d->name,
CDEV->name);
7041 CDEV->activeline = l;
7051 }
else if (!strcasecmp(v->
name,
"speeddial")) {
7061 exten =
strsep(&stringp,
",");
7062 if ((context = strchr(exten,
'@'))) {
7074 sd->
instance = speeddialInstance++;
7083 }
else if (!strcasecmp(v->
name,
"addon")) {
7085 struct skinny_addon *a;
7116 if (!strcasecmp(lname, temp->name) && temp->prune) {
7123 ast_verb(1,
"Unable to allocate memory for line %s.\n", lname);
7139 char *cfg_mailbox, *cfg_context;
7140 cfg_context = cfg_mailbox =
ast_strdupa(l->mailbox);
7141 ast_verb(3,
"Setting mailbox '%s' on line %s\n", cfg_mailbox, l->name);
7142 strsep(&cfg_context,
"@");
7144 cfg_context =
"default";
7158 ast_verb(3,
"%s config for line '%s'\n", update ?
"Updated" : (skinnyreload ?
"Reloaded" :
"Created"), l->name);
7174 if (!strcasecmp(dname, temp->name) && temp->prune) {
7181 ast_verb(1,
"Unable to allocate memory for device %s.\n", dname);
7200 if (!ntohs(d->
addr.sin_port)) {
7207 if (strcasecmp(d->id, temp->id) || !temp->prune || !temp->
session) {
7220 if (strcasecmp(l->name, ltemp->name)) {
7224 l->instance = ltemp->instance;
7225 l->hookstate = ltemp->hookstate;
7246 ast_verb(3,
"%s config for device '%s'\n", update ?
"Updated" : (skinnyreload ?
"Reloaded" :
"Created"), d->name);
7257 int oldport = ntohs(
bindaddr.sin_port);
7262 if (gethostname(ourhost,
sizeof(ourhost))) {
7283 if (ntohl(
bindaddr.sin_addr.s_addr)) {
7304 while (cat && strcasecmp(cat,
"general") && strcasecmp(cat,
"devices")) {
7314 while (cat && strcasecmp(cat,
"general") && strcasecmp(cat,
"lines")) {
7320 if ((skinnysock > -1) && (ntohs(
bindaddr.sin_port) != oldport)) {
7324 if (skinnysock < 0) {
7325 skinnysock = socket(AF_INET, SOCK_STREAM, 0);
7326 if(setsockopt(skinnysock, SOL_SOCKET, SO_REUSEADDR, &on,
sizeof(on)) == -1) {
7332 if (skinnysock < 0) {
7335 if (bind(skinnysock, (
struct sockaddr *)&
bindaddr,
sizeof(
bindaddr)) < 0) {
7355 ast_verb(2,
"Skinny listening on %s:%d\n",
7371 struct skinny_addon *a;
7402 struct skinny_addon *a;
7406 ast_verb(3,
"Chan_skinny is already reloading.\n");
7433 ast_verb(3,
"Removing device '%s'\n", d->name);
7467 ast_verb(3,
"Restarting device '%s'\n", d->name);
7483 for (; res <
ARRAY_LEN(soft_key_template_default); res++) {
7559 pthread_cancel(s->
t);
7560 pthread_kill(s->
t, SIGURG);
7561 pthread_join(s->
t, NULL);
7570 pthread_cancel(monitor_thread);
7571 pthread_kill(monitor_thread, SIGURG);
7572 pthread_join(monitor_thread, NULL);
7579 pthread_cancel(accept_t);
7580 pthread_kill(accept_t, SIGURG);
7581 pthread_join(accept_t, NULL);
int ast_io_wait(struct io_context *ioc, int howlong)
Waits for IO.
#define SKINNY_DEVICE_7931
static const uint8_t soft_key_default_connwithconf[]
#define START_TONE_MESSAGE
static void transmit_dialednumber(struct skinny_device *d, const char *text, int instance, int callid)
void ast_rtp_codecs_packetization_set(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance, struct ast_codec_pref *prefs)
Set codec packetization preferences.
#define AST_THREADSTORAGE(name)
Define a thread storage variable.
int ast_safe_sleep(struct ast_channel *chan, int ms)
Wait for a specified amount of time, looking for hangups.
int ast_queue_hangup(struct ast_channel *chan)
Queue a hangup frame.
union ast_frame_subclass subclass
static char * _skinny_show_lines(int fd, int *total, struct mansession *s, const struct message *m, int argc, const char *argv[])
int ast_hangup(struct ast_channel *chan)
Hang up a channel.
static struct ast_channel * skinny_new(struct skinny_line *l, int state, const char *linkedid)
static void * get_button_template(struct skinnysession *s, struct button_definition_template *btn)
struct soft_key_template_res_message softkeytemplate
struct sockaddr_storage ss
enum sip_cc_notify_state state
static char accountcode[AST_MAX_ACCOUNT_CODE]
int ast_get_hint(char *hint, int hintsize, char *name, int namesize, struct ast_channel *c, const char *context, const char *exten)
If an extension hint exists, return non-zero.
void ast_set_callerid(struct ast_channel *chan, const char *cid_num, const char *cid_name, const char *cid_ani)
Set caller ID number, name and ANI and generate AMI event.
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) ...
static char exten[AST_MAX_EXTENSION]
Main Channel structure associated with a channel.
#define SKINNY_DEVICE_7960
#define AST_CLI_DEFINE(fn, txt,...)
static enum ast_rtp_glue_result skinny_get_rtp_peer(struct ast_channel *c, struct ast_rtp_instance **instance)
ast_device_state
Device States.
#define DEFAULT_AUTH_LIMIT
char * str
Subscriber phone number (Malloced)
struct ast_party_connected_line connected
Channel Connected Line ID information.
#define AST_LIST_LOCK(head)
Locks a list.
static char * complete_skinny_show_device(const char *line, const char *word, int pos, int state)
#define SKINNY_CX_RECVONLY
static void transmit_cfwdstate(struct skinny_device *d, struct skinny_line *l)
Asterisk locking-related definitions:
void astman_append(struct mansession *s, const char *fmt,...)
Asterisk main include file. File version handling, generic pbx functions.
#define AST_LIST_FIRST(head)
Returns the first entry contained in a list.
#define BUTTON_TEMPLATE_REQ_MESSAGE
static struct ast_codec_pref default_prefs
struct button_template_res_message buttontemplate
#define AST_LIST_HEAD(name, type)
Defines a structure to be used to hold a list of specified type.
static pthread_t monitor_thread
void ast_module_unref(struct ast_module *)
static struct skinny_device * config_device(const char *dname, struct ast_variable *v)
static char parkinglot[AST_MAX_CONTEXT]
int ast_queue_control(struct ast_channel *chan, enum ast_control_frame_type control)
Queue a control frame with payload.
struct ast_frame ast_null_frame
struct ast_party_caller caller
Channel Caller ID information.
struct ast_tone_zone * zone
void * ast_threadstorage_get(struct ast_threadstorage *ts, size_t init_size)
Retrieve thread storage.
struct register_ack_message regack
struct register_rej_message regrej
char * strsep(char **str, const char *delims)
#define STOP_TONE_MESSAGE
#define START_MEDIA_TRANSMISSION_MESSAGE
int ast_callerid_split(const char *src, char *name, int namelen, char *num, int numlen)
static void * accept_thread(void *ignore)
#define SOFT_KEY_SET_RES_MESSAGE
#define SKINNY_DEVICE_7921
static int gendigittimeout
static void register_exten(struct skinny_line *l)
static struct skinny_req * skinny_req_parse(struct skinnysession *s)
struct keypad_button_message keypad
#define LINE_STAT_RES_MESSAGE
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.
int ast_channel_masquerade(struct ast_channel *original, struct ast_channel *clone)
Weird function made for call transfers.
CallerID (and other GR30) management and generation Includes code and algorithms from the Zapata libr...
static int skinny_unhold(struct skinny_subchannel *sub)
struct enbloc_call_message enbloccallmessage
struct ast_party_id id
Connected party ID.
int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len)
Unregister multiple commands.
#define SKINNY_LAMP_BLINK
static struct ast_jb_conf default_jbconf
#define ast_test_flag(p, flag)
#define SKINNY_CONGESTION
static struct skinny_line * find_line_by_instance(struct skinny_device *d, int instance)
static void update(int code_size, int y, int wi, int fi, int dq, int sr, int dqsez, struct g726_state *state_ptr)
#define STIMULUS_SPEEDDIAL
int ast_indicate(struct ast_channel *chan, int condition)
Indicates condition of channel.
#define KEEP_ALIVE_MESSAGE
#define CLEAR_DISPLAY_MESSAGE
struct skinnysession * session
struct ast_party_name name
Subscriber name.
#define AST_FORMAT_G723_1
void ast_channel_unregister(const struct ast_channel_tech *tech)
Unregister a channel technology.
static struct in_addr __ourip
int ast_extension_state_del(int id, ast_state_cb_type change_cb)
Deletes a registered state change callback by ID.
static int handle_stimulus_message(struct skinny_req *req, struct skinnysession *s)
struct forward_stat_message forwardstat
#define SELECT_SOFT_KEYS_MESSAGE
Convenient Signal Processing routines.
char context[AST_MAX_CONTEXT]
int ast_apply_ha(const struct ast_ha *ha, const struct ast_sockaddr *addr)
Apply a set of rules to a given IP address.
struct set_speaker_message setspeaker
struct skinny_device::@110 speeddials
int ast_app_has_voicemail(const char *mailbox, 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.
struct ast_rtp_codecs * ast_rtp_instance_get_codecs(struct ast_rtp_instance *instance)
Get the codecs structure of an RTP instance.
static char * handle_skinny_show_devices(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
descriptor for a cli entry.
#define DIALED_NUMBER_MESSAGE
enum ast_pbx_result ast_pbx_start(struct ast_channel *c)
Create a new thread and start the PBX.
static void destroy_session(struct skinnysession *s)
#define AST_LIST_UNLOCK(head)
Attempts to unlock a list.
struct start_tone_message starttone
struct ast_variable * ast_variable_browse(const struct ast_config *config, const char *category)
Goes through variables.
static void transmit_selectsoftkeys(struct skinny_device *d, int instance, int callid, int softkey)
struct version_res_message version
static const char tdesc[]
static char * _skinny_show_device(int type, int fd, struct mansession *s, const struct message *m, int argc, const char *argv[])
#define CONTROL2STR_BUFSIZE
struct ast_rtp_instance * rtp
int ast_jb_read_conf(struct ast_jb_conf *conf, const char *varname, const char *value)
Sets jitterbuffer configuration property.
#define REGISTER_AVAILABLE_LINES_MESSAGE
void ast_verbose(const char *fmt,...)
uint32_t softKeySetOffset
static const uint8_t soft_key_default_ringin[]
#define SKINNY_DEVICE_7962
static void transmit_definetimedate(struct skinny_device *d)
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 SKINNY_DEVICE_SCCPGATEWAY_AN
Structure for variables, used for configurations and for channel variables.
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 int handle_offhook_message(struct skinny_req *req, struct skinnysession *s)
static int codec_ast2skinny(format_t astcodec)
#define SERVER_RES_MESSAGE
int ast_rtp_instance_write(struct ast_rtp_instance *instance, struct ast_frame *frame)
Send a frame out over RTP.
static int skinny_fixup(struct ast_channel *oldchan, struct ast_channel *newchan)
struct register_message reg
static struct ast_threadstorage device2str_threadbuf
#define ast_rtp_glue_register(glue)
format_t ast_codec_pref_index(struct ast_codec_pref *pref, int index)
Codec located at a particular place in the preference index.
#define AST_LIST_NEXT(elm, field)
Returns the next entry in the list after the given entry.
static char date_format[6]
struct soft_key_set_res_message softkeysets
struct call_state_message callstate
struct close_receive_channel_message closereceivechannel
static format_t default_capability
static char * _skinny_show_line(int type, int fd, struct mansession *s, const struct message *m, int argc, const char *argv[])
struct dialed_number_message dialednumber
char originalCalledParty[24]
struct line_stat_res_message linestat
char exten[AST_MAX_EXTENSION]
int ast_ignore_pattern(const char *context, const char *pattern)
Checks to see if a number should be ignored.
struct stop_media_transmission_message stopmedia
Configuration File Parser.
static const uint8_t soft_key_default_unknown[]
int ast_netsock_set_qos(int netsocket, int tos, int cos, const char *desc)
static int handle_keep_alive_message(struct skinny_req *req, struct skinnysession *s)
char * str
Subscriber name (Malloced)
char outbuf[SKINNY_MAX_PACKET]
static struct skinny_subchannel * find_subchannel_by_instance_reference(struct skinny_device *d, int instance, int reference)
uint32_t stimulusInstance
#define KEYDEF_CONNWITHCONF
#define DEFAULT_AUTH_TIMEOUT
static int skinny_set_rtp_peer(struct ast_channel *c, struct ast_rtp_instance *rtp, struct ast_rtp_instance *vrtp, struct ast_rtp_instance *trtp, format_t codecs, int nat_active)
format_t ast_best_codec(format_t fmts)
Pick the best audio codec.
static char * control2str(int ind)
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
Number of new messages Used by: AST_EVENT_MWI Payload type: UINT.
#define SKINNY_DEVICE_7920
static int skinny_senddigit_begin(struct ast_channel *ast, char digit)
uint32_t lastRedirectingReason
#define AST_LIST_EMPTY(head)
Checks whether the specified list contains any entries.
#define ast_mutex_lock(a)
struct station_capabilities caps[SKINNY_MAX_CAPABILITIES]
static void * skinny_newcall(void *data)
#define SKINNY_DEVICE_7975
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_MODULE_INFO(keystr, flags_to_set, desc, fields...)
static char * handle_skinny_show_device(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
Show device information.
struct display_prompt_status_message displaypromptstatus
struct activate_call_plane_message activatecallplane
struct skinny_device * device
static struct soft_key_definitions soft_key_default_definitions[]
static struct soft_key_template_definition soft_key_template_default[]
SKINNY_LINE_OPTIONS ast_mutex_t lock
int ast_str2tos(const char *value, unsigned int *tos)
Convert a string to the appropriate TOS value.
#define SKINNY_DEVICE_7937
#define SKINNY_LINE_OPTIONS
struct definetimedate_message definetimedate
static int skinny_header_size
static void start_rtp(struct skinny_subchannel *sub)
static int inbuf(struct baseio *bio, FILE *fi)
utility used by inchar(), for base_encode()
#define SKINNY_DEVICE_OPTIONS
static int skinny_indicate(struct ast_channel *ast, int ind, const void *data, size_t datalen)
I/O Management (derived from Cheops-NG)
static int config_load(void)
char * ast_cdr_flags2str(int flags)
Definitions to aid in the use of thread local storage.
struct set_microphone_message setmicrophone
#define UNREGISTER_MESSAGE
Common implementation-independent jitterbuffer stuff.
void ast_cli(int fd, const char *fmt,...)
struct soft_key_set_definition softKeySetDefinition[16]
struct ast_event_sub * mwi_event_sub
#define LINE_STATE_REQ_MESSAGE
#define AST_LIST_REMOVE(head, elm, field)
Removes a specific entry from a list.
const ast_string_field linkedid
static void transmit_linestatres(struct skinny_device *d, struct skinny_line *l)
static void transmit_displaynotify(struct skinny_device *d, const char *text, int t)
static int restart_monitor(void)
#define SKINNY_LAMP_FLASH
#define SKINNY_DEVICE_7905
char speedDialDirNumber[24]
#define SOFTKEY_CFWDNOANSWER
enum ast_channel_adsicpe adsicpe
#define AST_LIST_TRAVERSE_SAFE_END
Closes a safe loop traversal block.
void ast_moh_stop(struct ast_channel *chan)
Turn off music on hold on a given channel.
void ast_free_ptr(void *ptr)
struct offhook_message offhook
Socket address structure.
struct skinny_device::@111 addons
static int firstdigittimeout
static format_t codec_skinny2ast(enum skinny_codecs skinnycodec)
char callingPartyName[40]
struct speed_dial_stat_res_message speeddial
#define ast_verb(level,...)
void ast_config_destroy(struct ast_config *config)
Destroys a config.
static void cleanup_stale_contexts(char *new, char *old)
int ast_atomic_fetchadd_int(volatile int *p, int v)
Atomically add v to *p and return * the previous value of *p. This can be used to handle reference co...
struct ast_channel * ast_channel_alloc(int needqueue, int state, const char *cid_num, const char *cid_name, const char *acctcode, const char *exten, const char *context, const char *linkedid, const int amaflag, const char *name_fmt,...)
int ast_canmatch_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid)
Looks for a valid matching extension.
uint32_t secondaryKeepAlive
static char * handle_skinny_reset(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
union station_capabilities::@102 payloads
static char * complete_skinny_devices(const char *word, int state)
int ast_context_remove_extension(const char *context, const char *extension, int priority, const char *registrar)
Simply remove extension from context.
static ast_mutex_t monlock
String fields in structures.
struct skinny_subchannel::@103 list
char * ast_print_group(char *buf, int buflen, ast_group_t group)
print call- and pickup groups into buffer
int args
This gets set in ast_cli_register()
static void transmit_stopmediatransmission(struct skinny_device *d, struct skinny_subchannel *sub)
const char * astman_get_header(const struct message *m, char *var)
Get header from mananger transaction.
struct skinny_device * device
#define SKINNY_DEVICE_SCCPGATEWAY_BRI
static int handle_button_template_req_message(struct skinny_req *req, struct skinnysession *s)
static int skinny_unregister(struct skinny_req *req, struct skinnysession *s)
char context[AST_MAX_CONTEXT]
struct soft_key_template_definition softKeyTemplateDefinition[32]
char lastRedirectingPartyName[40]
#define ast_pthread_create_background(a, b, c, d)
#define HEADSET_STATUS_MESSAGE
struct skinny_line * parent
int ast_masq_park_call(struct ast_channel *park_me, struct ast_channel *parker, int timeout, int *extout)
Park a call via a masqueraded channel.
static int skinny_write(struct ast_channel *ast, struct ast_frame *frame)
long resync_threshold
Resynchronization threshold of the jitterbuffer implementation.
char lastRedirectingParty[24]
internal representation of acl entries In principle user applications would have no need for this...
static int handle_enbloc_call_message(struct skinny_req *req, struct skinnysession *s)
struct ast_party_id id
Caller party ID.
#define BUTTON_TEMPLATE_RES_MESSAGE
int ast_set_write_format(struct ast_channel *chan, format_t format)
Sets write format on channel chan Set write format for channel to whichever component of "format" is ...
struct skinny_line * activeline
static char * _skinny_show_devices(int fd, int *total, struct mansession *s, const struct message *m, int argc, const char *argv[])
static int matchdigittimeout
#define SKINNY_DEVICE_7971
static char used_context[AST_MAX_EXTENSION]
struct ast_format_list ast_codec_pref_getsize(struct ast_codec_pref *pref, format_t format)
Get packet size for codec.
#define STIMULUS_FORWARDALL
static int handle_callforward_button(struct skinny_subchannel *sub, int cfwdtype)
#define EVENT_FLAG_SYSTEM
static char * complete_skinny_reset(const char *line, const char *word, int pos, int state)
int ast_set_read_format(struct ast_channel *chan, format_t format)
Sets read format on channel chan Set read format for channel to whichever component of "format" is be...
#define ast_debug(level,...)
Log a DEBUG message.
static struct skinny_device_options * default_device
struct skinny_subchannel * activesub
#define REGISTER_REJ_MESSAGE
Context IE Used by AST_EVENT_MWI Payload type: str.
#define KEEP_ALIVE_ACK_MESSAGE
int ast_devstate_changed(enum ast_device_state state, enum ast_devstate_cache cachable, const char *fmt,...)
Tells Asterisk the State for Device is changed.
char originalCalledPartyName[40]
static struct skinny_line_options default_line_struct
struct ast_rtp_instance * vrtp
char * ast_callerid_merge(char *buf, int bufsiz, const char *name, const char *num, const char *unknown)
static struct skinny_line_options * default_line
struct ast_party_id ani
Automatic Number Identification (ANI)
SKINNY_DEVICE_OPTIONS struct type * first
static int skinny_reload(void)
static char * handle_skinny_reload(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
General Asterisk PBX channel definitions.
static struct ast_rtp_glue skinny_rtp_glue
#define SKINNY_DEVICE_7961GE
#define STIMULUS_VOICEMAIL
#define SET_MICROPHONE_MESSAGE
#define ast_sockaddr_from_sin(addr, sin)
Converts a struct sockaddr_in to a struct ast_sockaddr.
#define ast_config_load(filename, flags)
Load a config file.
#define ast_manager_register_xml(a, b, c)
Register a manager callback using XML documentation to describe the manager.
#define AST_PTHREADT_NULL
static force_inline int attribute_pure ast_strlen_zero(const char *s)
static void transmit_clear_display_message(struct skinny_device *d, int instance, int reference)
#define ast_poll(a, b, c)
struct ast_variable * chanvars
Access Control of various sorts.
#define OPEN_RECEIVE_CHANNEL_MESSAGE
Global IO variables are now in a struct in order to be made threadsafe.
struct skinny_line::@106 all
static struct ast_frame * skinny_read(struct ast_channel *ast)
#define AST_MAX_EXTENSION
Scheduler Routines (derived from cheops)
static void config_parse_variables(int type, void *item, struct ast_variable *vptr)
#define SKINNY_DEVICE_7911
static int skinny_hangup(struct ast_channel *ast)
void ast_party_number_init(struct ast_party_number *init)
Initialize the given number structure.
static void transmit_callinfo(struct skinny_device *d, const char *fromname, const char *fromnum, const char *toname, const char *tonum, int instance, int callid, int calltype)
#define AST_LIST_REMOVE_CURRENT(field)
Removes the current entry from a list during a traversal.
#define AST_FORMAT_G726_AAL2
char * ast_category_browse(struct ast_config *config, const char *prev)
Goes through categories.
#define ao2_ref(o, delta)
static void update_connectedline(struct skinny_subchannel *sub, const void *data, size_t datalen)
#define S_COR(a, b, c)
returns the equivalent of logic or for strings, with an additional boolean check: second one if not e...
int ast_softhangup(struct ast_channel *chan, int reason)
Softly hangup up a channel.
struct call_info_message callinfo
#define DEFAULT_SKINNY_PORT
static char * handle_skinny_show_line(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
List line information.
static char * device2str(int type)
static void * skinny_ss(void *data)
#define CLOSE_RECEIVE_CHANNEL_MESSAGE
static int skinny_senddigit_end(struct ast_channel *ast, char digit, unsigned int duration)
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.
#define VERSION_REQ_MESSAGE
int ast_rtp_instance_set_remote_address(struct ast_rtp_instance *instance, const struct ast_sockaddr *address)
Set the address of the remote endpoint that we are sending RTP to.
struct line_state_req_message line
long target_extra
amount of additional jitterbuffer adjustment
#define SKINNY_DEVICE_30SPPLUS
static const uint8_t soft_key_default_onhold[]
struct open_receive_channel_ack_message openreceivechannelack
static void transmit_softkeysetres(struct skinny_device *d)
A set of macros to manage forward-linked lists.
static char language[MAX_LANGUAGE]
static const uint8_t soft_key_default_ringout[]
ast_group_t ast_get_group(const char *s)
#define AST_LIST_REMOVE_HEAD(head, field)
Removes and returns the head entry from a list.
static int handle_open_receive_channel_ack_message(struct skinny_req *req, struct skinnysession *s)
struct alarm_message alarm
#define SOFT_KEY_EVENT_MESSAGE
static const char config[]
#define CLEAR_PROMPT_MESSAGE
int ast_exists_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid)
Determine whether an extension exists.
#define DEFINETIMEDATE_MESSAGE
static char regcontext[AST_MAX_CONTEXT]
#define ENBLOC_CALL_MESSAGE
#define SKINNY_CFWD_NOANSWER
char impl[AST_JB_IMPL_NAME_SIZE]
Name of the jitterbuffer implementation to be used.
Structure to describe a channel "technology", ie a channel driver See for examples: ...
Core PBX routines and definitions.
uint32_t totalSoftKeyCount
int ast_queue_frame(struct ast_channel *chan, struct ast_frame *f)
Queue one or more frames to a channel's frame queue.
void ast_party_number_free(struct ast_party_number *doomed)
Destroy the party number contents.
static int manager_skinny_show_device(struct mansession *s, const struct message *m)
static void transmit_start_tone(struct skinny_device *d, int tone, int instance, int reference)
#define SERVER_REQUEST_MESSAGE
struct ast_channel * owner
static struct skinny_line * config_line(const char *lname, struct ast_variable *v)
#define SKINNY_CALLREMOTEMULTILINE
static struct ast_channel * skinny_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause)
#define AST_LIST_HEAD_STATIC(name, type)
Defines a structure to be used to hold a list of specified type, statically initialized.
static struct ast_hostent ahp
static void transmit_startmediatransmission(struct skinny_device *d, struct skinny_subchannel *sub, struct sockaddr_in dest, struct ast_format_list fmt)
static int handle_message(struct skinny_req *req, struct skinnysession *s)
#define DEFAULT_SKINNY_BACKLOG
The AMI - Asterisk Manager Interface - is a TCP protocol created to manage Asterisk with third-party ...
#define ast_strdupa(s)
duplicate a string in memory from the stack
#define SKINNY_DEVONLY(code)
static int skinny_answer(struct ast_channel *ast)
static int manager_skinny_show_lines(struct mansession *s, const struct message *m)
Show Skinny lines in the manager API.
#define SET_RINGER_MESSAGE
static enum ast_rtp_glue_result skinny_get_vrtp_peer(struct ast_channel *c, struct ast_rtp_instance **instance)
static int manager_skinny_show_line(struct mansession *s, const struct message *m)
char * ast_getformatname(format_t format)
Get the name of a format.
static pthread_t accept_t
static int load_module(void)
struct displaytext_message displaytext
#define AST_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
uint32_t totalSoftKeySetCount
static struct skinny_line * find_line_by_name(const char *dest)
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".
void sched_context_destroy(struct sched_context *c)
destroys a schedule context Destroys (free's) the given sched_context structure
static int handle_transfer_button(struct skinny_subchannel *sub)
static struct ast_threadstorage control2str_threadbuf
static int skinny_transfer(struct skinny_subchannel *sub)
#define KEYPAD_BUTTON_MESSAGE
#define ACTIVATE_CALL_PLANE_MESSAGE
static int manager_skinny_show_devices(struct mansession *s, const struct message *m)
Show SKINNY devices in the manager API.
#define SKINNY_SPEAKEROFF
static char global_vmexten[AST_MAX_EXTENSION]
static struct ast_channel_tech skinny_tech
struct open_receive_channel_message openreceivechannel
static const uint8_t soft_key_default_connected[]
struct stimulus_message stimulus
static int handle_soft_key_event_message(struct skinny_req *req, struct skinnysession *s)
static ast_mutex_t netlock
#define SKINNY_DEVICE_7941GE
void ast_party_name_init(struct ast_party_name *init)
Initialize the given name structure.
char inbuf[SKINNY_MAX_PACKET]
static const uint8_t soft_key_default_dadfd[]
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
int ast_cdr_amaflags2int(const char *flag)
Convert a string to a detail record AMA flag.
enum ast_channel_state _state
struct set_lamp_message setlamp
struct ast_tone_zone_sound * ast_get_indication_tone(const struct ast_tone_zone *zone, const char *indication)
Locate a tone zone sound.
struct ast_channel * ast_bridged_channel(struct ast_channel *chan)
Find bridged channel.
static int handle_register_message(struct skinny_req *req, struct skinnysession *s)
static void * do_monitor(void *data)
static int unauth_sessions
const ast_string_field name
static struct ast_frame * skinny_rtp_read(struct skinny_subchannel *sub)
#define SKINNY_DEVICE_NONE
int ast_moh_start(struct ast_channel *chan, const char *mclass, const char *interpclass)
Turn on music on hold on a given channel.
static char * handle_skinny_show_settings(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
List global settings for the Skinny subsystem.
#define SKINNY_DEVICE_12SP
void ast_party_name_free(struct ast_party_name *doomed)
Destroy the party name contents.
void ast_log(int level, const char *file, int line, const char *function, const char *fmt,...)
Used for sending a log message This is the standard logger function. Probably the only way you will i...
struct select_soft_keys_message selectsoftkey
#define SKINNY_DEVICE_7985
int ast_get_ip(struct ast_sockaddr *addr, const char *hostname)
Get the IP address given a hostname.
static char * handle_skinny_set_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
struct speed_dial_stat_req_message speeddialreq
int ast_softhangup_nolock(struct ast_channel *chan, int reason)
Softly hangup up a channel (no channel lock)
uint32_t serverListenPort[5]
#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.
#define AST_LIST_INSERT_HEAD(head, elm, field)
Inserts a list entry at the head of a list.
#define SET_SPEAKER_MESSAGE
static void transmit_connect(struct skinny_device *d, struct skinny_subchannel *sub)
#define SKINNY_DEVICE_7970
const char * ast_inet_ntoa(struct in_addr ia)
thread-safe replacement for inet_ntoa().
#define CALL_STATE_MESSAGE
static void transmit_activatecallplane(struct skinny_device *d, struct skinny_line *l)
#define ast_pthread_create(a, b, c, d)
static int handle_capabilities_res_message(struct skinny_req *req, struct skinnysession *s)
#define SKINNY_MAX_CAPABILITIES
static struct ast_cli_entry cli_skinny[]
#define SKINNY_DEVICE_7912
static struct skinny_subchannel * find_subchannel_by_reference(struct skinny_device *d, int reference)
#define TIME_DATE_REQ_MESSAGE
static void transmit_serverres(struct skinny_device *d)
#define AST_FORMAT_AUDIO_MASK
#define SKINNY_DEVICE_7935
#define SPEED_DIAL_STAT_REQ_MESSAGE
void ast_rtp_instance_get_remote_address(struct ast_rtp_instance *instance, struct ast_sockaddr *address)
Get the address of the remote endpoint that we are sending RTP to.
#define STIMULUS_TRANSFER
int ast_str2cos(const char *value, unsigned int *cos)
Convert a string to the appropriate COS value.
struct skinny_device * parent
#define SKINNY_DEVICE_UNKNOWN
static struct skinny_device_options default_device_struct
int ast_rtp_instance_fd(struct ast_rtp_instance *instance, int rtcp)
Get the file descriptor for an RTP session (or RTCP)
char calledPartyVoiceMailbox[24]
struct ast_rtp_instance * ast_rtp_instance_new(const char *engine_name, struct sched_context *sched, const struct ast_sockaddr *sa, void *data)
Create a new RTP instance.
unsigned int flags
Combination of the AST_JB_ENABLED, AST_JB_FORCED and AST_JB_LOG flags.
struct clear_prompt_message clearpromptstatus
#define SKINNY_DEVICE_12SPPLUS
char lastRedirectingVoiceMailbox[24]
#define SKINNY_DEVICE_CIPC
uint32_t originalCalledPartyRedirectReason
#define FORWARD_STAT_MESSAGE
#define SKINNY_DEVICE_7961
static void transmit_lamp_indication(struct skinny_device *d, int stimulus, int instance, int indication)
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.
static struct skinny_speeddial * find_speeddial_by_instance(struct skinny_device *d, int instance, int isHint)
static int get_devicestate(struct skinny_line *l)
int ast_rtp_instance_destroy(struct ast_rtp_instance *instance)
Destroy an RTP instance.
void ast_channel_set_fd(struct ast_channel *chan, int which, int fd)
#define SKINNY_DEVICE_7965
#define SKINNY_DEVICE_7902
void ast_jb_configure(struct ast_channel *chan, const struct ast_jb_conf *conf)
Configures a jitterbuffer on a channel.
#define SKINNY_DEVICE_30VIP
int ast_sched_runq(struct sched_context *con)
Runs the queue.
static void transmit_speaker_mode(struct skinny_device *d, int mode)
int pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const char *value)
Add a variable to the channel variable stack, removing the most recently set value for the same name...
static struct sockaddr_in bindaddr
uint32_t ast_event_get_ie_uint(const struct ast_event *event, enum ast_event_ie_type ie_type)
Get the value of an information element that has an integer payload.
struct ast_frame * ast_udptl_read(struct ast_udptl *udptl)
#define STIMULUS_FORWARDBUSY
static int set_callforwards(struct skinny_line *l, const char *cfwd, int cfwdtype)
static char * handle_skinny_show_lines(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
#define SKINNY_DEVICE_7941
#define EVENT_FLAG_REPORTING
#define SKINNY_DEVICE_ATA186
static void transmit_clearpromptmessage(struct skinny_device *d, int instance, int callid)
static struct ast_jb_conf global_jbconf
struct stop_tone_message stoptone
#define SKINNY_DEVICE_7936
struct hostent * ast_gethostbyname(const char *host, struct ast_hostent *hp)
Thread-safe gethostbyname function to use in Asterisk.
static void transmit_versionres(struct skinny_device *d)
static void transmit_speeddialstatres(struct skinny_device *d, struct skinny_speeddial *sd)
struct soft_key_event_message softkeyeventmessage
#define BT_CUST_LINESPEEDDIAL
static void print_codec_to_cli(int fd, struct ast_codec_pref *pref)
Print codec list from preference to CLI/manager.
#define SKINNY_CX_INACTIVE
static int skinny_hold(struct skinny_subchannel *sub)
#define STIMULUS_CONFERENCE
#define SKINNY_RING_INSIDE
struct sched_context * sched_context_create(void)
New schedule context.
#define STOP_MEDIA_TRANSMISSION_MESSAGE
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.
Channels have this property if they can create jitter; i.e. most VoIP channels.
static void mwi_event_cb(const struct ast_event *event, void *userdata)
struct skinny_subchannel * related
Standard Command Line Interface.
#define SPEED_DIAL_STAT_RES_MESSAGE
#define DISPLAY_PROMPT_STATUS_MESSAGE
static int transmit_response(struct skinny_device *d, struct skinny_req *req)
static char * complete_skinny_show_line(const char *line, const char *word, int pos, int state)
struct ast_event_sub * ast_event_subscribe(enum ast_event_type event_type, ast_event_cb_t cb, const char *description, void *userdata,...)
Subscribe to events.
static const uint8_t soft_key_default_connwithtrans[]
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
static int get_input(struct skinnysession *s)
#define S_OR(a, b)
returns the equivalent of logic or for strings: first one if not empty, otherwise second one...
#define SOFT_KEY_TEMPLATE_RES_MESSAGE
int ast_cli_register_multiple(struct ast_cli_entry *e, int len)
Register multiple commands.
struct skinny_line::@104 sub
#define VERSION_RES_MESSAGE
static void delete_devices(void)
int ast_sched_wait(struct sched_context *con) attribute_warn_unused_result
Determines number of seconds until the next outstanding event to take place Determine the number of s...
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.
struct start_media_transmission_message startmedia
int ast_queue_control_data(struct ast_channel *chan, enum ast_control_frame_type control, const void *data, size_t datalen)
Queue a control frame with payload.
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
char speedDialDisplayName[40]
enum ast_pbx_result ast_pbx_run(struct ast_channel *c)
Execute the PBX in the current thread.
char * ast_getformatname_multiple(char *buf, size_t size, format_t format)
Get the names of a set of formats.
static const uint8_t soft_key_default_offhook[]
Data structure associated with a single frame of data.
#define SKINNY_DEVICE_7914
static void transmit_closereceivechannel(struct skinny_device *d, struct skinny_subchannel *sub)
#define KEYDEF_OFFHOOKWITHFEAT
void ast_context_destroy(struct ast_context *con, const char *registrar)
Destroy a context (matches the specified context (or ANY context if NULL)
#define SKINNY_MAX_PACKET
static int skinny_extensionstate_cb(char *context, char *exten, int state, void *data)
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 int handle_ip_port_message(struct skinny_req *req, struct skinnysession *s)
static void transmit_stop_tone(struct skinny_device *d, int instance, int reference)
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.
Channels have this property if they can accept input with jitter; i.e. most VoIP channels.
const char * data
Description of a tone.
#define SKINNY_DEVICE_7942
static int unload_module(void)
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.
#define ast_sockaddr_to_sin(addr, sin)
Converts a struct ast_sockaddr to a struct sockaddr_in.
#define AST_LIST_TRAVERSE_SAFE_BEGIN(head, var, field)
Loops safely over (traverses) the entries in a list.
enum ast_frame_type frametype
#define SOFT_KEY_TEMPLATE_REQ_MESSAGE
struct ast_variable * next
static void unregister_exten(struct skinny_line *l)
#define KEYDEF_CONNWITHTRANS
static void transmit_callstate(struct skinny_device *d, int buttonInstance, unsigned callid, int state)
#define ast_mutex_init(pmutex)
static struct io_context * io
#define AST_CLI_YESNO(x)
return Yes or No depending on the argument. This is used in many places in CLI command, having a function to generate this helps maintaining a consistent output (and possibly emitting the output in other languages, at some point).
unsigned char valid
TRUE if the name information is valid/present.
#define DISPLAYTEXT_MESSAGE
#define STIMULUS_FORWARDNOANSWER
static const uint8_t soft_key_default_offhookwithfeat[]
#define CONFIG_STATUS_FILEINVALID
static char context[AST_MAX_CONTEXT]
Call Parking and Pickup API Includes code and algorithms from the Zapata library. ...
static int handle_hold_button(struct skinny_subchannel *sub)
static int skinny_register(struct skinny_req *req, struct skinnysession *s)
#define CAPABILITIES_REQ_MESSAGE
#define ast_mutex_destroy(a)
static char version_id[16]
struct ast_context * ast_context_find_or_create(struct ast_context **extcontexts, struct ast_hashtab *exttable, const char *name, const char *registrar)
Register a new context or find an existing one.
#define SKINNY_CX_SENDRECV
int ast_extension_state_add(const char *context, const char *exten, ast_state_cb_type change_cb, void *data)
Registers a state change callback.
static struct ast_variable * add_var(const char *buf, struct ast_variable *list)
#define SKINNY_DEVICE_7945
uint8_t softKeyTemplateIndex[16]
#define STIMULUS_CALLPARK
char originalCalledPartyVoiceMailbox[24]
struct set_ringer_message setringer
static const uint8_t soft_key_default_onhook[]
Say numbers and dates (maybe words one day too)
struct server_res_message serverres
#define ASTERISK_GPL_KEY
The text the key() function should return.
#define manager_event(category, event, contents,...)
External routines may send asterisk manager events this way.
static int skinny_devicestate(void *data)
Pluggable RTP Architecture.
char callingPartyVoiceMailbox[24]
struct onhook_message onhook
void ast_rtp_instance_update_source(struct ast_rtp_instance *instance)
Indicate that the RTP marker bit should be set on an RTP stream.
void astman_send_error(struct mansession *s, const struct message *m, char *error)
Send error in manager transaction.
Asterisk module definitions.
static struct hostent * hp
struct capabilities_res_message caps
static snd_pcm_format_t format
struct ast_channel_tech * tech
#define CAPABILITIES_RES_MESSAGE
long max_size
Max size of the jitterbuffer implementation.
struct display_notify_message displaynotify
Persistant data storage (akin to *doze registry)
struct ast_event_sub * ast_event_unsubscribe(struct ast_event_sub *event_sub)
Un-subscribe from events.
ast_context: An extension context
struct reset_message reset
unsigned char valid
TRUE if the number information is valid/present.
struct skinny_device::@109 lines
uint16_t softKeyInfoIndex[16]
#define CLEAR_NOTIFY_MESSAGE
General jitterbuffer configuration.
static int skinny_call(struct ast_channel *ast, char *dest, int timeout)
static void * skinny_session(void *data)
#define SOFT_KEY_SET_REQ_MESSAGE
#define REGISTER_ACK_MESSAGE
struct ast_context * ast_context_find(const char *name)
Find a context.
#define DISPLAY_NOTIFY_MESSAGE
#define SKINNY_DEVICE_7910
char exten[AST_MAX_EXTENSION]
#define AST_MUTEX_DEFINE_STATIC(mutex)
#define SKINNY_DEVICE_7940
struct ast_variable * ast_variable_new(const char *name, const char *value, const char *filename)
#define SKINNY_DEVICE_7906
#define CALL_INFO_MESSAGE
Structure for mutex and tracking information.
int ast_parse_allow_disallow(struct ast_codec_pref *pref, format_t *mask, const char *list, int allowing)
Parse an "allow" or "deny" line in a channel or device configuration and update the capabilities mask...
uint32_t stimulusInstance
static struct skinny_req * req_alloc(size_t size, int response_message)
int ast_manager_unregister(char *action)
Unregister a registered manager command.
struct ast_frame * ast_rtp_instance_read(struct ast_rtp_instance *instance, int rtcp)
Receive a frame over RTP.
#define ASTERISK_FILE_VERSION(file, version)
Register/unregister a source code file with the core.
#define OPEN_RECEIVE_CHANNEL_ACK_MESSAGE
#define ast_mutex_unlock(a)
static void transmit_displaypromptstatus(struct skinny_device *d, const char *text, int t, int instance, int callid)
#define DEVICE2STR_BUFSIZE
struct server_identifier server[5]
static void transmit_softkeytemplateres(struct skinny_device *d)
enum ast_bridge_result ast_rtp_instance_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, struct ast_frame **fo, struct ast_channel **rc, int timeoutms)
Bridge two channels that use RTP instances.
static int handle_onhook_message(struct skinny_req *req, struct skinnysession *s)
#define ast_string_field_set(x, field, data)
Set a field to a simple string value.
void astman_send_listack(struct mansession *s, const struct message *m, char *msg, char *listflag)
Send ack in manager list transaction.
struct ast_module * ast_module_ref(struct ast_module *)
struct ast_party_number number
Subscriber phone number.
static int handle_keypad_button_message(struct skinny_req *req, struct skinnysession *s)
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 transmit_ringer_mode(struct skinny_device *d, int mode)