42 #include <sys/socket.h> 43 #include <netinet/in.h> 44 #include <netinet/tcp.h> 45 #include <sys/ioctl.h> 49 #include <arpa/inet.h> 148 #define DEBUG_GENERAL (1 << 1) 149 #define DEBUG_SUB (1 << 2) 150 #define DEBUG_PACKET (1 << 3) 151 #define DEBUG_AUDIO (1 << 4) 152 #define DEBUG_LOCK (1 << 5) 153 #define DEBUG_TEMPLATE (1 << 6) 154 #define DEBUG_THREAD (1 << 7) 155 #define DEBUG_HINT (1 << 8) 156 #define DEBUG_KEEPALIVE (1 << 9) 157 #define SKINNY_DEBUG(type, verb_level, text, ...) \ 159 if (skinnydebug & (type)) { \ 160 ast_verb(verb_level, "[%d] " text, ast_get_tid(), ##__VA_ARGS__); \ 164 #define SKINNY_DEBUG(type, verb_level, text, ...) 170 static const char tdesc[] =
"Skinny Client Control Protocol (Skinny)";
171 static const char config[] =
"skinny.conf";
186 #define DEFAULT_SKINNY_PORT 2000 187 #define DEFAULT_SKINNY_BACKLOG 2 188 #define SKINNY_MAX_PACKET 2000 189 #define DEFAULT_AUTH_TIMEOUT 30 190 #define DEFAULT_AUTH_LIMIT 50 199 }
qos = { 0, 0, 0, 0, 0, 0 };
212 #if __BYTE_ORDER == __LITTLE_ENDIAN 213 #define letohl(x) (x) 214 #define letohs(x) (x) 215 #define htolel(x) (x) 216 #define htoles(x) (x) 218 #if defined(HAVE_BYTESWAP_H) 219 #include <byteswap.h> 220 #define letohl(x) bswap_32(x) 221 #define letohs(x) bswap_16(x) 222 #define htolel(x) bswap_32(x) 223 #define htoles(x) bswap_16(x) 224 #elif defined(HAVE_SYS_ENDIAN_SWAP16) 225 #include <sys/endian.h> 226 #define letohl(x) __swap32(x) 227 #define letohs(x) __swap16(x) 228 #define htolel(x) __swap32(x) 229 #define htoles(x) __swap16(x) 230 #elif defined(HAVE_SYS_ENDIAN_BSWAP16) 231 #include <sys/endian.h> 232 #define letohl(x) bswap32(x) 233 #define letohs(x) bswap16(x) 234 #define htolel(x) bswap32(x) 235 #define htoles(x) bswap16(x) 237 #define __bswap_16(x) \ 238 ((((x) & 0xff00) >> 8) | \ 239 (((x) & 0x00ff) << 8)) 240 #define __bswap_32(x) \ 241 ((((x) & 0xff000000) >> 24) | \ 242 (((x) & 0x00ff0000) >> 8) | \ 243 (((x) & 0x0000ff00) << 8) | \ 244 (((x) & 0x000000ff) << 24)) 245 #define letohl(x) __bswap_32(x) 246 #define letohs(x) __bswap_16(x) 247 #define htolel(x) __bswap_32(x) 248 #define htoles(x) __bswap_16(x) 258 .resync_threshold = 1000,
266 #define MESSAGE2STR_BUFSIZE 35 270 #define DEVICE2STR_BUFSIZE 15 273 #define CONTROL2STR_BUFSIZE 100 276 #define SUBSTATE2STR_BUFSIZE 15 279 #define CALLSTATE2STR_BUFSIZE 15 285 #define KEEP_ALIVE_MESSAGE 0x0000 288 #define REGISTER_MESSAGE 0x0001 302 #define IP_PORT_MESSAGE 0x0002 304 #define KEYPAD_BUTTON_MESSAGE 0x0003 312 #define ENBLOC_CALL_MESSAGE 0x0004 314 char calledParty[24];
317 #define STIMULUS_MESSAGE 0x0005 324 #define OFFHOOK_MESSAGE 0x0006 330 #define ONHOOK_MESSAGE 0x0007 336 #define CAPABILITIES_RES_MESSAGE 0x0010 346 #define SKINNY_MAX_CAPABILITIES 18 353 #define SPEED_DIAL_STAT_REQ_MESSAGE 0x000A 358 #define LINE_STATE_REQ_MESSAGE 0x000B 363 #define TIME_DATE_REQ_MESSAGE 0x000D 364 #define BUTTON_TEMPLATE_REQ_MESSAGE 0x000E 365 #define VERSION_REQ_MESSAGE 0x000F 366 #define SERVER_REQUEST_MESSAGE 0x0012 368 #define ALARM_MESSAGE 0x0020 371 char displayMessage[80];
376 #define OPEN_RECEIVE_CHANNEL_ACK_MESSAGE 0x0022 391 #define SOFT_KEY_SET_REQ_MESSAGE 0x0025 393 #define SOFT_KEY_EVENT_MESSAGE 0x0026 400 #define UNREGISTER_MESSAGE 0x0027 401 #define SOFT_KEY_TEMPLATE_REQ_MESSAGE 0x0028 402 #define HEADSET_STATUS_MESSAGE 0x002B 403 #define REGISTER_AVAILABLE_LINES_MESSAGE 0x002D 405 #define SERVICEURL_STATREQ_MESSAGE 0x0033 410 #define REGISTER_ACK_MESSAGE 0x0081 413 char dateTemplate[6];
419 #define START_TONE_MESSAGE 0x0082 427 #define STOP_TONE_MESSAGE 0x0083 434 #define SET_RINGER_MESSAGE 0x0085 442 #define SET_LAMP_MESSAGE 0x0086 449 #define SET_SPEAKER_MESSAGE 0x0088 455 #define SET_MICROPHONE_MESSAGE 0x0089 460 #define START_MEDIA_TRANSMISSION_MESSAGE 0x008A 492 #define STOP_MEDIA_TRANSMISSION_MESSAGE 0x008B 499 #define CALL_INFO_MESSAGE 0x008F 501 char callingPartyName[40];
502 char callingParty[24];
503 char calledPartyName[40];
504 char calledParty[24];
508 char originalCalledPartyName[40];
509 char originalCalledParty[24];
510 char lastRedirectingPartyName[40];
511 char lastRedirectingParty[24];
514 char callingPartyVoiceMailbox[24];
515 char calledPartyVoiceMailbox[24];
516 char originalCalledPartyVoiceMailbox[24];
517 char lastRedirectingVoiceMailbox[24];
521 #define FORWARD_STAT_MESSAGE 0x0090 530 char fwdnoanswernum[24];
533 #define SPEED_DIAL_STAT_RES_MESSAGE 0x0091 536 char speedDialDirNumber[24];
537 char speedDialDisplayName[40];
540 #define LINE_STAT_RES_MESSAGE 0x0092 543 char lineDirNumber[24];
544 char lineDisplayName[24];
548 #define DEFINETIMEDATE_MESSAGE 0x0094 561 #define BUTTON_TEMPLATE_RES_MESSAGE 0x0097 573 #define STIMULUS_REDIAL 0x01 574 #define STIMULUS_SPEEDDIAL 0x02 575 #define STIMULUS_HOLD 0x03 576 #define STIMULUS_TRANSFER 0x04 577 #define STIMULUS_FORWARDALL 0x05 578 #define STIMULUS_FORWARDBUSY 0x06 579 #define STIMULUS_FORWARDNOANSWER 0x07 580 #define STIMULUS_DISPLAY 0x08 581 #define STIMULUS_LINE 0x09 582 #define STIMULUS_VOICEMAIL 0x0F 583 #define STIMULUS_AUTOANSWER 0x11 584 #define STIMULUS_SERVICEURL 0x14 585 #define STIMULUS_DND 0x3F 586 #define STIMULUS_CONFERENCE 0x7D 587 #define STIMULUS_CALLPARK 0x7E 588 #define STIMULUS_CALLPICKUP 0x7F 589 #define STIMULUS_NONE 0xFF 592 #define BT_REDIAL STIMULUS_REDIAL 593 #define BT_SPEEDDIAL STIMULUS_SPEEDDIAL 594 #define BT_HOLD STIMULUS_HOLD 595 #define BT_TRANSFER STIMULUS_TRANSFER 596 #define BT_FORWARDALL STIMULUS_FORWARDALL 597 #define BT_FORWARDBUSY STIMULUS_FORWARDBUSY 598 #define BT_FORWARDNOANSWER STIMULUS_FORWARDNOANSWER 599 #define BT_DISPLAY STIMULUS_DISPLAY 600 #define BT_LINE STIMULUS_LINE 601 #define BT_VOICEMAIL STIMULUS_VOICEMAIL 602 #define BT_AUTOANSWER STIMULUS_AUTOANSWER 603 #define BT_SERVICEURL STIMULUS_SERVICEURL 604 #define BT_DND STIMULUS_DND 605 #define BT_CONFERENCE STIMULUS_CONFERENCE 606 #define BT_CALLPARK STIMULUS_CALLPARK 607 #define BT_CALLPICKUP STIMULUS_CALLPICKUP 613 #define BT_CUST_LINESPEEDDIAL 0xB0 614 #define BT_CUST_LINE 0xB1 623 #define VERSION_RES_MESSAGE 0x0098 628 #define DISPLAYTEXT_MESSAGE 0x0099 633 #define CLEAR_NOTIFY_MESSAGE 0x0115 634 #define CLEAR_DISPLAY_MESSAGE 0x009A 639 #define CAPABILITIES_REQ_MESSAGE 0x009B 641 #define REGISTER_REJ_MESSAGE 0x009D 646 #define SERVER_RES_MESSAGE 0x009E 653 uint32_t serverListenPort[5];
654 uint32_t serverIpAddr[5];
657 #define RESET_MESSAGE 0x009F 662 #define KEEP_ALIVE_ACK_MESSAGE 0x0100 664 #define OPEN_RECEIVE_CHANNEL_MESSAGE 0x0105 675 #define CLOSE_RECEIVE_CHANNEL_MESSAGE 0x0106 682 #define SOFT_KEY_TEMPLATE_RES_MESSAGE 0x0108 684 char softKeyLabel[16];
688 #define BKSP_REQ_MESSAGE 0x0119 694 #define KEYDEF_ONHOOK 0 695 #define KEYDEF_CONNECTED 1 696 #define KEYDEF_ONHOLD 2 697 #define KEYDEF_RINGIN 3 698 #define KEYDEF_OFFHOOK 4 699 #define KEYDEF_CONNWITHTRANS 5 700 #define KEYDEF_DADFD 6 701 #define KEYDEF_CONNWITHCONF 7 702 #define KEYDEF_RINGOUT 8 703 #define KEYDEF_OFFHOOKWITHFEAT 9 704 #define KEYDEF_UNKNOWN 10 705 #define KEYDEF_SLAHOLD 11 706 #define KEYDEF_SLACONNECTEDNOTACTIVE 12 707 #define KEYDEF_RINGOUTWITHTRANS 13 709 #define SOFTKEY_NONE 0x00 710 #define SOFTKEY_REDIAL 0x01 711 #define SOFTKEY_NEWCALL 0x02 712 #define SOFTKEY_HOLD 0x03 713 #define SOFTKEY_TRNSFER 0x04 714 #define SOFTKEY_CFWDALL 0x05 715 #define SOFTKEY_CFWDBUSY 0x06 716 #define SOFTKEY_CFWDNOANSWER 0x07 717 #define SOFTKEY_BKSPC 0x08 718 #define SOFTKEY_ENDCALL 0x09 719 #define SOFTKEY_RESUME 0x0A 720 #define SOFTKEY_ANSWER 0x0B 721 #define SOFTKEY_INFO 0x0C 722 #define SOFTKEY_CONFRN 0x0D 723 #define SOFTKEY_PARK 0x0E 724 #define SOFTKEY_JOIN 0x0F 725 #define SOFTKEY_MEETME 0x10 726 #define SOFTKEY_PICKUP 0x11 727 #define SOFTKEY_GPICKUP 0x12 728 #define SOFTKEY_DND 0x13 729 #define SOFTKEY_IDIVERT 0x14 730 #define SOFTKEY_FORCEDIAL 0x15 732 #define KEYMASK_ALL 0xFFFFFFFF 733 #define KEYMASK_NONE (1 << 0) 734 #define KEYMASK_REDIAL (1 << 1) 735 #define KEYMASK_NEWCALL (1 << 2) 736 #define KEYMASK_HOLD (1 << 3) 737 #define KEYMASK_TRNSFER (1 << 4) 738 #define KEYMASK_CFWDALL (1 << 5) 739 #define KEYMASK_CFWDBUSY (1 << 6) 740 #define KEYMASK_CFWDNOANSWER (1 << 7) 741 #define KEYMASK_BKSPC (1 << 8) 742 #define KEYMASK_ENDCALL (1 << 9) 743 #define KEYMASK_RESUME (1 << 10) 744 #define KEYMASK_ANSWER (1 << 11) 745 #define KEYMASK_INFO (1 << 12) 746 #define KEYMASK_CONFRN (1 << 13) 747 #define KEYMASK_PARK (1 << 14) 748 #define KEYMASK_JOIN (1 << 15) 749 #define KEYMASK_MEETME (1 << 16) 750 #define KEYMASK_PICKUP (1 << 17) 751 #define KEYMASK_GPICKUP (1 << 18) 752 #define KEYMASK_DND (1 << 29) 753 #define KEYMASK_IDIVERT (1 << 20) 754 #define KEYMASK_FORCEDIAL (1 << 21) 760 #define OCTAL_REDIAL "\200\001" 761 #define OCTAL_NEWCALL "\200\002" 762 #define OCTAL_HOLD "\200\003" 763 #define OCTAL_TRANSFER "\200\004" 764 #define OCTAL_CFWDALL "\200\005" 765 #define OCTAL_CFWDBUSY "\200\006" 766 #define OCTAL_CFWDNOAN "\200\007" 767 #define OCTAL_BKSPC "\200\010" 768 #define OCTAL_ENDCALL "\200\011" 769 #define OCTAL_RESUME "\200\012" 770 #define OCTAL_ANSWER "\200\013" 771 #define OCTAL_INFO "\200\014" 772 #define OCTAL_CONFRN "\200\015" 773 #define OCTAL_PARK "\200\016" 774 #define OCTAL_JOIN "\200\017" 775 #define OCTAL_MEETME "\200\020" 776 #define OCTAL_PICKUP "\200\021" 777 #define OCTAL_GPICKUP "\200\022" 778 #define OCTAL_CUROPTS "\200\023" 779 #define OCTAL_OFFHOOK "\200\024" 780 #define OCTAL_ONHOOK "\200\025" 781 #define OCTAL_RINGOUT "\200\026" 782 #define OCTAL_FROM "\200\027" 783 #define OCTAL_CONNECTED "\200\030" 784 #define OCTAL_BUSY "\200\031" 785 #define OCTAL_LINEINUSE "\200\032" 786 #define OCTAL_CALLWAITING "\200\033" 787 #define OCTAL_CALLXFER "\200\034" 788 #define OCTAL_CALLPARK "\200\035" 789 #define OCTAL_CALLPROCEED "\200\036" 790 #define OCTAL_INUSEREMOTE "\200\037" 791 #define OCTAL_ENTRNUM "\200\040" 792 #define OCTAL_PARKAT "\200\041" 793 #define OCTAL_PRIMONLY "\200\042" 794 #define OCTAL_TMPFAIL "\200\043" 795 #define OCTAL_HAVEVMAIL "\200\044" 796 #define OCTAL_FWDEDTO "\200\045" 797 #define OCTAL_CANTCOMPCNF "\200\046" 798 #define OCTAL_NOCONFBRDG "\200\047" 799 #define OCTAL_NOPRIMARYCTL "\200\050" 800 #define OCTAL_INVALCONFPART "\200\051" 801 #define OCTAL_INCONFALREADY "\200\052" 802 #define OCTAL_NOPARTINFO "\200\053" 803 #define OCTAL_MAXPARTEXCEED "\200\054" 804 #define OCTAL_KEYNOTACTIVE "\200\055" 805 #define OCTAL_ERRNOLIC "\200\056" 806 #define OCTAL_ERRDBCFG "\200\057" 807 #define OCTAL_ERRDB "\200\060" 808 #define OCTAL_ERRPASSLMT "\200\061" 809 #define OCTAL_ERRUNK "\200\062" 810 #define OCTAL_ERRMISMATCH "\200\063" 811 #define OCTAL_CONFERENCE "\200\064" 812 #define OCTAL_PARKNO "\200\065" 813 #define OCTAL_PRIVATE "\200\066" 814 #define OCTAL_INSUFBANDW "\200\067" 815 #define OCTAL_UNKNUM "\200\070" 816 #define OCTAL_RMLSTC "\200\071" 817 #define OCTAL_VOICEMAIL "\200\072" 818 #define OCTAL_IMMDIV "\200\073" 819 #define OCTAL_INTRCPT "\200\074" 820 #define OCTAL_SETWTCH "\200\075" 821 #define OCTAL_TRNSFVM "\200\076" 822 #define OCTAL_DND "\200\077" 823 #define OCTAL_DIVALL "\200\100" 824 #define OCTAL_CALLBACK "\200\101" 825 #define OCTAL_NETCNGREROUT "\200\102" 826 #define OCTAL_BARGE "\200\103" 827 #define OCTAL_BARGEFAIL "\200\104" 828 #define OCTAL_BARGEEXIST "\200\105" 829 #define OCTAL_INCOMPATDEV "\200\106" 830 #define OCTAL_PARKNONUM "\200\107" 831 #define OCTAL_PARKREVERSION "\200\110" 832 #define OCTAL_SRVNOTACTIVE "\200\111" 833 #define OCTAL_HITRAFFIC "\200\112" 834 #define OCTAL_QRT "\200\113" 835 #define OCTAL_MCID "\200\114" 836 #define OCTAL_DIRTRFR "\200\115" 837 #define OCTAL_SELECT "\200\116" 838 #define OCTAL_CONFLIST "\200\117" 839 #define OCTAL_IDIVERT "\200\120" 840 #define OCTAL_CBARGE "\200\121" 841 #define OCTAL_CANTCOMPLXFER "\200\122" 842 #define OCTAL_CANTJOINCALLS "\200\123" 843 #define OCTAL_MCIDSUCCESS "\200\124" 844 #define OCTAL_NUMNOTCFG "\200\125" 845 #define OCTAL_SECERROR "\200\126" 846 #define OCTAL_VIDBANDWNA "\200\127" 847 #define OCTAL_VIDMODE "\200\130" 848 #define OCTAL_CALLDURTIMEOUT "\200\131" 849 #define OCTAL_HOLDDURTIMEOUT "\200\132" 850 #define OCTAL_OPICKUP "\200\133" 856 #define OCTAL_EXTXFERRESTRICT "\200\141" 860 #define OCTAL_MACADD "\200\145" 861 #define OCTAL_HOST "\200\146" 862 #define OCTAL_DOMAIN "\200\147" 863 #define OCTAL_IPADD "\200\150" 864 #define OCTAL_SUBMASK "\200\151" 865 #define OCTAL_TFTP1 "\200\152" 866 #define OCTAL_ROUTER1 "\200\153" 867 #define OCTAL_ROUTER2 "\200\154" 868 #define OCTAL_ROUTER3 "\200\155" 869 #define OCTAL_ROUTER4 "\200\156" 870 #define OCTAL_ROUTER5 "\200\157" 871 #define OCTAL_DNS1 "\200\160" 872 #define OCTAL_DNS2 "\200\161" 873 #define OCTAL_DNS3 "\200\162" 874 #define OCTAL_DNS4 "\200\163" 875 #define OCTAL_DNS5 "\200\164" 876 #define OCTAL_VLANOPID "\200\165" 877 #define OCTAL_VLANADID "\200\166" 878 #define OCTAL_CM1 "\200\167" 879 #define OCTAL_CM2 "\200\170" 880 #define OCTAL_CM3 "\200\171" 881 #define OCTAL_CM4 "\200\172" 882 #define OCTAL_CM5 "\200\173" 883 #define OCTAL_URLINFO "\200\174" 884 #define OCTAL_URLDIRS "\200\175" 885 #define OCTAL_URLMSGS "\200\176" 886 #define OCTAL_URLSRVS "\200\177" 1040 #define SOFT_KEY_SET_RES_MESSAGE 0x0109 1043 uint8_t softKeyTemplateIndex[16];
1044 uint16_t softKeyInfoIndex[16];
1055 #define SELECT_SOFT_KEYS_MESSAGE 0x0110 1063 #define CALL_STATE_MESSAGE 0x0111 1071 #define DISPLAY_PROMPT_STATUS_MESSAGE 0x0112 1074 char promptMessage[32];
1080 #define CLEAR_PROMPT_MESSAGE 0x0113 1086 #define DISPLAY_NOTIFY_MESSAGE 0x0114 1089 char displayMessage[100];
1092 #define ACTIVATE_CALL_PLANE_MESSAGE 0x0116 1097 #define DIALED_NUMBER_MESSAGE 0x011D 1099 char dialedNumber[24];
1104 #define MAX_SERVICEURL 256 1105 #define SERVICEURL_STAT_MESSAGE 0x012F 1109 char displayName[40];
1112 #define MAXCALLINFOSTR 256 1113 #define MAXDISPLAYNOTIFYSTR 32 1115 #define DISPLAY_PRINOTIFY_MESSAGE 0x0120 1122 #define CLEAR_PRINOTIFY_MESSAGE 0x0121 1127 #define CALL_INFO_MESSAGE_VARIABLE 0x014A 1140 #define DISPLAY_PRINOTIFY_MESSAGE_VARIABLE 0x0144 1147 #define DISPLAY_PROMPT_STATUS_MESSAGE_VARIABLE 0x0145 1236 static struct hostent *
hp;
1241 #define SKINNY_DEVICE_UNKNOWN -1 1242 #define SKINNY_DEVICE_NONE 0 1243 #define SKINNY_DEVICE_30SPPLUS 1 1244 #define SKINNY_DEVICE_12SPPLUS 2 1245 #define SKINNY_DEVICE_12SP 3 1246 #define SKINNY_DEVICE_12 4 1247 #define SKINNY_DEVICE_30VIP 5 1248 #define SKINNY_DEVICE_7910 6 1249 #define SKINNY_DEVICE_7960 7 1250 #define SKINNY_DEVICE_7940 8 1251 #define SKINNY_DEVICE_7935 9 1252 #define SKINNY_DEVICE_ATA186 12 1253 #define SKINNY_DEVICE_7941 115 1254 #define SKINNY_DEVICE_7971 119 1255 #define SKINNY_DEVICE_7914 124 1256 #define SKINNY_DEVICE_7985 302 1257 #define SKINNY_DEVICE_7911 307 1258 #define SKINNY_DEVICE_7961GE 308 1259 #define SKINNY_DEVICE_7941GE 309 1260 #define SKINNY_DEVICE_7931 348 1261 #define SKINNY_DEVICE_7921 365 1262 #define SKINNY_DEVICE_7906 369 1263 #define SKINNY_DEVICE_7962 404 1264 #define SKINNY_DEVICE_7937 431 1265 #define SKINNY_DEVICE_7942 434 1266 #define SKINNY_DEVICE_7945 435 1267 #define SKINNY_DEVICE_7965 436 1268 #define SKINNY_DEVICE_7975 437 1269 #define SKINNY_DEVICE_7905 20000 1270 #define SKINNY_DEVICE_7920 30002 1271 #define SKINNY_DEVICE_7970 30006 1272 #define SKINNY_DEVICE_7912 30007 1273 #define SKINNY_DEVICE_7902 30008 1274 #define SKINNY_DEVICE_CIPC 30016 1275 #define SKINNY_DEVICE_7961 30018 1276 #define SKINNY_DEVICE_7936 30019 1277 #define SKINNY_DEVICE_SCCPGATEWAY_AN 30027 1278 #define SKINNY_DEVICE_SCCPGATEWAY_BRI 30028 1280 #define SKINNY_SPEAKERON 1 1281 #define SKINNY_SPEAKEROFF 2 1283 #define SKINNY_MICON 1 1284 #define SKINNY_MICOFF 2 1286 #define SKINNY_OFFHOOK 1 1287 #define SKINNY_ONHOOK 2 1288 #define SKINNY_RINGOUT 3 1289 #define SKINNY_RINGIN 4 1290 #define SKINNY_CONNECTED 5 1291 #define SKINNY_BUSY 6 1292 #define SKINNY_CONGESTION 7 1293 #define SKINNY_HOLD 8 1294 #define SKINNY_CALLWAIT 9 1295 #define SKINNY_TRANSFER 10 1296 #define SKINNY_PARK 11 1297 #define SKINNY_PROGRESS 12 1298 #define SKINNY_CALLREMOTEMULTILINE 13 1299 #define SKINNY_INVALID 14 1301 #define SKINNY_INCOMING 1 1302 #define SKINNY_OUTGOING 2 1304 #define SKINNY_SILENCE 0x00 1305 #define SKINNY_DIALTONE 0x21 1306 #define SKINNY_BUSYTONE 0x23 1307 #define SKINNY_ALERT 0x24 1308 #define SKINNY_REORDER 0x25 1309 #define SKINNY_CALLWAITTONE 0x2D 1310 #define SKINNY_ZIPZIP 0x31 1311 #define SKINNY_ZIP 0x32 1312 #define SKINNY_BEEPBONK 0x33 1313 #define SKINNY_BARGIN 0x43 1314 #define SKINNY_NOTONE 0x7F 1316 #define SKINNY_LAMP_OFF 1 1317 #define SKINNY_LAMP_ON 2 1318 #define SKINNY_LAMP_WINK 3 1319 #define SKINNY_LAMP_FLASH 4 1320 #define SKINNY_LAMP_BLINK 5 1322 #define SKINNY_RING_OFF 1 1323 #define SKINNY_RING_INSIDE 2 1324 #define SKINNY_RING_OUTSIDE 3 1325 #define SKINNY_RING_FEATURE 4 1327 #define SKINNY_CFWD_ALL (1 << 0) 1328 #define SKINNY_CFWD_BUSY (1 << 1) 1329 #define SKINNY_CFWD_NOANSWER (1 << 2) 1332 #define SKINNY_CX_SENDONLY 0 1333 #define SKINNY_CX_RECVONLY 1 1334 #define SKINNY_CX_SENDRECV 2 1335 #define SKINNY_CX_CONF 3 1336 #define SKINNY_CX_CONFERENCE 3 1337 #define SKINNY_CX_MUTE 4 1338 #define SKINNY_CX_INACTIVE 4 1341 static const char *
const skinny_cxmodes[] = {
1371 #define SUBSTATE_UNSET 0 1372 #define SUBSTATE_OFFHOOK 1 1373 #define SUBSTATE_ONHOOK 2 1374 #define SUBSTATE_RINGOUT 3 1375 #define SUBSTATE_RINGIN 4 1376 #define SUBSTATE_CONNECTED 5 1377 #define SUBSTATE_BUSY 6 1378 #define SUBSTATE_CONGESTION 7 1379 #define SUBSTATE_HOLD 8 1380 #define SUBSTATE_CALLWAIT 9 1381 #define SUBSTATE_PROGRESS 12 1382 #define SUBSTATE_DIALING 101 1384 #define DIALTYPE_NORMAL 1<<0 1385 #define DIALTYPE_CFWD 1<<1 1386 #define DIALTYPE_XFER 1<<2 1420 #define SKINNY_LINE_OPTIONS \ 1423 char accountcode[AST_MAX_ACCOUNT_CODE]; \ 1424 char exten[AST_MAX_EXTENSION]; \ 1425 char context[AST_MAX_CONTEXT]; \ 1426 char language[MAX_LANGUAGE]; \ 1427 char cid_num[AST_MAX_EXTENSION]; \ 1428 char cid_name[AST_MAX_EXTENSION]; \ 1429 char lastcallerid[AST_MAX_EXTENSION]; \ 1431 char call_forward_all[AST_MAX_EXTENSION]; \ 1432 char call_forward_busy[AST_MAX_EXTENSION]; \ 1433 char call_forward_noanswer[AST_MAX_EXTENSION]; \ 1434 char mailbox[AST_MAX_MAILBOX_UNIQUEID]; \ 1435 char vmexten[AST_MAX_EXTENSION]; \ 1436 char regexten[AST_MAX_EXTENSION]; \ 1437 char regcontext[AST_MAX_CONTEXT]; \ 1438 char parkinglot[AST_MAX_CONTEXT]; \ 1439 char mohinterpret[MAX_MUSICCLASS]; \ 1440 char mohsuggest[MAX_MUSICCLASS]; \ 1441 char lastnumberdialed[AST_MAX_EXTENSION]; \ 1442 char dialoutexten[AST_MAX_EXTENSION]; \ 1443 char dialoutcontext[AST_MAX_CONTEXT]; \ 1444 ast_group_t callgroup; \ 1445 ast_group_t pickupgroup; \ 1446 struct ast_namedgroups *named_callgroups; \ 1447 struct ast_namedgroups *named_pickupgroups; \ 1450 int threewaycalling; \ 1452 int cancallforward; \ 1453 int callfwdtimeout; \ 1459 int nonCodecCapability; \ 1494 .callfwdtimeout = 20000,
1539 char displayName[40];
1544 #define SKINNY_DEVICECONTAINER 1 1545 #define SKINNY_LINECONTAINER 2 1546 #define SKINNY_SUBLINECONTAINER 3 1547 #define SKINNY_SDCONTAINER 4 1561 #define SKINNY_DEVICE_OPTIONS \ 1564 char version_id[16]; \ 1565 char vmexten[AST_MAX_EXTENSION]; \ 1567 int protocolversion; \ 1569 int lastlineinstance; \ 1570 int lastcallreference; \ 1583 struct sockaddr_in addr;
1584 struct in_addr ourip;
1616 struct timeval start;
1617 struct sockaddr_in sin;
1625 struct timeval last_keepalive;
1657 .description =
tdesc,
1741 for (i = 0; i < 4; i++)
1748 for (i = 0; i < 4; i++)
1749 (btn++)->buttonDefinition =
BT_NONE;
1750 for (i = 0; i < 13; i++)
1758 for (i = 0; i < 2; i++)
1760 for (i = 0; i < 4; i++)
1762 (btn++)->buttonDefinition =
BT_HOLD;
1770 (btn++)->buttonDefinition =
BT_LINE;
1771 (btn++)->buttonDefinition =
BT_HOLD;
1777 for (i = 0; i < 2; i++)
1786 for (i = 0; i < 6; i++)
1794 for (i = 0; i < 2; i++)
1799 for (i = 0; i < 2; i++)
1800 (btn++)->buttonDefinition =
BT_LINE;
1803 (btn++)->buttonDefinition =
BT_LINE;
1809 for (i = 0; i < 8; i++)
1819 (btn++)->buttonDefinition =
BT_LINE;
1820 (btn++)->buttonDefinition =
BT_HOLD;
1824 for (i = 0; i < 4; i++)
1828 for (i = 0; i < 6; i++)
1844 ast_log(
LOG_WARNING,
"Unsupported device type '%d (7914)' found. Expansion module registered by itself?\n", d->type);
1848 ast_log(
LOG_WARNING,
"Unsupported device type '%d (SCCP gateway)' found.\n", d->type);
1857 if (!strcasecmp(a->
type,
"7914")) {
1858 for (i = 0; i < 14; i++)
1877 req->
e =
htolel(response_message);
1893 if (l->instance == instance)
1898 ast_log(
LOG_WARNING,
"Could not find line with instance '%d' on device '%s'\n", instance, d->name);
1911 int checkdevice = 0;
1914 at = strchr(line,
'@');
1924 if (checkdevice && tmpl)
1926 else if (!checkdevice) {
1928 }
else if (!strcasecmp(d->name, device)) {
1935 if (!strcasecmp(l->name, line)) {
1960 if (!strcasecmp(subline->
name, dest)) {
1962 ast_verb(2,
"Ambiguous subline name: %s\n", dest);
1966 tmpsubline = subline;
1982 if (subline->
callid == callid) {
1998 if ((varval = strchr(varname,
'='))) {
2001 tmpvar->
next = list;
2010 if (sub && sub->
owner) {
2017 if (sub && sub->
owner) {
2055 if (sub->
callid == reference)
2060 ast_log(
LOG_WARNING,
"Could not find subchannel with reference '%d' on '%s'\n", reference, d->name);
2073 if (sub->
callid == reference)
2081 ast_log(
LOG_WARNING,
"Could not find any lines that contained a subchannel with reference '%d' on device '%s'\n", reference, d->name);
2084 ast_log(
LOG_WARNING,
"Could not find subchannel with reference '%d' on '%s@%s'\n", reference, l->name, d->name);
2100 ast_log(
LOG_WARNING,
"Could not find speeddial with instance '%d' on device '%s'\n", instance, d->name);
2107 switch (skinnycodec) {
2160 ast_copy_string(l->call_forward_all, cfwd,
sizeof(l->call_forward_all));
2164 ast_copy_string(l->call_forward_busy, cfwd,
sizeof(l->call_forward_busy));
2168 ast_copy_string(l->call_forward_noanswer, cfwd,
sizeof(l->call_forward_noanswer));
2172 l->cfwdtype &= ~SKINNY_CFWD_ALL;
2173 memset(l->call_forward_all, 0,
sizeof(l->call_forward_all));
2176 l->cfwdtype &= ~SKINNY_CFWD_BUSY;
2177 memset(l->call_forward_busy, 0,
sizeof(l->call_forward_busy));
2180 l->cfwdtype &= ~SKINNY_CFWD_NOANSWER;
2181 memset(l->call_forward_noanswer, 0,
sizeof(l->call_forward_noanswer));
2189 char *oldcontext, *newcontext, *stalecontext, *stringp, newlist[
AST_MAX_CONTEXT];
2191 while ((oldcontext =
strsep(&old,
"&"))) {
2192 stalecontext =
NULL;
2195 while ((newcontext =
strsep(&stringp,
"&"))) {
2196 if (strcmp(newcontext, oldcontext) == 0) {
2198 stalecontext =
NULL;
2200 }
else if (strcmp(newcontext, oldcontext)) {
2201 stalecontext = oldcontext;
2219 while ((ext =
strsep(&stringp,
"&"))) {
2220 if ((context = strchr(ext,
'@'))) {
2223 ast_log(
LOG_WARNING,
"Context %s must exist in regcontext= in skinny.conf!\n", context);
2244 while ((ext =
strsep(&stringp,
"&"))) {
2245 if ((context = strchr(ext,
'@'))) {
2248 ast_log(
LOG_WARNING,
"Context %s must exist in regcontext= in skinny.conf!\n", context);
2264 struct sockaddr_in sin;
2297 if (getsockname(s->
fd, (
struct sockaddr *)&sin, &slen)) {
2301 d->
ourip = sin.sin_addr;
2313 l->instance = instance;
2326 blob =
ast_json_pack(
"{s: s}",
"peer_status",
"Registered");
2338 pthread_cancel(s->
t);
2348 return "SKINNY_OFFHOOK";
2350 return "SKINNY_ONHOOK";
2352 return "SKINNY_RINGOUT";
2354 return "SKINNY_RINGIN";
2356 return "SKINNY_CONNECTED";
2358 return "SKINNY_BUSY";
2360 return "SKINNY_CONGESTION";
2362 return "SKINNY_PROGRESS";
2364 return "SKINNY_HOLD";
2366 return "SKINNY_CALLWAIT";
2466 char *fromname,
char *fromnum,
char *toname,
char *tonum,
int calldirection,
char *origtonum,
char *origtoname)
2488 SKINNY_DEBUG(
DEBUG_PACKET, 3,
"Transmitting CALL_INFO_MESSAGE to %s, to %s(%s) from %s(%s), origto %s(%s) (dir=%d) on %s(%d)\n",
2489 d->name, toname, tonum, fromname, fromnum, origtoname, origtonum, calldirection, d->name, instance);
2494 char *fromname,
char *fromnum,
char *toname,
char *tonum,
int calldirection,
char *origtonum,
char *origtoname)
2498 char *thestrings[13];
2515 thestrings[0] = fromnum;
2518 thestrings[2] = tonum;
2519 thestrings[3] = origtonum;
2530 thestrings[9] = fromname;
2531 thestrings[10] = toname;
2532 thestrings[11] = origtoname;
2533 thestrings[12] =
"";
2537 for(i = 0; i < 13; i++) {
2538 if (thestrings[i]) {
2540 strptr += strlen(thestrings[i]) + 1;
2541 callinfostrleft -= strlen(thestrings[i]) + 1;
2549 req->
len = req->
len - (callinfostrleft & ~0x3);
2551 SKINNY_DEBUG(
DEBUG_PACKET, 3,
"Transmitting CALL_INFO_MESSAGE_VARIABLE to %s, to %s(%s) from %s(%s), origto %s(%s) (dir=%d) on %s(%d)\n",
2552 d->name, toname, tonum, fromname, fromnum, origtoname, origtonum, calldirection, d->name, instance);
2592 ast_verb(1,
"Error sending Callinfo to %s(%d) - No call direction in sub\n", d->name, l->instance);
2596 if (d->protocolversion < 17) {
2639 ast_verb(1,
"Error sending Callinfo to %s(%d) - No call direction in sub\n", d->name, l->instance);
2643 if (d->protocolversion < 17) {
2655 unsigned int framing;
2670 SKINNY_DEBUG(
DEBUG_PACKET, 3,
"Transmitting OPEN_RECEIVE_CHANNEL_MESSAGE to %s, confid %u, partyid %u, ms %u, fmt %d, echo %d, brate %d\n",
2688 d->name, tone, instance, reference);
2701 d->name, instance, reference);
2711 for(x = 0; x <
ARRAY_LEN(soft_key_default_definitions); x++) {
2712 if (softkeymode[x].
mode == keyset) {
2715 for (y = 0; y < softkeymode[x].
count; y++) {
2716 if (intmask & (1 << (defaults[y]))) {
2717 extmask |= (1 << ((y)));
2741 SKINNY_DEBUG(
DEBUG_PACKET, 3,
"Transmitting SELECT_SOFT_KEYS_MESSAGE to %s, inst %d, callid %d, softkey %d, mask 0x%08x\n",
2742 d->name, instance, callid, softkey, (
unsigned)newmask);
2758 d->name, stimulus, instance, indication);
2857 if ((
char)*text ==
'\200') {
2858 int octalstrlen = strlen(text);
2861 SKINNY_DEBUG(
DEBUG_PACKET, 3,
"Transmitting DISPLAY_PRINOTIFY_MESSAGE to %s, '\\%03o\\%03o', '%s', timeout=%d, priority=%d\n",
2862 d->name, (
unsigned)*text, (
unsigned)*(text+1), extratext, timeout, priority);
2866 d->name, text, timeout, priority);
2883 if ((
char)*text ==
'\200') {
2884 int octalstrlen = strlen(text);
2888 SKINNY_DEBUG(
DEBUG_PACKET, 3,
"Transmitting DISPLAY_PRINOTIFY_MESSAGE_VARIABLE to %s, '\\%03o\\%03o', '%s', timeout=%d, priority=%d\n",
2889 d->name, (
unsigned)*text, (
unsigned)*(text+1), extratext, timeout, priority);
2893 SKINNY_DEBUG(
DEBUG_PACKET, 3,
"Transmitting DISPLAY_PRINOTIFY_MESSAGE_VARIABLE to %s, '%s', timeout=%d, priority=%d\n",
2894 d->name, text, timeout, priority);
2897 req->
len = (packetlen & ~0x3) + 4;
2904 if (d->protocolversion < 17) {
2922 if ((
char)*text ==
'\200') {
2923 int octalstrlen = strlen(text);
2927 d->name, (
unsigned)*text, (
unsigned)*(text+1), extratext);
2947 if ((
char)*text ==
'\200') {
2948 int octalstrlen = strlen(text);
2953 d->name, (
unsigned)*text, (
unsigned)*(text+1), extratext);
2960 req->
len = (packetlen & ~0x3) + 4;
2967 if (d->protocolversion < 17) {
2985 d->name, instance, callid);
3001 d->name, text, instance, callid);
3016 d->name, 0, sub->
callid);
3030 SKINNY_DEBUG(
DEBUG_PACKET, 3,
"Transmitting STOP_MEDIA_TRANSMISSION_MESSAGE to %s, confid %d, passthrupartyid %u\n",
3031 d->name, 0, sub->
callid);
3040 if (d->protocolversion < 17) {
3068 SKINNY_DEBUG(
DEBUG_PACKET, 3,
"Transmitting START_MEDIA_TRANSMISSION_MESSAGE to %s, callid %u, passthrupartyid %u, ip %s:%d, ms %u, fmt %d, prec 127\n",
3083 d->name, l->instance);
3144 SKINNY_DEBUG(
DEBUG_PACKET, 3,
"Transmitting FORWARD_STAT_MESSAGE to %s, inst %d, all %s, busy %s, noans %s, acitve %d\n",
3145 d->name, l->instance, l->call_forward_all, l->call_forward_busy, l->call_forward_noanswer, anyon ? 7 : 0);
3210 SKINNY_DEBUG(
DEBUG_PACKET, 3,
"Transmitting DEFINETIMEDATE_MESSAGE to %s, date %u %u %u dow %u time %u:%u:%u.%u\n",
3258 keydefcount =
ARRAY_LEN(soft_key_default_definitions);
3262 for (x = 0; x < keydefcount; x++) {
3266 for (y = 0; y < softkeymode->
count; y++) {
3268 if (defaults[y] == i+1) {
3295 soft_key_template_default,
3296 sizeof(soft_key_template_default));
3298 SKINNY_DEBUG(
DEBUG_PACKET, 3,
"Transmitting SOFT_KEY_TEMPLATE_RES_MESSAGE to %s, offset 0, keycnt %u, totalkeycnt %u, template data\n",
3316 d->name, (fullrestart) ?
"Restarting" :
"Resetting");
3355 SKINNY_DEBUG(
DEBUG_PACKET, 3,
"Transmitting REGISTER_ACK_MESSAGE to %s, keepalive %d, datetemplate %s, seckeepalive %d, res 0x%04x, res2 0x%08x\n",
3385 d->name, instance, callid);
3479 if (subline->
callid == 0) {
3588 ast_verb(3,
"Skinny mwi_event_cb found %d new messages\n", l->
newmsgs);
3602 *instance = sub->
vrtp;
3626 *instance = sub->
rtp;
3630 if (!l->directmedia || l->nat){
3646 struct sockaddr_in us = { 0, };
3647 struct sockaddr_in them = { 0, };
3665 unsigned int framing;
3679 if (!(l->directmedia) || (l->nat)){
3682 us.sin_addr.s_addr = us.sin_addr.s_addr ? us.sin_addr.s_addr : d->
ourip.s_addr;
3712 strcpy(ptr,
"general ");
3717 strcpy(ptr,
"sub ");
3722 strcpy(ptr,
"audio ");
3727 strcpy(ptr,
"packet ");
3732 strcpy(ptr,
"lock ");
3737 strcpy(ptr,
"template ");
3742 strcpy(ptr,
"thread ");
3747 strcpy(ptr,
"hint ");
3752 strcpy(ptr,
"keepalive ");
3757 strncpy(--ptr,
"\0", 1);
3764 const char *debugOpts[]={
"all",
"audio",
"hint",
"keepalive",
"lock",
"off",
"packet",
"show",
"sub",
"template",
"thread",
NULL };
3765 char *wordptr = (
char *)word;
3768 int buflen =
sizeof(
buf);
3773 if (*word ==
'+' || *word ==
'-' || *word ==
'!') {
3779 wordlen = strlen(wordptr);
3781 while (debugOpts[i]) {
3782 if (!strncasecmp(wordptr, debugOpts[i], wordlen) && ++which > state) {
3804 "Usage: skinny debug {audio|hint|keepalive|lock|off|packet|show|sub|template|thread}\n" 3805 " Enables/Disables various Skinny debugging messages\n";
3815 if (a->
argc == 3 && !strncasecmp(a->
argv[e->
args-1],
"show", 4)) {
3820 for(i = e->
args; i < a->argc; i++) {
3824 if (!strncasecmp(arg,
"off", 3)) {
3829 if (!strncasecmp(arg,
"all", 3)) {
3834 if (!strncasecmp(arg,
"-", 1) || !strncasecmp(arg,
"!", 1)) {
3837 }
else if (!strncasecmp(arg,
"+", 1)) {
3844 if (!strncasecmp(arg,
"general", 7)) {
3846 }
else if (!strncasecmp(arg,
"sub", 3)) {
3848 }
else if (!strncasecmp(arg,
"packet", 6)) {
3850 }
else if (!strncasecmp(arg,
"audio", 5)) {
3852 }
else if (!strncasecmp(arg,
"lock", 4)) {
3854 }
else if (!strncasecmp(arg,
"template", 8)) {
3856 }
else if (!strncasecmp(arg,
"thread", 6)) {
3858 }
else if (!strncasecmp(arg,
"hint", 4)) {
3860 }
else if (!strncasecmp(arg,
"keepalive", 9)) {
3863 ast_cli(a->
fd,
"Skinny Debugging - option '%s' unknown\n", a->
argv[i]);
3889 "Usage: skinny reload\n" 3890 " Reloads the chan_skinny configuration\n";
3907 int wordlen = strlen(word), which = 0;
3910 if (!strncasecmp(word, d->name, wordlen) && ++which > state) {
3926 static const char *
const completions[] = {
"all",
NULL };
3932 }
else if (pos == 3) {
3933 static const char *
const completions[] = {
"restart",
NULL };
3945 int wordlen = strlen(word), which = 0;
3949 if (!strncasecmp(word, l->name, wordlen) && ++which > state) {
3954 }
else if (pos == 4) {
3955 static const char *
const completions[] = {
"on",
NULL };
3957 }
else if (pos == 5) {
3972 "Usage: skinny reset <DeviceId|DeviceName|all> [restart]\n" 3973 " Causes a Skinny device to reset itself, optionally with a full restart\n";
3985 if (!strcasecmp(a->
argv[2], d->id) || !strcasecmp(a->
argv[2], d->name) || !strcasecmp(a->
argv[2],
"all")) {
3989 if (a->
argc == 4 && !strcasecmp(a->
argv[3],
"restart"))
4069 return "IP Communicator";
4075 return "SCCPGATEWAY_AN";
4077 return "SCCPGATEWAY_BRI";
4093 char idtext[256] =
"";
4094 int total_devices = 0;
4099 snprintf(idtext,
sizeof(idtext),
"ActionID: %s\r\n",
id);
4110 ast_cli(fd,
"Name DeviceId IP Type R NL\n");
4111 ast_cli(fd,
"-------------------- ---------------- --------------- --------------- - --\n");
4122 ast_cli(fd,
"%-20s %-16s %-15s %-15s %c %2d\n",
4131 "Event: DeviceEntry\r\n%s" 4132 "Channeltype: SKINNY\r\n" 4133 "ObjectName: %s\r\n" 4134 "ChannelObjectType: device\r\n" 4138 "Devicestatus: %s\r\n" 4139 "NumberOfLines: %d\r\n",
4145 d->
session?
"registered":
"unregistered",
4152 *total = total_devices;
4161 const char *
a[] = {
"skinny",
"show",
"devices"};
4180 e->
command =
"skinny show devices";
4182 "Usage: skinny show devices\n" 4183 " Lists all devices known to the Skinny subsystem.\n";
4207 if (!strcasecmp(argv[3], d->id) || !strcasecmp(argv[3], d->name)) {
4208 int numlines = 0, numaddons = 0, numspeeddials = 0, numserviceurls = 0;
4227 ast_cli(fd,
"Name: %s\n", d->name);
4228 ast_cli(fd,
"Id: %s\n", d->id);
4229 ast_cli(fd,
"version: %s\n",
S_OR(d->version_id,
"Unknown"));
4236 ast_cli(fd,
"Lines: %d\n", numlines);
4238 ast_cli(fd,
" %s (%s)\n", l->name, l->label);
4240 ast_cli(fd,
"Addons: %d\n", numaddons);
4244 ast_cli(fd,
"Speeddials: %d\n", numspeeddials);
4248 ast_cli(fd,
"ServiceURLs: %d\n", numserviceurls);
4272 astman_append(s,
"NumberOfSpeeddials: %d\r\n", numspeeddials);
4312 e->
command =
"skinny show device";
4314 "Usage: skinny show device <DeviceId|DeviceName>\n" 4315 " Lists all deviceinformation of a specific device known to the Skinny subsystem.\n";
4328 int total_lines = 0;
4331 char idtext[256] =
"";
4336 snprintf(idtext,
sizeof(idtext),
"ActionID: %s\r\n",
id);
4351 ast_cli(fd,
"Name Device Name Instance Label \n");
4352 ast_cli(fd,
"-------------------- -------------------- -------- --------------------\n");
4358 ast_cli(fd,
"%-20s %-20s %8d %-20s\n",
4367 ast_cli(fd,
" %s> %s to %s\n",
4368 (sub == l->
activesub?
"Active ":
"Inactive"),
4376 "Event: LineEntry\r\n%s" 4377 "Channeltype: SKINNY\r\n" 4378 "ObjectName: %s\r\n" 4379 "ChannelObjectType: line\r\n" 4393 *total = total_lines;
4403 const char *
a[] = {
"skinny",
"show",
"lines"};
4421 e->
command =
"skinny show lines [verbose]";
4423 "Usage: skinny show lines\n" 4424 " Lists all lines known to the Skinny subsystem.\n" 4425 " If 'verbose' is specified, the output includes\n" 4426 " information about subs for each line.\n";
4433 if (strcasecmp(a->
argv[e->
args-1],
"verbose")) {
4436 }
else if (a->
argc != e->
args - 1) {
4449 char group_buf[256];
4465 if (argc == 6 && (strcasecmp(argv[5], d->id) && strcasecmp(argv[5], d->name))) {
4471 if (strcasecmp(argv[3], l->name)) {
4475 ast_cli(fd,
"Line: %s\n", l->name);
4476 ast_cli(fd,
"On Device: %s\n", d->name);
4477 ast_cli(fd,
"Line Label: %s\n", l->label);
4478 ast_cli(fd,
"Extension: %s\n",
S_OR(l->exten,
"<not set>"));
4479 ast_cli(fd,
"Context: %s\n", l->context);
4486 ast_cli(fd,
"Language: %s\n",
S_OR(l->language,
"<not set>"));
4487 ast_cli(fd,
"Accountcode: %s\n",
S_OR(l->accountcode,
"<not set>"));
4489 ast_cli(fd,
"CallerId Number: %s\n",
S_OR(l->cid_num,
"<not set>"));
4490 ast_cli(fd,
"CallerId Name: %s\n",
S_OR(l->cid_name,
"<not set>"));
4491 ast_cli(fd,
"Hide CallerId: %s\n", (l->hidecallerid ?
"Yes" :
"No"));
4495 ast_cli(fd,
"CFwdTimeout: %dms\n", l->callfwdtimeout);
4496 ast_cli(fd,
"VoicemailBox: %s\n",
S_OR(l->mailbox,
"<not set>"));
4497 ast_cli(fd,
"VoicemailNumber: %s\n",
S_OR(l->vmexten,
"<not set>"));
4498 ast_cli(fd,
"MWIblink: %d\n", l->mwiblink);
4499 ast_cli(fd,
"Regextension: %s\n",
S_OR(l->regexten,
"<not set>"));
4500 ast_cli(fd,
"Regcontext: %s\n",
S_OR(l->regcontext,
"<not set>"));
4501 ast_cli(fd,
"MoHInterpret: %s\n",
S_OR(l->mohinterpret,
"<not set>"));
4502 ast_cli(fd,
"MoHSuggest: %s\n",
S_OR(l->mohsuggest,
"<not set>"));
4503 ast_cli(fd,
"Last dialed nr: %s\n",
S_OR(l->lastnumberdialed,
"<no calls made yet>"));
4504 ast_cli(fd,
"Last CallerID: %s\n",
S_OR(l->lastcallerid,
"<not set>"));
4505 ast_cli(fd,
"Transfer enabled: %s\n", (l->transfer ?
"Yes" :
"No"));
4506 ast_cli(fd,
"Callwaiting: %s\n", (l->callwaiting ?
"Yes" :
"No"));
4507 ast_cli(fd,
"3Way Calling: %s\n", (l->threewaycalling ?
"Yes" :
"No"));
4508 ast_cli(fd,
"Can forward: %s\n", (l->cancallforward ?
"Yes" :
"No"));
4509 ast_cli(fd,
"Do Not Disturb: %s\n", (l->dnd ?
"Yes" :
"No"));
4510 ast_cli(fd,
"NAT: %s\n", (l->nat ?
"Yes" :
"No"));
4511 ast_cli(fd,
"immediate: %s\n", (l->immediate ?
"Yes" :
"No"));
4512 ast_cli(fd,
"Group: %d\n", l->group);
4513 ast_cli(fd,
"Parkinglot: %s\n",
S_OR(l->parkinglot,
"<not set>"));
4541 astman_append(s,
"HideCallerId: %s\r\n", (l->hidecallerid ?
"Yes" :
"No"));
4552 astman_append(s,
"LastDialedNr: %s\r\n",
S_OR(l->lastnumberdialed,
"<no calls made yet>"));
4554 astman_append(s,
"Transfer: %s\r\n", (l->transfer ?
"Yes" :
"No"));
4555 astman_append(s,
"Callwaiting: %s\r\n", (l->callwaiting ?
"Yes" :
"No"));
4556 astman_append(s,
"3WayCalling: %s\r\n", (l->threewaycalling ?
"Yes" :
"No"));
4557 astman_append(s,
"CanForward: %s\r\n", (l->cancallforward ?
"Yes" :
"No"));
4558 astman_append(s,
"DoNotDisturb: %s\r\n", (l->dnd ?
"Yes" :
"No"));
4560 astman_append(s,
"immediate: %s\r\n", (l->immediate ?
"Yes" :
"No"));
4598 e->
command =
"skinny show line";
4600 "Usage: skinny show line <Line> [on <DeviceID|DeviceName>]\n" 4601 " List all lineinformation of a specific line known to the Skinny subsystem.\n";
4617 e->
command =
"skinny show settings";
4619 "Usage: skinny show settings\n" 4620 " Lists all global configuration settings of the Skinny subsystem.\n";
4636 ast_cli(a->
fd,
" Immed. Dial Key: %s\n",
S_OR(immed_str,
"(not set)"));
4663 if (!strcasecmp(argv[3], d->name)) {
4665 char *strp = text_buf;
4666 int charleft =
sizeof(text_buf);
4670 charleft -= strlen(strp);
4671 strp += strlen(strp);
4672 for(i=7; i<argc; i++) {
4675 charleft -= strlen(strp);
4676 strp += strlen(strp);
4690 e->
command =
"skinny message set";
4692 "Usage: skinny message set <device> <priority> <timeout> <message>\n" 4693 " Set the current priority level message on a device.\n";
4712 if (!strcasecmp(argv[3], d->name)) {
4726 e->
command =
"skinny message clear";
4728 "Usage: skinny message clear <device> <priority>\n" 4729 " Clear the current priority level message on device.\n";
4784 if (hasvideo && sub->
vrtp && sub->
owner) {
4833 l->hidecallerid ?
"" : l->cid_num,
4834 l->hidecallerid ?
"" : l->cid_name,
4913 ast_channel_call_forward_set(sub->
owner, l->call_forward_noanswer);
4925 int doautoanswer = 0;
4952 if (!(strcmp(
ast_var_name(current),
"SKINNY_AUTOANSWER"))) {
4956 char *stringp =
buf, *curstr;
4958 curstr =
strsep(&stringp,
":");
4959 aatime = atoi(curstr);
4960 while ((curstr =
strsep(&stringp,
":"))) {
4961 if (!(strcasecmp(curstr,
"BEEP"))) {
4963 }
else if (!(strcasecmp(curstr,
"MUTE"))) {
4992 ast_debug(1,
"Asked to hangup channel not connected\n");
5105 ast_log(
LOG_WARNING,
"Asked to transmit frame type %s, while native formats is %s (read/write = %s/%s)\n",
5127 if (sub->
owner != oldchan) {
5148 sprintf(tmp,
"%d", digit);
5188 return "Other end has hungup";
5190 return "Local ring";
5192 return "Remote end is ringing";
5194 return "Remote end has answered";
5196 return "Remote end is busy";
5198 return "Make it go off hook";
5200 return "Line is off hook";
5202 return "Congestion (circuits busy)";
5204 return "Flash hook";
5208 return "Set a low-level option";
5212 return "Un-Key Radio";
5214 return "Remote end is making Progress";
5216 return "Remote end is proceeding";
5224 return "Media Source Update";
5228 return "Connected Line";
5230 return "Redirecting";
5232 return "T38_Parameters";
5234 return "CC Not Possible";
5236 return "Media Source Change";
5238 return "Incomplete";
5314 return (d->earlyrtp ? -1 : 0);
5317 return (d->earlyrtp ? -1 : 0);
5322 return (d->earlyrtp ? -1 : 0);
5325 return (d->earlyrtp ? -1 : 0);
5393 tmp =
ast_channel_alloc(1, state, l->cid_num, l->cid_name, l->accountcode, l->exten, l->context, assignedids, requestor, l->amaflags,
"Skinny/%s@%s-%d", l->name, d->name,
callnums);
5409 d->lastlineinstance = l->instance;
5410 d->lastcallreference = sub->
callid;
5461 ast_channel_language_set(tmp, l->language);
5463 ast_channel_accountcode_set(tmp, l->accountcode);
5465 ast_channel_parkinglot_set(tmp, l->parkinglot);
5478 ast_channel_call_forward_set(tmp, l->call_forward_all);
5481 ast_channel_call_forward_set(tmp, l->call_forward_busy);
5529 return "SUBSTATE_UNSET";
5531 return "SUBSTATE_OFFHOOK";
5533 return "SUBSTATE_ONHOOK";
5535 return "SUBSTATE_RINGOUT";
5537 return "SUBSTATE_RINGIN";
5539 return "SUBSTATE_CONNECTED";
5541 return "SUBSTATE_BUSY";
5543 return "SUBSTATE_CONGESTION";
5545 return "SUBSTATE_PROGRESS";
5547 return "SUBSTATE_HOLD";
5549 return "SUBSTATE_CALLWAIT";
5551 return "SUBSTATE_DIALING";
5568 int actualstate =
state;
5592 SKINNY_DEBUG(
DEBUG_SUB, 3,
"Sub %u - trying to change state from %s to %s, but already forwarded because no answer.\n",
5613 const char *slastation;
5616 ast_verb(3,
"Connecting %s to subline\n", slastation);
5619 if (!strcasecmp(tmpsubline->
stname, slastation)) {
5620 subline = tmpsubline;
5632 if (!(subline == tmpsubline)) {
5633 if (!strcasecmp(subline->
lnname, tmpsubline->
lnname)) {
5650 switch (actualstate) {
5716 ast_log(
LOG_WARNING,
"Substate handling under subline for state %d not implemented on Sub-%u\n", state, sub->
callid);
5732 if (actualstate == sub->
substate) {
5737 switch (actualstate) {
5863 fromnum =
"Unknown";
6027 activate_sub = tsub;
6036 activate_sub = tsub;
6117 ast_verbose(
"Transfer: No subchannel to transfer\n");
6170 if (!sub && (l->cfwdtype & cfwdtype)) {
6178 if (!sub || !sub->
owner) {
6204 long keepalive_diff;
6207 "Keep_alive %d on %s, %.3fs %s\n",
6210 (
float) labs(keepalive_diff) / 1000,
6211 (keepalive_diff > 0 ?
"late" :
"early"));
6236 if (lineInstance && callReference) {
6249 }
else if (digit == 15) {
6251 }
else if (digit >= 0 && digit <= 9) {
6269 len = strlen(sub->
exten);
6276 sub->
exten[len + 1] =
'\0';
6350 d->name, instance, callreference);
6353 ast_log(
LOG_WARNING,
"Attempted redial, but no previously dialed number found. Ignoring button.\n");
6371 d->name, instance, callreference);
6377 if (!sub || !sub->
owner)
6392 d->name, instance, callreference);
6397 d->name, instance, callreference);
6405 d->name, instance, callreference);
6410 d->name, instance, callreference);
6412 if (!sub || !sub->
owner) {
6433 d->name, instance, callreference);
6446 if (!bridge_channel) {
6452 static const char msg_prefix[] =
"Call Parked at: ";
6453 char message[
sizeof(msg_prefix) +
sizeof(extout)];
6455 snprintf(message,
sizeof(message),
"%s%s", msg_prefix, extout);
6467 d->name, instance, callreference);
6471 ast_verb(3,
"Disabling DND on %s@%s\n", l->name, d->name);
6476 ast_verb(3,
"Enabling DND on %s@%s\n", l->name, d->name);
6484 d->name, instance, callreference);
6489 d->name, instance, callreference);
6494 d->name, instance, callreference);
6500 d->name, instance, callreference);
6504 d->name, instance, callreference);
6524 if (sub && sub->
owner) {
6538 event, d->name, instance, callreference);
6559 ast_verb(3,
"Got offhook message when device (%s) already offhook\n", d->name);
6595 if (sub && sub->
owner) {
6620 if (instance && reference) {
6682 for (i = 0; i < count; i++) {
6711 int lineInstance = 1;
6712 int speeddialInstance = 1;
6713 int serviceurlInstance = 1;
6714 int buttonCount = 0;
6721 memset(&btn, 0,
sizeof(btn));
6724 for (i=0; i<42; i++) {
6733 if (l->instance == lineInstance) {
6764 if (l->instance == lineInstance) {
6789 speeddialInstance++;
6799 if (surl->
instance == serviceurlInstance) {
6803 serviceurlInstance++;
6816 if (l->instance == lineInstance) {
6836 speeddialInstance++;
6870 struct sockaddr_in sin = { 0, };
6871 struct sockaddr_in us = { 0, };
6879 unsigned int framing;
6890 if (d->protocolversion<17) {
6900 sin.sin_family = AF_INET;
6901 sin.sin_addr.s_addr = addr;
6902 sin.sin_port = htons(port);
6904 SKINNY_DEBUG(
DEBUG_PACKET, 3,
"Received OPEN_RECEIVE_CHANNEL_ACK_MESSAGE from %s, status %d, callid %d, ip %s:%d\n",
6905 d->name, status, callid,
ast_inet_ntoa(sin.sin_addr), port);
6910 ast_log(
LOG_ERROR,
"Open Receive Channel Failure - can't find sub for %d\n", callid);
6921 us.sin_addr.s_addr = us.sin_addr.s_addr ? us.sin_addr.s_addr : d->
ourip.s_addr;
6990 if (callreference) {
7000 ast_log(
LOG_WARNING,
"Received Softkey Event: %d(%d/%d) but can't find line\n", event, instance, callreference);
7009 d->name, instance, callreference);
7013 d->name, instance, callreference);
7016 ast_log(
LOG_WARNING,
"Attempted redial, but no previously dialed number found. Ignoring button.\n");
7020 if (!sub || !sub->
owner) {
7035 d->name, instance, callreference);
7049 d->name, instance, callreference);
7063 d->name, instance, callreference);
7072 d->name, instance, callreference);
7076 ast_verb(3,
"Disabling DND on %s@%s\n", l->name, d->name);
7081 ast_verb(3,
"Enabling DND on %s@%s\n", l->name, d->name);
7089 d->name, instance, callreference);
7094 d->name, instance, callreference);
7099 d->name, instance, callreference);
7104 d->name, instance, callreference);
7108 len = strlen(sub->
exten);
7110 sub->
exten[len-1] =
'\0';
7122 d->name, instance, callreference);
7143 d->name, instance, callreference);
7161 d->name, instance, callreference);
7176 d->name, instance, callreference);
7180 d->name, instance, callreference);
7188 d->name, instance, callreference);
7201 if (!bridge_channel) {
7207 static const char msg_prefix[] =
"Call Parked at: ";
7208 char message[
sizeof(msg_prefix) +
sizeof(extout)];
7210 snprintf(message,
sizeof(message),
"%s%s", msg_prefix, extout);
7222 d->name, instance, callreference);
7239 d->name, instance, callreference);
7243 d->name, instance, callreference);
7247 d->name, instance, callreference);
7248 if (!sub || !sub->
owner) {
7260 if (sub->
owner == c) {
7272 d->name, instance, callreference);
7278 event, d->name, instance, callreference);
7314 ast_verb(3,
"Device '%s' successfully registered (protoVers %d)\n", s->
device->name, s->
device->protocolversion);
7442 pthread_detach(s->
t);
7507 blob =
ast_json_pack(
"{s: s}",
"peer_status",
"Unregistered");
7518 #define PACKET_TIMEOUT 10000 7528 int eventmessage = 0;
7529 struct pollfd fds[1];
7550 fds[0].events = POLLIN;
7554 if (
errno != EINTR) {
7561 if (!fds[0].revents) {
7583 eventmessage =
letohl(req->
e);
7584 if (eventmessage < 0) {
7599 ast_debug(1,
"Read header: Message ID: 0x%04x, %d bytes in packet\n", eventmessage, dlen);
7602 while (bytesread < dlen) {
7608 ast_debug(1,
"Poll timed out waiting for %d bytes\n", dlen - bytesread);
7611 dlen - bytesread, strerror(
errno));
7618 if (!fds[0].revents) {
7622 res = read(s->
fd, ((
char*)&req->
data)+bytesread, dlen-bytesread);
7628 ast_debug(1,
"Read %d bytes. %d of %d now read\n", res, bytesread, dlen);
7637 pthread_setcancelstate(PTHREAD_CANCEL_DISABLE,
NULL);
7639 pthread_setcancelstate(PTHREAD_CANCEL_ENABLE,
NULL);
7652 pthread_cleanup_pop(1);
7660 struct sockaddr_in sin;
7666 sinlen =
sizeof(
sin);
7667 as = accept(
skinnysock, (
struct sockaddr *)&sin, &sinlen);
7679 if (setsockopt(as, IPPROTO_TCP, TCP_NODELAY, (
char *) &arg,
sizeof(arg)) < 0) {
7690 memcpy(&s->
sin, &sin,
sizeof(sin));
7744 ast_verb(3,
"skinny_request(%s)\n", tmp);
7748 }
else if (subline) {
7759 #define TYPE_GENERAL 1 7760 #define TYPE_DEF_DEVICE 2 7761 #define TYPE_DEF_LINE 4 7762 #define TYPE_DEVICE 8 7763 #define TYPE_LINE 16 7765 #define CLINE_OPTS ((struct skinny_line_options *)item) 7766 #define CLINE ((struct skinny_line *)item) 7767 #define CDEV_OPTS ((struct skinny_device_options *)item) 7768 #define CDEV ((struct skinny_device *)item) 7773 int lineInstance = 1;
7774 int speeddialInstance = 1;
7775 int serviceUrlInstance = 1;
7784 char *stringp, *
context, *oldregcontext;
7789 if (!strcasecmp(v->
name,
"bindaddr")) {
7796 }
else if (!strcasecmp(v->
name,
"keepalive")) {
7799 }
else if (!strcasecmp(v->
name,
"authtimeout")) {
7809 }
else if (!strcasecmp(v->
name,
"authlimit")) {
7810 int limit = atoi(v->
value);
7819 }
else if (!strcasecmp(v->
name,
"regcontext")) {
7821 stringp = newcontexts;
7824 oldregcontext = oldcontexts;
7828 while ((context =
strsep(&stringp,
"&"))) {
7834 }
else if (!strcasecmp(v->
name,
"vmexten")) {
7837 }
else if (!strcasecmp(v->
name,
"immeddialkey")) {
7838 if (!strcmp(v->
value,
"#")) {
7840 }
else if (!strcmp(v->
value,
"*")) {
7847 }
else if (!strcasecmp(v->
name,
"dateformat")) {
7850 }
else if (!strcasecmp(v->
name,
"tos")) {
7854 }
else if (!strcasecmp(v->
name,
"tos_audio")) {
7858 }
else if (!strcasecmp(v->
name,
"tos_video")) {
7862 }
else if (!strcasecmp(v->
name,
"cos")) {
7866 }
else if (!strcasecmp(v->
name,
"cos_audio")) {
7870 }
else if (!strcasecmp(v->
name,
"cos_video")) {
7874 }
else if (!strcasecmp(v->
name,
"bindport")) {
7881 }
else if (!strcasecmp(v->
name,
"allow")) {
7884 }
else if (!strcasecmp(v->
name,
"disallow")) {
7890 if (!strcasecmp(v->
name,
"transfer")) {
7898 }
else if (!strcasecmp(v->
name,
"callwaiting")) {
7906 }
else if (!strcasecmp(v->
name,
"directmedia") || !strcasecmp(v->
name,
"canreinvite")) {
7911 }
else if (!strcasecmp(v->
name,
"nat")) {
7916 }
else if (!strcasecmp(v->
name,
"context")) {
7921 }
else if (!strcasecmp(v->
name,
"vmexten")) {
7929 }
else if (!strcasecmp(v->
name,
"mwiblink")) {
7937 }
else if (!strcasecmp(v->
name,
"linelabel")) {
7942 }
else if (!strcasecmp(v->
name,
"callerid")) {
7944 if (!strcasecmp(v->
value,
"asreceived")) {
7952 }
else if (!strcasecmp(v->
name,
"amaflags")) {
7955 if (tempamaflags < 0) {
7962 }
else if (!strcasecmp(v->
name,
"regexten")) {
7967 }
else if (!strcasecmp(v->
name,
"language")) {
7972 }
else if (!strcasecmp(v->
name,
"accountcode")) {
7977 }
else if (!strcasecmp(v->
name,
"mohinterpret") || !strcasecmp(v->
name,
"musiconhold")) {
7982 }
else if (!strcasecmp(v->
name,
"mohsuggest")) {
7987 }
else if (!strcasecmp(v->
name,
"callgroup")) {
7992 }
else if (!strcasecmp(v->
name,
"pickupgroup")) {
7997 }
else if (!strcasecmp(v->
name,
"namedcallgroup")) {
8002 }
else if (!strcasecmp(v->
name,
"namedpickupgroup")) {
8007 }
else if (!strcasecmp(v->
name,
"immediate")) {
8012 }
else if (!strcasecmp(v->
name,
"cancallforward")) {
8017 }
else if (!strcasecmp(v->
name,
"callfwdtimeout")) {
8022 }
else if (!strcasecmp(v->
name,
"mailbox")) {
8027 }
else if ( !strcasecmp(v->
name,
"parkinglot")) {
8032 }
else if (!strcasecmp(v->
name,
"hasvoicemail")) {
8039 if (strchr(
CLINE->name,
'@')) {
8042 snprintf(
CLINE->mailbox,
sizeof(
CLINE->mailbox),
"%s@default",
8048 }
else if (!strcasecmp(v->
name,
"threewaycalling")) {
8053 }
else if (!strcasecmp(v->
name,
"setvar")) {
8058 }
else if (!strcasecmp(v->
name,
"earlyrtp")) {
8063 }
else if (!strcasecmp(v->
name,
"host")) {
8067 CDEV_addr_tmp.
ss.ss_family = AF_INET;
8075 }
else if (!strcasecmp(v->
name,
"port")) {
8077 CDEV->addr.sin_port = htons(atoi(v->
value));
8080 }
else if (!strcasecmp(v->
name,
"device")) {
8085 }
else if (!strcasecmp(v->
name,
"permit") || !strcasecmp(v->
name,
"deny")) {
8097 }
else if (!strcasecmp(v->
name,
"allow")) {
8106 }
else if (!strcasecmp(v->
name,
"disallow")) {
8115 }
else if (!strcasecmp(v->
name,
"version")) {
8120 }
else if (!strcasecmp(v->
name,
"line")) {
8124 if (!strcasecmp(v->
value, l->name) && !l->prune) {
8132 if (l2 == l && strcasecmp(d->id,
CDEV->id)) {
8133 ast_log(
LOG_WARNING,
"Line %s already used by %s. Not connecting to %s.\n", l->name, d->name,
CDEV->name);
8140 CDEV->activeline = l;
8151 }
else if (!strcasecmp(v->
name,
"subline")) {
8158 if (!(subline =
ast_calloc(1,
sizeof(*subline)))) {
8162 if (!(container =
ast_calloc(1,
sizeof(*container)))) {
8169 exten =
strsep(&stringp,
"@");
8171 stname =
strsep(&exten,
"_");
8174 context =
strsep(&stringp,
",");
8182 container->
data = subline;
8187 }
else if (!strcasecmp(v->
name,
"dialoutcontext")) {
8192 }
else if (!strcasecmp(v->
name,
"dialoutexten")) {
8197 }
else if (!strcasecmp(v->
name,
"speeddial")) {
8208 if (!(container =
ast_calloc(1,
sizeof(*container)))) {
8209 ast_log(
LOG_WARNING,
"Unable to allocate memory for speeddial %s container. Ignoring speeddial.\n", v->
name);
8215 exten =
strsep(&stringp,
",");
8216 if ((context = strchr(exten,
'@'))) {
8228 sd->
instance = speeddialInstance++;
8234 container->
data = sd;
8239 }
else if (!strcasecmp(v->
name,
"serviceurl")) {
8244 if (!(surl =
ast_calloc(1,
sizeof(*surl)))) {
8249 displayName =
strsep(&stringp,
",");
8251 serviceUrl = stringp;
8254 surl->
instance = serviceUrlInstance++;
8263 }
else if (!strcasecmp(v->
name,
"addon")) {
8297 if (!strcasecmp(lname, temp->name) && temp->prune) {
8304 ast_verb(1,
"Unable to allocate memory for line %s.\n", lname);
8308 if (!(container =
ast_calloc(1,
sizeof(*container)))) {
8316 container->
data = l;
8319 memcpy(l, default_line,
sizeof(*default_line));
8331 ast_verb(3,
"Setting mailbox '%s' on line %s\n", l->mailbox, l->name);
8345 ast_verb(3,
"%s config for line '%s'\n", update ?
"Updated" : (
skinnyreload ?
"Reloaded" :
"Created"), l->name);
8361 if (!strcasecmp(dname, temp->name) && temp->prune) {
8368 ast_verb(1,
"Unable to allocate memory for device %s.\n", dname);
8372 memcpy(d, default_device,
sizeof(*default_device));
8388 if (!ntohs(d->
addr.sin_port)) {
8395 if (strcasecmp(d->id, temp->id) || !temp->prune || !temp->
session) {
8401 d->hookstate = temp->hookstate;
8408 if (strcasecmp(l->name, ltemp->name)) {
8412 l->instance = ltemp->instance;
8437 ast_verb(3,
"%s config for device '%s'\n", update ?
"Updated" : (
skinnyreload ?
"Reloaded" :
"Created"), d->name);
8448 int oldport = ntohs(
bindaddr.sin_port);
8477 if (ntohl(
bindaddr.sin_addr.s_addr)) {
8496 while (cat && strcasecmp(cat,
"general") && strcasecmp(cat,
"devices")) {
8504 while (cat && strcasecmp(cat,
"general") && strcasecmp(cat,
"lines")) {
8515 skinnysock = socket(AF_INET, SOCK_STREAM, 0);
8516 if(setsockopt(
skinnysock, SOL_SOCKET, SO_REUSEADDR, &on,
sizeof(on)) == -1) {
8545 ast_verb(2,
"Skinny listening on %s:%d\n",
8546 ast_inet_ntoa(bindaddr.sin_addr), ntohs(bindaddr.sin_port));
8602 ast_verb(3,
"Chan_skinny is already reloading.\n");
8629 ast_verb(3,
"Removing device '%s'\n", d->name);
8666 ast_verb(3,
"Restarting device '%s'\n", d->name);
8701 for (; res <
ARRAY_LEN(soft_key_template_default); res++) {
8702 soft_key_template_default[res].
softKeyEvent =
htolel(soft_key_template_default[res].softKeyEvent);
8754 pthread_t tempthread;
8798 blob =
ast_json_pack(
"{s: s}",
"peer_status",
"Unregistered");
8801 pthread_cancel(tempthread);
8802 pthread_join(tempthread,
NULL);
#define SKINNY_DEVICE_7931
static const uint8_t soft_key_default_connwithconf[]
struct ast_party_caller * ast_channel_caller(struct ast_channel *chan)
#define START_TONE_MESSAGE
static void transmit_dialednumber(struct skinny_device *d, const char *text, int instance, int callid)
int ast_sched_start_thread(struct ast_sched_context *con)
Start a thread for processing scheduler entries.
static struct lines lines
struct ast_variable * next
#define AST_THREADSTORAGE(name)
Define a thread storage variable.
int ast_queue_hangup(struct ast_channel *chan)
Queue a hangup frame.
static void * get_button_template(struct skinnysession *s, struct button_definition_template *btn)
struct soft_key_template_res_message softkeytemplate
struct sockaddr_storage ss
Information needed to identify an endpoint in a call.
enum sip_cc_notify_state state
void ast_channel_pickupgroup_set(struct ast_channel *chan, ast_group_t value)
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) ...
#define ast_channel_lock(chan)
static char exten[AST_MAX_EXTENSION]
Main Channel structure associated with a channel.
#define SKINNY_DEVICE_7960
static const uint8_t soft_key_default_SLAhold[]
struct display_prompt_status_message_variable displaypromptstatusvar
struct skinny_container * container
static int skinny_call(struct ast_channel *ast, const char *dest, int timeout)
#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
static void mwi_event_cb(void *userdata, struct stasis_subscription *sub, struct stasis_message *msg)
char * str
Subscriber phone number (Malloced)
static void transmit_capabilitiesreq(struct skinny_device *d)
#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 char * _skinny_show_device(int type, int fd, struct mansession *s, const struct message *m, int argc, const char *const *argv)
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
void * ast_mwi_unsubscribe(struct ast_mwi_subscriber *sub)
Unsubscribe from the stasis topic and MWI.
enum ast_transfer_result ast_bridge_transfer_attended(struct ast_channel *to_transferee, struct ast_channel *to_transfer_target)
Attended transfer.
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 struct skinny_device * config_device(const char *dname, struct ast_variable *v)
int ast_queue_control(struct ast_channel *chan, enum ast_control_frame_type control)
Queue a control frame without payload.
struct register_ack_message regack
void * ast_threadstorage_get(struct ast_threadstorage *ts, size_t init_size)
Retrieve thread storage.
struct register_rej_message regrej
struct ast_json * ast_json_pack(char const *format,...)
Helper for creating complex JSON values.
#define STOP_TONE_MESSAGE
#define START_MEDIA_TRANSMISSION_MESSAGE
void ast_rtp_instance_set_channel_id(struct ast_rtp_instance *instance, const char *uniqueid)
Set the channel that owns this RTP instance.
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
struct skinny_addon::@142 list
static int gendigittimeout
static int skinny_nokeepalive_cb(const void *data)
struct open_receive_channel_ack_message_ip4 openreceivechannelack_ip4
static void register_exten(struct skinny_line *l)
Channels have this property if they can accept input with jitter; i.e. most VoIP channels.
struct keypad_button_message keypad
static int skinny_noauth_cb(const void *data)
#define LINE_STAT_RES_MESSAGE
#define KEYMASK_FORCEDIAL
static char * _skinny_show_lines(int fd, int *total, struct mansession *s, const struct message *m, int argc, const char *const *argv)
void ast_rtp_instance_change_source(struct ast_rtp_instance *instance)
Indicate a new source of audio has dropped in and the ssrc should change.
CallerID (and other GR30) management and generation Includes code and algorithms from the Zapata libr...
void ast_channel_set_writeformat(struct ast_channel *chan, struct ast_format *format)
static struct skinny_line * skinny_line_alloc(void)
struct serviceurl_stat_message serviceurlmessage
struct enbloc_call_message enbloccallmessage
char stname[AST_MAX_EXTENSION]
static void transmit_displaypromptstatusvar(struct skinny_device *d, const char *text, const char *extratext, int t, int instance, int callid)
struct ast_party_id id
Connected party ID.
#define CALL_INFO_MESSAGE_VARIABLE
int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len)
Unregister multiple commands.
void * ast_channel_tech_pvt(const struct ast_channel *chan)
struct skinny_subline::@139 list
struct skinny_device::@147 list
#define ast_channel_unref(c)
Decrease channel reference count.
struct ast_endpoint * ast_endpoint_create(const char *tech, const char *resource)
Create an endpoint struct.
#define SKINNY_LAMP_BLINK
#define SOFTKEY_FORCEDIAL
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)
struct ast_variable * ast_variable_browse(const struct ast_config *config, const char *category_name)
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
#define KEEP_ALIVE_MESSAGE
#define CLEAR_DISPLAY_MESSAGE
struct skinnysession * session
const char * ast_var_value(const struct ast_var_t *var)
void ast_json_unref(struct ast_json *value)
Decrease refcount on value. If refcount reaches zero, value is freed.
struct ast_party_name name
Subscriber name.
static int skinny_sched_add(int when, ast_sched_cb callback, struct skinny_subchannel *sub)
void ast_channel_unregister(const struct ast_channel_tech *tech)
Unregister a channel technology.
struct ast_endpoint * endpoint
static struct in_addr __ourip
int ast_extension_state_del(int id, ast_state_cb_type change_cb)
Deletes a state change watcher by ID.
static int handle_stimulus_message(struct skinny_req *req, struct skinnysession *s)
#define SUBSTATE_CALLWAIT
struct forward_stat_message forwardstat
#define SELECT_SOFT_KEYS_MESSAGE
int ast_queue_unhold(struct ast_channel *chan)
Queue an unhold frame.
#define CALLSTATE2STR_BUFSIZE
struct ast_format_cap * confcap
Convenient Signal Processing routines.
struct set_speaker_message setspeaker
const char * ast_var_name(const struct ast_var_t *var)
void ast_channel_set_rawwriteformat(struct ast_channel *chan, struct ast_format *format)
char calldetails[MAXCALLINFOSTR]
#define DISPLAY_PRINOTIFY_MESSAGE_VARIABLE
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)
void astman_send_list_complete_start(struct mansession *s, const struct message *m, const char *event_name, int count)
Start the list complete event.
static int codec_ast2skinny(const struct ast_format *astcodec)
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 version_res_message version
static const char tdesc[]
static char * skinny_debugs(void)
#define CONTROL2STR_BUFSIZE
int ast_party_id_presentation(const struct ast_party_id *id)
Determine the overall presentation value for the given party.
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 CONFIG_STATUS_FILEINVALID
#define REGISTER_AVAILABLE_LINES_MESSAGE
static void transmit_response(struct skinny_device *d, struct skinny_req *req)
uint32_t softKeySetOffset
static const uint8_t soft_key_default_ringin[]
static int skinny_sched_del(int sched_id, struct skinny_subchannel *sub)
int keepalive_timeout_sched
#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).
enum ast_state_cb_update_reason reason
struct start_media_transmission_message_ip6 startmedia_ip6
char promptMessage[MAXCALLINFOSTR]
#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)
struct skinny_device::@145 serviceurls
static void transmit_registerrej(struct skinnysession *s)
#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)
struct skinny_line * line
static char * handle_skinny_message_clear(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
Handle clearing messages to devices.
#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
struct dialed_number_message dialednumber
char originalCalledParty[24]
static void activatesub(struct skinny_subchannel *sub, int state)
struct line_stat_res_message linestat
char exten[AST_MAX_EXTENSION]
#define SKINNY_CALLWAITTONE
struct stasis_message_type * stasis_message_type(const struct stasis_message *msg)
Get the message type for a stasis_message.
Structure to pass both assignedid values to channel drivers.
enum ast_acl_sense ast_apply_ha(const struct ast_ha *ha, const struct ast_sockaddr *addr)
Apply a set of rules to a given IP address.
void ast_channel_callgroup_set(struct ast_channel *chan, ast_group_t value)
struct stop_media_transmission_message stopmedia
ast_channel_state
ast_channel states
static const uint8_t soft_key_default_unknown[]
char * str
Subscriber name (Malloced)
static char * complete_skinny_debug(const char *line, const char *word, int pos, int state)
char outbuf[SKINNY_MAX_PACKET]
struct open_receive_channel_ack_message_ip6 openreceivechannelack_ip6
struct skinny_line::@136 sublines
const char * ast_channel_amaflags2string(enum ama_flags flags)
Convert the enum representation of an AMA flag to a string representation.
static struct skinny_subchannel * find_subchannel_by_instance_reference(struct skinny_device *d, int instance, int reference)
uint32_t stimulusInstance
#define ast_cli_register_multiple(e, len)
Register multiple commands.
#define KEYDEF_CONNWITHCONF
void ast_channel_named_pickupgroups_set(struct ast_channel *chan, struct ast_namedgroups *value)
static int transmit_response_bysession(struct skinnysession *s, struct skinny_req *req)
static struct aco_type item
struct ast_mwi_subscriber * mwi_event_sub
#define DEFAULT_AUTH_TIMEOUT
static char * control2str(int ind)
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
void ast_endpoint_set_state(struct ast_endpoint *endpoint, enum ast_endpoint_state state)
Updates the state of the given endpoint.
#define SKINNY_DEVICE_7920
static int skinny_senddigit_begin(struct ast_channel *ast, char digit)
uint32_t lastRedirectingReason
static void transmit_callinfo(struct skinny_device *d, int instance, int callid, char *fromname, char *fromnum, char *toname, char *tonum, int calldirection, char *origtonum, char *origtoname)
#define AST_LIST_EMPTY(head)
Checks whether the specified list contains any entries.
static struct ast_threadstorage callstate2str_threadbuf
#define ast_mutex_lock(a)
static void transmit_serviceurlstat(struct skinny_device *d, int instance)
struct station_capabilities caps[SKINNY_MAX_CAPABILITIES]
static void * skinny_newcall(void *data)
static struct ast_threadstorage substate2str_threadbuf
#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 ...
static char * handle_skinny_show_device(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
Show device information.
#define ast_str_alloca(init_len)
int64_t ast_tvdiff_ms(struct timeval end, struct timeval start)
Computes the difference (in milliseconds) between two struct timeval instances.
void ast_verbose(const char *fmt,...)
struct display_prompt_status_message displaypromptstatus
char exten[AST_MAX_EXTENSION]
#define ast_strdup(str)
A wrapper for strdup()
struct activate_call_plane_message activatecallplane
static void transmit_reset(struct skinny_device *d, int fullrestart)
struct ast_format_cap * cap
void ast_rtp_codecs_set_framing(struct ast_rtp_codecs *codecs, unsigned int framing)
Set the framing used for a set of codecs.
struct skinny_device * device
struct varshead * ast_channel_varshead(struct ast_channel *chan)
static struct soft_key_template_definition soft_key_template_default[]
SKINNY_LINE_OPTIONS ast_mutex_t lock
struct bksp_req_message bkspmessage
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
char * ast_category_browse(struct ast_config *config, const char *prev_name)
Browse categories.
struct definetimedate_message definetimedate
static void end_session(struct skinnysession *s)
static int skinny_header_size
static void start_rtp(struct skinny_subchannel *sub)
static struct ast_format * codec_skinny2ast(enum skinny_codecs skinnycodec)
#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)
Definitions to aid in the use of thread local storage.
#define DISPLAY_PROMPT_STATUS_MESSAGE_VARIABLE
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]
static void push_callinfo(struct skinny_subline *subline, struct skinny_subchannel *sub)
#define LINE_STATE_REQ_MESSAGE
#define AST_LIST_REMOVE(head, elm, field)
Removes a specific entry from a list.
static void transmit_displaynotify(struct skinny_device *d, const char *text, int t)
#define SKINNY_LAMP_FLASH
#define SKINNY_DEVICE_7905
char speedDialDirNumber[24]
#define SOFTKEY_CFWDNOANSWER
#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)
free() wrapper
struct offhook_message offhook
Socket address structure.
static int firstdigittimeout
struct skinny_device * device
char callingPartyName[40]
struct speed_dial_stat_res_message speeddial
#define ast_verb(level,...)
static void transmit_startmediatransmission(struct skinny_device *d, struct skinny_subchannel *sub, struct sockaddr_in dest, struct ast_format *format, unsigned int framing)
char context[AST_MAX_CONTEXT]
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.
struct skinny_line::@135 sub
struct skinny_serviceurl::@141 list
uint32_t secondaryKeepAlive
static int skinny_devicestate(const char *data)
const char * pbx_builtin_getvar_helper(struct ast_channel *chan, const char *name)
Return a pointer to the value of the corresponding channel variable.
static char * handle_skinny_reset(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static char * _skinny_show_line(int type, int fd, struct mansession *s, const struct message *m, int argc, const char *const *argv)
struct ast_frame_subclass subclass
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 void _transmit_displayprinotifyvar(struct skinny_device *d, const char *text, const char *extratext, int timeout, int priority)
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)
int ast_context_destroy_by_name(const char *context, const char *registrar)
Destroy a context by name.
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
#define ast_module_unref(mod)
Release a reference to the module.
#define ast_strlen_zero(foo)
static int handle_button_template_req_message(struct skinny_req *req, struct skinnysession *s)
static int skinny_cfwd_cb(const void *data)
struct ast_format * ast_channel_readformat(struct ast_channel *chan)
char context[AST_MAX_CONTEXT]
struct soft_key_template_definition softKeyTemplateDefinition[32]
static char * callstate2str(int ind)
char * ast_cli_complete(const char *word, const char *const choices[], int pos)
#define ast_pthread_create_background(a, b, c, d)
void ast_channel_tech_set(struct ast_channel *chan, const struct ast_channel_tech *value)
#define HEADSET_STATUS_MESSAGE
static void transmit_keepaliveack(struct skinnysession *s)
static void skinny_locksub(struct skinny_subchannel *sub)
static int skinny_write(struct ast_channel *ast, struct ast_frame *frame)
enum ama_flags ast_channel_string2amaflag(const char *flag)
Convert a string to a detail record AMA flag.
long resync_threshold
Resynchronization threshold of the jitterbuffer implementation.
internal representation of ACL entries In principle user applications would have no need for this...
static const uint8_t soft_key_default_SLAconnectednotactive[]
static int handle_enbloc_call_message(struct skinny_req *req, struct skinnysession *s)
static struct skinny_line * skinny_line_destroy(struct skinny_line *l)
static void dumpsub(struct skinny_subchannel *sub, int forcehangup)
#define MAXDISPLAYNOTIFYSTR
#define SKINNY_LINECONTAINER
#define BUTTON_TEMPLATE_RES_MESSAGE
struct skinny_line * activeline
Configuration File Parser.
enum ast_extension_states exten_state
static int matchdigittimeout
#define SKINNY_DEVICE_7971
static char used_context[AST_MAX_EXTENSION]
static struct ast_channel * skinny_new(struct skinny_line *l, struct skinny_subline *subline, int state, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, int direction)
#define STIMULUS_FORWARDALL
struct skinny_subchannel * sub
#define EVENT_FLAG_SYSTEM
static char * complete_skinny_reset(const char *line, const char *word, int pos, int state)
struct skinny_container * container
#define ast_debug(level,...)
Log a DEBUG message.
static struct skinny_device_options * default_device
struct skinny_subchannel * activesub
void ast_channel_set_rawreadformat(struct ast_channel *chan, struct ast_format *format)
struct skinny_line * line
static void send_displaypromptstatus(struct skinny_device *d, const char *text, const char *extratext, int t, int instance, int callid)
#define REGISTER_REJ_MESSAGE
static void skinny_dialer(struct skinny_subchannel *sub, int timedout)
void ast_rtp_instance_stop(struct ast_rtp_instance *instance)
Stop an RTP instance.
#define KEEP_ALIVE_ACK_MESSAGE
struct ast_context * ast_context_find(const char *name)
Find a context.
#define ast_config_load(filename, flags)
Load a config file.
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
enum ast_transfer_result ast_bridge_transfer_blind(int is_external, struct ast_channel *transferer, const char *exten, const char *context, transfer_channel_cb new_channel_cb, void *user_data)
Blind transfer target to the extension and context provided.
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)
#define SUBSTATE2STR_BUFSIZE
#define SERVICEURL_STATREQ_MESSAGE
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 char * substate2str(int ind)
static struct ast_rtp_glue skinny_rtp_glue
#define SKINNY_DEVICE_7961GE
void ast_channel_rings_set(struct ast_channel *chan, int value)
#define STIMULUS_VOICEMAIL
#define SET_MICROPHONE_MESSAGE
void astman_send_list_complete_end(struct mansession *s)
End the list complete event.
#define ast_sockaddr_from_sin(addr, sin)
Converts a struct sockaddr_in to a struct ast_sockaddr.
int ast_set_read_format(struct ast_channel *chan, struct ast_format *format)
Sets read format on channel chan.
#define OCTAL_CALLWAITING
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
void ast_channel_nativeformats_set(struct ast_channel *chan, struct ast_format_cap *value)
void ast_channel_stage_snapshot_done(struct ast_channel *chan)
Clear flag to indicate channel snapshot is being staged, and publish snapshot.
struct ast_party_connected_line * ast_channel_connected(struct ast_channel *chan)
#define AST_PTHREADT_NULL
static struct skinny_device * skinny_device_alloc(const char *dname)
static void transmit_clear_display_message(struct skinny_device *d, int instance, int reference)
#define ast_poll(a, b, c)
struct ast_variable * chanvars
#define AST_CAUSE_ANSWERED_ELSEWHERE
Access Control of various sorts.
static struct ao2_container * codecs
Registered codecs.
#define OPEN_RECEIVE_CHANNEL_MESSAGE
static char * _skinny_message_set(int type, int fd, struct mansession *s, const struct message *m, int argc, const char *const *argv)
static struct ast_frame * skinny_read(struct ast_channel *ast)
#define AST_MAX_EXTENSION
char * ast_strip(char *s)
Strip leading/trailing whitespace from a string.
Scheduler Routines (derived from cheops)
static void setsubstate(struct skinny_subchannel *sub, int state)
static void config_parse_variables(int type, void *item, struct ast_variable *vptr)
#define SKINNY_DEVICE_7911
static void skinny_transfer_attended(struct skinny_subchannel *sub)
static void transmit_selectsoftkeys(struct skinny_device *d, int instance, int callid, int softkey, int mask)
static int skinny_hangup(struct ast_channel *ast)
void ast_party_number_init(struct ast_party_number *init)
Initialize the given number structure.
#define AST_LIST_REMOVE_CURRENT(field)
Removes the current entry from a list during a traversal.
#define ao2_ref(o, delta)
void ast_channel_set_readformat(struct ast_channel *chan, struct ast_format *format)
static void update_connectedline(struct skinny_subchannel *sub, const void *data, size_t datalen)
const char * ast_extension_state2str(int extension_state)
Return string representation of the state of an extension.
#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
void ast_config_destroy(struct ast_config *config)
Destroys a config.
In case you didn't read that giant block of text above the mansession_session struct, the struct mansession is named this solely to keep the API the same in Asterisk. This structure really represents data that is different from Manager action to Manager action. The mansession_session pointer contained within points to session-specific data.
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)
struct display_prinotify_message displayprinotify
#define CLOSE_RECEIVE_CHANNEL_MESSAGE
static int skinny_senddigit_end(struct ast_channel *ast, char digit, unsigned int duration)
#define ast_strdupa(s)
duplicate a string in memory from the stack
#define VERSION_REQ_MESSAGE
struct line_state_req_message line
long target_extra
amount of additional jitterbuffer adjustment
#define SKINNY_DEVICE_30SPPLUS
struct skinny_device::@144 speeddials
static const uint8_t soft_key_default_onhold[]
struct skinny_line::@138 all
static void transmit_softkeysetres(struct skinny_device *d)
void ast_channel_amaflags_set(struct ast_channel *chan, enum ama_flags value)
#define SUBSTATE_CONNECTED
A set of macros to manage forward-linked lists.
static void transmit_linestatres(struct skinny_device *d, int instance)
struct ao2_container * container
int ast_set_write_format(struct ast_channel *chan, struct ast_format *format)
Sets write format on channel chan.
static const uint8_t soft_key_default_ringout[]
static char immed_dialchar
#define ast_variable_new(name, value, filename)
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 SUBSTATE_CONGESTION
#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 struct skinny_subline * find_subline_by_callid(struct skinny_device *d, int callid)
int ast_queue_hold(struct ast_channel *chan, const char *musicclass)
Queue a hold frame.
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: ...
void ast_channel_adsicpe_set(struct ast_channel *chan, enum ast_channel_adsicpe value)
const char * ast_channel_exten(const struct ast_channel *chan)
Core PBX routines and definitions.
uint32_t totalSoftKeyCount
struct ast_format_cap * confcap
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.
char text[MAXDISPLAYNOTIFYSTR]
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
struct ast_format_cap * cap
#define AST_LIST_HEAD_STATIC(name, type)
Defines a structure to be used to hold a list of specified type, statically initialized.
struct ast_sched_context * ast_sched_context_create(void)
Create a scheduler context.
static struct ast_hostent ahp
int ast_channel_fdno(const struct ast_channel *chan)
const char * ast_channel_uniqueid(const struct ast_channel *chan)
static int handle_message(struct skinny_req *req, struct skinnysession *s)
#define SKINNY_DEBUG(type, verb_level, text,...)
#define DEFAULT_SKINNY_BACKLOG
int ast_manager_unregister(const char *action)
Unregister a registered manager command.
struct skinny_speeddial::@140 list
The AMI - Asterisk Manager Interface - is a TCP protocol created to manage Asterisk with third-party ...
static int skinny_answer(struct ast_channel *ast)
void ast_channel_stage_snapshot(struct ast_channel *chan)
Set flag to indicate channel snapshot is being staged.
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)
static pthread_t accept_t
struct ast_namedgroups * ast_get_namedgroups(const char *s)
Create an ast_namedgroups set with group names from comma separated string.
static int load_module(void)
Load the module.
static int skinny_extensionstate_cb(const char *context, const char *exten, struct ast_state_cb_info *info, void *data)
#define AST_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
uint32_t totalSoftKeySetCount
int ast_pickup_call(struct ast_channel *chan)
Pickup a call.
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".
static int handle_transfer_button(struct skinny_subchannel *sub)
The descriptor of a dynamic string XXX storage will be optimized later if needed We use the ts field ...
static struct ast_threadstorage control2str_threadbuf
#define KEYPAD_BUTTON_MESSAGE
#define ACTIVATE_CALL_PLANE_MESSAGE
struct ast_party_id ast_channel_connected_effective_id(struct ast_channel *chan)
static void skinny_session_cleanup(void *data)
static int manager_skinny_show_devices(struct mansession *s, const struct message *m)
Show SKINNY devices in the manager API.
static const uint8_t soft_key_default_ringoutwithtransfer[]
#define SKINNY_SPEAKEROFF
#define DISPLAY_PRINOTIFY_MESSAGE
void ast_channel_named_callgroups_set(struct ast_channel *chan, struct ast_namedgroups *value)
void * stasis_message_data(const struct stasis_message *msg)
Get the data contained in a message.
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)
int ast_set_qos(int sockfd, int tos, int cos, const char *desc)
Set type of service.
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, const struct ast_format_cap *codecs, int nat_active)
static ast_mutex_t netlock
static int keyset_translatebitmask(int keyset, int intmask)
#define SKINNY_DEVICE_7941GE
void ast_party_name_init(struct ast_party_name *init)
Initialize the given name structure.
#define ast_rtp_instance_set_remote_address(instance, address)
Set the address of the remote endpoint that we are sending RTP to.
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)
struct stasis_message_type * ast_endpoint_state_type(void)
Message type for endpoint state changes.
struct skinny_device::@143 lines
struct skinny_device::@146 addons
struct set_lamp_message setlamp
#define CLEAR_PRINOTIFY_MESSAGE
#define KEYDEF_SLACONNECTEDNOTACTIVE
static int unauth_sessions
struct timeval ast_tvadd(struct timeval a, struct timeval b)
Returns the sum of two timevals a + b.
static struct ast_frame * skinny_rtp_read(struct skinny_subchannel *sub)
def ignore(key=None, val=None, section=None, pjsip=None, nmapped=None, type='endpoint')
#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.
struct select_soft_keys_message selectsoftkey
#define SKINNY_DEVICE_7985
static void handle_keepalive_message(struct skinny_req *req, struct skinnysession *s)
static void transmit_clearprinotify(struct skinny_device *d, int priority)
static void send_callinfo(struct skinny_subchannel *sub)
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
static int skinny_autoanswer_cb(const void *data)
#define SUBSTATE_PROGRESS
struct ast_format_cap * capabilities
uint32_t serverListenPort[5]
static const struct soft_key_definitions soft_key_default_definitions[]
#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.
struct skinny_subline * subline
#define AST_LIST_INSERT_HEAD(head, elm, field)
Inserts a list entry at the head of a list.
int ast_parking_provider_registered(void)
Check whether a parking provider is registered.
static int cleardisplay(char *buf, char *name, int id, char *args, struct adsi_script *istate, const char *script, int lineno)
#define ast_channel_unlock(chan)
struct skinny_line::@137 list
static char version[AST_MAX_EXTENSION]
#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_calloc(num, len)
A wrapper for calloc()
#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
struct ast_var_t::@249 entries
static struct ast_cli_entry cli_skinny[]
static void transmit_displaypromptstatus(struct skinny_device *d, const char *text, const char *extratext, int t, int instance, int callid)
#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 SKINNY_DEVICE_7935
#define SPEED_DIAL_STAT_REQ_MESSAGE
char exten[AST_MAX_EXTENSION]
#define STIMULUS_TRANSFER
int ast_str2cos(const char *value, unsigned int *cos)
Convert a string to the appropriate COS value.
struct skinny_device * parent
void * ast_mwi_unsubscribe_and_join(struct ast_mwi_subscriber *sub)
Unsubscribe from the stasis topic, block until the final message is received, and then unsubscribe fr...
void ast_hangup(struct ast_channel *chan)
Hang up a channel.
struct skinny_device * parent
static struct ast_threadstorage message2str_threadbuf
#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)
struct stasis_message_type * ast_mwi_state_type(void)
Get the Stasis Message Bus API message type for MWI messages.
int ast_sched_del(struct ast_sched_context *con, int id) attribute_warn_unused_result
Deletes a scheduled event.
Module has failed to load, may be in an inconsistent state.
static char * _skinny_message_clear(int type, int fd, struct mansession *s, const struct message *m, int argc, const char *const *argv)
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
struct clear_prinotify_message clearprinotify
static struct ast_format_cap * default_cap
#define SKINNY_DEVICE_CIPC
int(* ast_sched_cb)(const void *data)
scheduler callback
uint32_t originalCalledPartyRedirectReason
#define FORWARD_STAT_MESSAGE
#define SKINNY_DEVICE_7961
int ast_sched_add(struct ast_sched_context *con, int when, ast_sched_cb callback, const void *data) attribute_warn_unused_result
Adds a scheduled event.
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.
int ast_app_has_voicemail(const char *mailboxes, const char *folder)
Determine if a given mailbox has any voicemail If folder is NULL, defaults to "INBOX". If folder is "INBOX", includes the number of messages in the "Urgent" folder.
void ast_channel_set_fd(struct ast_channel *chan, int which, int fd)
static void skinny_unlocksub(struct skinny_subchannel *sub)
#define SKINNY_DEVICE_7965
struct ast_bridge_channel * ast_channel_get_bridge_channel(struct ast_channel *chan)
Get a reference to the channel's bridge pointer.
#define SKINNY_DEVICE_7902
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS|AST_MODFLAG_LOAD_ORDER, "HTTP Phone Provisioning",.support_level=AST_MODULE_SUPPORT_EXTENDED,.load=load_module,.unload=unload_module,.reload=reload,.load_pri=AST_MODPRI_CHANNEL_DEPEND,.requires="http",)
static struct sockaddr_in bindaddr
void ast_jb_configure(struct ast_channel *chan, const struct ast_jb_conf *conf)
Configures a jitterbuffer on a channel.
#define SKINNY_DEVICE_30VIP
static void transmit_speaker_mode(struct skinny_device *d, int mode)
void ast_channel_exten_set(struct ast_channel *chan, const char *value)
struct ast_format_cap * ast_channel_nativeformats(const struct ast_channel *chan)
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 char speeddial[ADSI_MAX_SPEED_DIAL][3][SPEEDDIAL_MAX_LEN]
void ast_endpoint_blob_publish(struct ast_endpoint *endpoint, struct stasis_message_type *type, struct ast_json *blob)
Creates and publishes a ast_endpoint_blob message.
struct ast_frame * ast_udptl_read(struct ast_udptl *udptl)
static struct skinny_subline * find_subline_by_name(const char *dest)
#define AST_PRES_RESTRICTION
struct ast_frame ast_null_frame
#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
void ast_str_reset(struct ast_str *buf)
Reset the content of a dynamic string. Useful before a series of ast_str_append.
#define EVENT_FLAG_REPORTING
#define SKINNY_DEVICE_ATA186
static void transmit_clearpromptmessage(struct skinny_device *d, int instance, int callid)
static void skinny_set_owner(struct skinny_subchannel *sub, struct ast_channel *chan)
static struct ast_jb_conf global_jbconf
struct stop_tone_message stoptone
struct timeval last_keepalive
#define SKINNY_DEVICE_7936
struct skinny_container * container
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
Structure that contains information regarding a channel in a bridge.
#define BT_CUST_LINESPEEDDIAL
#define SKINNY_CX_INACTIVE
char * strsep(char **str, const char *delims)
#define STIMULUS_CONFERENCE
static void transmit_backspace(struct skinny_device *d, int instance, unsigned callid)
#define SKINNY_RING_INSIDE
#define ast_channel_ref(c)
Increase channel reference count.
#define STOP_MEDIA_TRANSMISSION_MESSAGE
static void transmit_callinfo_variable(struct skinny_device *d, int instance, int callreference, char *fromname, char *fromnum, char *toname, char *tonum, int calldirection, char *origtonum, char *origtoname)
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.
struct skinny_subchannel * related
Standard Command Line Interface.
#define SPEED_DIAL_STAT_RES_MESSAGE
#define DISPLAY_PROMPT_STATUS_MESSAGE
int ast_channel_hangupcause(const struct ast_channel *chan)
static char * complete_skinny_show_line(const char *line, const char *word, int pos, int state)
void ast_channel_context_set(struct ast_channel *chan, const char *value)
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.
struct call_info_message_variable callinfomessagevariable
#define S_OR(a, b)
returns the equivalent of logic or for strings: first one if not empty, otherwise second one...
struct timeval ast_tv(ast_time_t sec, ast_suseconds_t usec)
Returns a timeval from sec, usec.
#define SOFT_KEY_TEMPLATE_RES_MESSAGE
struct ast_channel * ast_channel_bridge_peer(struct ast_channel *chan)
Get the channel's bridge peer only if the bridge is two-party.
const char * ast_channel_name(const struct ast_channel *chan)
char text[MAXDISPLAYNOTIFYSTR]
struct skinny_subchannel::@134 list
static void _transmit_displayprinotify(struct skinny_device *d, const char *text, const char *extratext, int timeout, int priority)
#define VERSION_RES_MESSAGE
static void delete_devices(void)
int ast_parking_park_call(struct ast_bridge_channel *parker, char *exten, size_t length)
Park the bridge and/or callers that this channel is in.
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.
char speedDialDisplayName[40]
enum ast_pbx_result ast_pbx_run(struct ast_channel *c)
Execute the PBX in the current thread.
struct start_media_transmission_message_ip4 startmedia_ip4
static const uint8_t soft_key_default_offhook[]
struct stasis_forward * sub
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
Internal Asterisk hangup causes.
#define SKINNY_MAX_PACKET
Abstract JSON element (object, array, string, int, ...).
#define SKINNY_SDCONTAINER
static int handle_ip_port_message(struct skinny_req *req, struct skinnysession *s)
static void handle_callforward_button(struct skinny_line *l, struct skinny_subchannel *sub, int cfwdtype)
char lnname[AST_MAX_EXTENSION]
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.
const char * ast_channel_context(const struct ast_channel *chan)
#define SKINNY_SUBLINECONTAINER
#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.
#define SOFT_KEY_TEMPLATE_REQ_MESSAGE
enum ast_frame_type frametype
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)
#define AST_CLI_YESNO(x)
Return Yes or No depending on the argument.
unsigned char valid
TRUE if the name information is valid/present.
#define STIMULUS_FORWARDNOANSWER
struct ast_namedgroups * ast_unref_namedgroups(struct ast_namedgroups *groups)
static const uint8_t soft_key_default_offhookwithfeat[]
static char context[AST_MAX_CONTEXT]
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.
struct ast_format * format
#define SKINNY_CX_SENDRECV
int ast_extension_state_add(const char *context, const char *exten, ast_state_cb_type change_cb, void *data)
Add watcher for extension states.
static void skinny_transfer_blind(struct skinny_subchannel *sub)
static struct ast_variable * add_var(const char *buf, struct ast_variable *list)
#define SKINNY_DEVICE_7945
uint8_t softKeyTemplateIndex[16]
#define STIMULUS_CALLPARK
struct set_ringer_message setringer
static const uint8_t soft_key_default_onhook[]
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.
The structure that contains MWI state.
static void transmit_microphone_mode(struct skinny_device *d, int mode)
#define ast_manager_register_xml(action, authority, func)
Register a manager callback using XML documentation to describe the manager.
Say numbers and dates (maybe words one day too)
void ast_endpoint_shutdown(struct ast_endpoint *endpoint)
Shutsdown an ast_endpoint.
struct server_res_message serverres
#define ASTERISK_GPL_KEY
The text the key() function should return.
void ast_channel_priority_set(struct ast_channel *chan, int value)
Pluggable RTP Architecture.
#define ast_channel_alloc(needqueue, state, cid_num, cid_name, acctcode, exten, context, assignedids, requestor, amaflag,...)
Create a channel structure.
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.
struct ast_format * ast_channel_writeformat(struct ast_channel *chan)
static struct hostent * hp
char * ast_print_namedgroups(struct ast_str **buf, struct ast_namedgroups *groups)
Print named call groups and named pickup groups.
struct ast_mwi_subscriber * ast_mwi_subscribe_pool(const char *mailbox, stasis_subscription_cb callback, void *data)
Add an MWI state subscriber, and stasis subscription to the mailbox.
struct capabilities_res_message caps
static struct skinny_device * skinny_device_destroy(struct skinny_device *d)
static snd_pcm_format_t format
static int skinny_dialer_cb(const void *data)
#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)
#define ast_rtp_instance_get_remote_address(instance, address)
Get the address of the remote endpoint that we are sending RTP to.
void ast_channel_tech_pvt_set(struct ast_channel *chan, void *value)
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
struct display_prinotify_message_variable displayprinotifyvar
struct reset_message reset
unsigned char valid
TRUE if the number information is valid/present.
uint16_t softKeyInfoIndex[16]
General jitterbuffer configuration.
static char * _skinny_show_devices(int fd, int *total, struct mansession *s, const struct message *m, int argc, const char *const *argv)
void ast_sched_context_destroy(struct ast_sched_context *c)
destroys a schedule context
static void * skinny_session(void *data)
#define SOFT_KEY_SET_REQ_MESSAGE
#define REGISTER_ACK_MESSAGE
#define DISPLAY_NOTIFY_MESSAGE
#define SKINNY_DEVICE_7910
#define AST_MUTEX_DEFINE_STATIC(mutex)
#define SKINNY_DEVICE_7940
static char * handle_skinny_message_set(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
Handle sending messages to devices.
#define SKINNY_DEVICE_7906
#define CALL_INFO_MESSAGE
Structure for mutex and tracking information.
#define SERVICEURL_STAT_MESSAGE
static void send_displayprinotify(struct skinny_device *d, const char *text, const char *extratext, int timeout, int priority)
uint32_t stimulusInstance
static struct skinny_req * req_alloc(size_t size, int response_message)
struct ast_frame * ast_rtp_instance_read(struct ast_rtp_instance *instance, int rtcp)
Receive a frame over RTP.
static char vmexten[AST_MAX_EXTENSION]
#define OPEN_RECEIVE_CHANNEL_ACK_MESSAGE
#define ast_mutex_unlock(a)
#define DEVICE2STR_BUFSIZE
static struct ast_channel * skinny_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)
struct server_identifier server[5]
static void transmit_registerack(struct skinny_device *d)
static void transmit_softkeytemplateres(struct skinny_device *d)
static void destroy_rtp(struct skinny_subchannel *sub)
static int handle_onhook_message(struct skinny_req *req, struct skinnysession *s)
Channels have this property if they can create jitter; i.e. most VoIP channels.
#define KEYDEF_RINGOUTWITHTRANS
void astman_send_listack(struct mansession *s, const struct message *m, char *msg, char *listflag)
Send ack in manager transaction to begin a list.
struct ast_party_number number
Subscriber phone number.
static int handle_keypad_button_message(struct skinny_req *req, struct skinnysession *s)
#define ast_module_ref(mod)
Hold a reference to the module.
static void transmit_ringer_mode(struct skinny_device *d, int mode)
static void dialandactivatesub(struct skinny_subchannel *sub, char exten[AST_MAX_EXTENSION])