chan_skinny.c File Reference

Implementation of the Skinny protocol. More...

#include "asterisk.h"
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <fcntl.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <sys/signal.h>
#include <signal.h>
#include <ctype.h>
#include "asterisk/lock.h"
#include "asterisk/channel.h"
#include "asterisk/config.h"
#include "asterisk/module.h"
#include "asterisk/pbx.h"
#include "asterisk/sched.h"
#include "asterisk/io.h"
#include "asterisk/rtp_engine.h"
#include "asterisk/netsock2.h"
#include "asterisk/acl.h"
#include "asterisk/callerid.h"
#include "asterisk/cli.h"
#include "asterisk/manager.h"
#include "asterisk/say.h"
#include "asterisk/astdb.h"
#include "asterisk/causes.h"
#include "asterisk/pickup.h"
#include "asterisk/app.h"
#include "asterisk/musiconhold.h"
#include "asterisk/utils.h"
#include "asterisk/dsp.h"
#include "asterisk/stringfields.h"
#include "asterisk/abstract_jb.h"
#include "asterisk/threadstorage.h"
#include "asterisk/devicestate.h"
#include "asterisk/indications.h"
#include "asterisk/linkedlists.h"
#include "asterisk/stasis_endpoints.h"
#include "asterisk/bridge.h"
#include "asterisk/parking.h"
#include "asterisk/stasis_channels.h"
#include "asterisk/format_cache.h"

Include dependency graph for chan_skinny.c:

Go to the source code of this file.

Data Structures

struct  activate_call_plane_message
struct  alarm_message
struct  bksp_req_message
struct  button_definition
struct  button_definition_template
struct  button_template_res_message
struct  call_info_message
struct  call_info_message_variable
struct  call_state_message
struct  capabilities_res_message
struct  clear_display_message
struct  clear_prinotify_message
struct  clear_prompt_message
struct  close_receive_channel_message
struct  definetimedate_message
struct  devices
struct  dialed_number_message
struct  display_notify_message
struct  display_prinotify_message
struct  display_prinotify_message_variable
struct  display_prompt_status_message
struct  display_prompt_status_message_variable
struct  displaytext_message
struct  enbloc_call_message
struct  forward_stat_message
struct  keypad_button_message
struct  line_stat_res_message
struct  line_state_req_message
struct  lines
struct  media_qualifier
struct  offhook_message
struct  onhook_message
struct  open_receive_channel_ack_message_ip4
struct  open_receive_channel_ack_message_ip6
struct  open_receive_channel_message
struct  register_ack_message
struct  register_message
struct  register_rej_message
struct  reset_message
struct  select_soft_keys_message
struct  server_identifier
struct  server_res_message
struct  serviceurl_stat_message
struct  serviceurl_statreq_message
struct  sessions
struct  set_lamp_message
struct  set_microphone_message
struct  set_ringer_message
struct  set_speaker_message
struct  skinny_addon
struct  skinny_container
union  skinny_data
struct  skinny_device
struct  skinny_device_options
struct  skinny_line
struct  skinny_line_options
struct  skinny_req
struct  skinny_serviceurl
struct  skinny_speeddial
struct  skinny_subchannel
struct  skinny_subline
struct  skinnysession
struct  soft_key_definitions
struct  soft_key_event_message
struct  soft_key_set_definition
struct  soft_key_set_res_message
struct  soft_key_template_definition
struct  soft_key_template_res_message
struct  speed_dial_stat_req_message
struct  speed_dial_stat_res_message
struct  start_media_transmission_message_ip4
struct  start_media_transmission_message_ip6
struct  start_tone_message
struct  station_capabilities
struct  stimulus_message
struct  stop_media_transmission_message
struct  stop_tone_message
struct  version_res_message

Defines

#define __bswap_16(x)
#define __bswap_32(x)
#define ACTIVATE_CALL_PLANE_MESSAGE   0x0116
#define ALARM_MESSAGE   0x0020
#define BKSP_REQ_MESSAGE   0x0119
#define BT_AUTOANSWER   STIMULUS_AUTOANSWER
#define BT_CALLPARK   STIMULUS_CALLPARK
#define BT_CALLPICKUP   STIMULUS_CALLPICKUP
#define BT_CONFERENCE   STIMULUS_CONFERENCE
#define BT_CUST_LINE   0xB1
#define BT_CUST_LINESPEEDDIAL   0xB0
#define BT_DISPLAY   STIMULUS_DISPLAY
#define BT_DND   STIMULUS_DND
#define BT_FORWARDALL   STIMULUS_FORWARDALL
#define BT_FORWARDBUSY   STIMULUS_FORWARDBUSY
#define BT_FORWARDNOANSWER   STIMULUS_FORWARDNOANSWER
#define BT_HOLD   STIMULUS_HOLD
#define BT_LINE   STIMULUS_LINE
#define BT_NONE   0x00
#define BT_REDIAL   STIMULUS_REDIAL
#define BT_SERVICEURL   STIMULUS_SERVICEURL
#define BT_SPEEDDIAL   STIMULUS_SPEEDDIAL
#define BT_TRANSFER   STIMULUS_TRANSFER
#define BT_VOICEMAIL   STIMULUS_VOICEMAIL
#define BUTTON_TEMPLATE_REQ_MESSAGE   0x000E
#define BUTTON_TEMPLATE_RES_MESSAGE   0x0097
#define CALL_INFO_MESSAGE   0x008F
#define CALL_INFO_MESSAGE_VARIABLE   0x014A
#define CALL_STATE_MESSAGE   0x0111
#define CALLSTATE2STR_BUFSIZE   15
#define CAPABILITIES_REQ_MESSAGE   0x009B
#define CAPABILITIES_RES_MESSAGE   0x0010
#define CDEV   ((struct skinny_device *)item)
#define CDEV_OPTS   ((struct skinny_device_options *)item)
#define CLEAR_DISPLAY_MESSAGE   0x009A
#define CLEAR_NOTIFY_MESSAGE   0x0115
#define CLEAR_PRINOTIFY_MESSAGE   0x0121
#define CLEAR_PROMPT_MESSAGE   0x0113
#define CLINE   ((struct skinny_line *)item)
#define CLINE_OPTS   ((struct skinny_line_options *)item)
#define CLOSE_RECEIVE_CHANNEL_MESSAGE   0x0106
#define CONTROL2STR_BUFSIZE   100
#define DEFAULT_AUTH_LIMIT   50
#define DEFAULT_AUTH_TIMEOUT   30
#define DEFAULT_SKINNY_BACKLOG   2
#define DEFAULT_SKINNY_PORT   2000
#define DEFINETIMEDATE_MESSAGE   0x0094
#define DEVICE2STR_BUFSIZE   15
#define DIALED_NUMBER_MESSAGE   0x011D
#define DIALTYPE_CFWD   1<<1
#define DIALTYPE_NORMAL   1<<0
#define DIALTYPE_XFER   1<<2
#define DISPLAY_NOTIFY_MESSAGE   0x0114
#define DISPLAY_PRINOTIFY_MESSAGE   0x0120
#define DISPLAY_PRINOTIFY_MESSAGE_VARIABLE   0x0144
#define DISPLAY_PROMPT_STATUS_MESSAGE   0x0112
#define DISPLAY_PROMPT_STATUS_MESSAGE_VARIABLE   0x0145
#define DISPLAYTEXT_MESSAGE   0x0099
#define ENBLOC_CALL_MESSAGE   0x0004
#define FORWARD_STAT_MESSAGE   0x0090
#define HEADSET_STATUS_MESSAGE   0x002B
#define htolel(x)   __bswap_32(x)
#define htoles(x)   __bswap_16(x)
#define IP_PORT_MESSAGE   0x0002
#define KEEP_ALIVE_ACK_MESSAGE   0x0100
#define KEEP_ALIVE_MESSAGE   0x0000
#define KEYDEF_CONNECTED   1
#define KEYDEF_CONNWITHCONF   7
#define KEYDEF_CONNWITHTRANS   5
#define KEYDEF_DADFD   6
#define KEYDEF_OFFHOOK   4
#define KEYDEF_OFFHOOKWITHFEAT   9
#define KEYDEF_ONHOLD   2
#define KEYDEF_ONHOOK   0
#define KEYDEF_RINGIN   3
#define KEYDEF_RINGOUT   8
#define KEYDEF_RINGOUTWITHTRANS   13
#define KEYDEF_SLACONNECTEDNOTACTIVE   12
#define KEYDEF_SLAHOLD   11
#define KEYDEF_UNKNOWN   10
#define KEYMASK_ALL   0xFFFFFFFF
#define KEYMASK_ANSWER   (1 << 11)
#define KEYMASK_BKSPC   (1 << 8)
#define KEYMASK_CFWDALL   (1 << 5)
#define KEYMASK_CFWDBUSY   (1 << 6)
#define KEYMASK_CFWDNOANSWER   (1 << 7)
#define KEYMASK_CONFRN   (1 << 13)
#define KEYMASK_DND   (1 << 29)
#define KEYMASK_ENDCALL   (1 << 9)
#define KEYMASK_FORCEDIAL   (1 << 21)
#define KEYMASK_GPICKUP   (1 << 18)
#define KEYMASK_HOLD   (1 << 3)
#define KEYMASK_IDIVERT   (1 << 20)
#define KEYMASK_INFO   (1 << 12)
#define KEYMASK_JOIN   (1 << 15)
#define KEYMASK_MEETME   (1 << 16)
#define KEYMASK_NEWCALL   (1 << 2)
#define KEYMASK_NONE   (1 << 0)
#define KEYMASK_PARK   (1 << 14)
#define KEYMASK_PICKUP   (1 << 17)
#define KEYMASK_REDIAL   (1 << 1)
#define KEYMASK_RESUME   (1 << 10)
#define KEYMASK_TRNSFER   (1 << 4)
#define KEYPAD_BUTTON_MESSAGE   0x0003
#define letohl(x)   __bswap_32(x)
#define letohs(x)   __bswap_16(x)
#define LINE_STAT_RES_MESSAGE   0x0092
#define LINE_STATE_REQ_MESSAGE   0x000B
#define MAX_SERVICEURL   256
#define MAXCALLINFOSTR   256
#define MAXDISPLAYNOTIFYSTR   32
#define OCTAL_ANSWER   "\200\013"
#define OCTAL_BARGE   "\200\103"
#define OCTAL_BARGEEXIST   "\200\105"
#define OCTAL_BARGEFAIL   "\200\104"
#define OCTAL_BKSPC   "\200\010"
#define OCTAL_BUSY   "\200\031"
#define OCTAL_CALLBACK   "\200\101"
#define OCTAL_CALLDURTIMEOUT   "\200\131"
#define OCTAL_CALLPARK   "\200\035"
#define OCTAL_CALLPROCEED   "\200\036"
#define OCTAL_CALLWAITING   "\200\033"
#define OCTAL_CALLXFER   "\200\034"
#define OCTAL_CANTCOMPCNF   "\200\046"
#define OCTAL_CANTCOMPLXFER   "\200\122"
#define OCTAL_CANTJOINCALLS   "\200\123"
#define OCTAL_CBARGE   "\200\121"
#define OCTAL_CFWDALL   "\200\005"
#define OCTAL_CFWDBUSY   "\200\006"
#define OCTAL_CFWDNOAN   "\200\007"
#define OCTAL_CM1   "\200\167"
#define OCTAL_CM2   "\200\170"
#define OCTAL_CM3   "\200\171"
#define OCTAL_CM4   "\200\172"
#define OCTAL_CM5   "\200\173"
#define OCTAL_CONFERENCE   "\200\064"
#define OCTAL_CONFLIST   "\200\117"
#define OCTAL_CONFRN   "\200\015"
#define OCTAL_CONNECTED   "\200\030"
#define OCTAL_CUROPTS   "\200\023"
#define OCTAL_DIRTRFR   "\200\115"
#define OCTAL_DIVALL   "\200\100"
#define OCTAL_DND   "\200\077"
#define OCTAL_DNS1   "\200\160"
#define OCTAL_DNS2   "\200\161"
#define OCTAL_DNS3   "\200\162"
#define OCTAL_DNS4   "\200\163"
#define OCTAL_DNS5   "\200\164"
#define OCTAL_DOMAIN   "\200\147"
#define OCTAL_ENDCALL   "\200\011"
#define OCTAL_ENTRNUM   "\200\040"
#define OCTAL_ERRDB   "\200\060"
#define OCTAL_ERRDBCFG   "\200\057"
#define OCTAL_ERRMISMATCH   "\200\063"
#define OCTAL_ERRNOLIC   "\200\056"
#define OCTAL_ERRPASSLMT   "\200\061"
#define OCTAL_ERRUNK   "\200\062"
#define OCTAL_EXTXFERRESTRICT   "\200\141"
#define OCTAL_FROM   "\200\027"
#define OCTAL_FWDEDTO   "\200\045"
#define OCTAL_GPICKUP   "\200\022"
#define OCTAL_HAVEVMAIL   "\200\044"
#define OCTAL_HITRAFFIC   "\200\112"
#define OCTAL_HOLD   "\200\003"
#define OCTAL_HOLDDURTIMEOUT   "\200\132"
#define OCTAL_HOST   "\200\146"
#define OCTAL_IDIVERT   "\200\120"
#define OCTAL_IMMDIV   "\200\073"
#define OCTAL_INCOMPATDEV   "\200\106"
#define OCTAL_INCONFALREADY   "\200\052"
#define OCTAL_INFO   "\200\014"
#define OCTAL_INSUFBANDW   "\200\067"
#define OCTAL_INTRCPT   "\200\074"
#define OCTAL_INUSEREMOTE   "\200\037"
#define OCTAL_INVALCONFPART   "\200\051"
#define OCTAL_IPADD   "\200\150"
#define OCTAL_JOIN   "\200\017"
#define OCTAL_KEYNOTACTIVE   "\200\055"
#define OCTAL_LINEINUSE   "\200\032"
#define OCTAL_MACADD   "\200\145"
#define OCTAL_MAXPARTEXCEED   "\200\054"
#define OCTAL_MCID   "\200\114"
#define OCTAL_MCIDSUCCESS   "\200\124"
#define OCTAL_MEETME   "\200\020"
#define OCTAL_NETCNGREROUT   "\200\102"
#define OCTAL_NEWCALL   "\200\002"
#define OCTAL_NOCONFBRDG   "\200\047"
#define OCTAL_NOPARTINFO   "\200\053"
#define OCTAL_NOPRIMARYCTL   "\200\050"
#define OCTAL_NUMNOTCFG   "\200\125"
#define OCTAL_OFFHOOK   "\200\024"
#define OCTAL_ONHOOK   "\200\025"
#define OCTAL_OPICKUP   "\200\133"
#define OCTAL_PARK   "\200\016"
#define OCTAL_PARKAT   "\200\041"
#define OCTAL_PARKNO   "\200\065"
#define OCTAL_PARKNONUM   "\200\107"
#define OCTAL_PARKREVERSION   "\200\110"
#define OCTAL_PICKUP   "\200\021"
#define OCTAL_PRIMONLY   "\200\042"
#define OCTAL_PRIVATE   "\200\066"
#define OCTAL_QRT   "\200\113"
#define OCTAL_REDIAL   "\200\001"
#define OCTAL_RESUME   "\200\012"
#define OCTAL_RINGOUT   "\200\026"
#define OCTAL_RMLSTC   "\200\071"
#define OCTAL_ROUTER1   "\200\153"
#define OCTAL_ROUTER2   "\200\154"
#define OCTAL_ROUTER3   "\200\155"
#define OCTAL_ROUTER4   "\200\156"
#define OCTAL_ROUTER5   "\200\157"
#define OCTAL_SECERROR   "\200\126"
#define OCTAL_SELECT   "\200\116"
#define OCTAL_SETWTCH   "\200\075"
#define OCTAL_SRVNOTACTIVE   "\200\111"
#define OCTAL_SUBMASK   "\200\151"
#define OCTAL_TFTP1   "\200\152"
#define OCTAL_TMPFAIL   "\200\043"
#define OCTAL_TRANSFER   "\200\004"
#define OCTAL_TRNSFVM   "\200\076"
#define OCTAL_UNKNUM   "\200\070"
#define OCTAL_URLDIRS   "\200\175"
#define OCTAL_URLINFO   "\200\174"
#define OCTAL_URLMSGS   "\200\176"
#define OCTAL_URLSRVS   "\200\177"
#define OCTAL_VIDBANDWNA   "\200\127"
#define OCTAL_VIDMODE   "\200\130"
#define OCTAL_VLANADID   "\200\166"
#define OCTAL_VLANOPID   "\200\165"
#define OCTAL_VOICEMAIL   "\200\072"
#define OFFHOOK_MESSAGE   0x0006
#define ONHOOK_MESSAGE   0x0007
#define OPEN_RECEIVE_CHANNEL_ACK_MESSAGE   0x0022
#define OPEN_RECEIVE_CHANNEL_MESSAGE   0x0105
#define REGISTER_ACK_MESSAGE   0x0081
#define REGISTER_AVAILABLE_LINES_MESSAGE   0x002D
#define REGISTER_MESSAGE   0x0001
#define REGISTER_REJ_MESSAGE   0x009D
#define RESET_MESSAGE   0x009F
#define SELECT_SOFT_KEYS_MESSAGE   0x0110
#define SERVER_REQUEST_MESSAGE   0x0012
#define SERVER_RES_MESSAGE   0x009E
#define SERVICEURL_STAT_MESSAGE   0x012F
#define SERVICEURL_STATREQ_MESSAGE   0x0033
#define SET_LAMP_MESSAGE   0x0086
#define SET_MICROPHONE_MESSAGE   0x0089
#define SET_RINGER_MESSAGE   0x0085
#define SET_SPEAKER_MESSAGE   0x0088
#define SKINNY_ALERT   0x24
#define SKINNY_BARGIN   0x43
#define SKINNY_BEEPBONK   0x33
#define SKINNY_BUSY   6
#define SKINNY_BUSYTONE   0x23
#define SKINNY_CALLREMOTEMULTILINE   13
#define SKINNY_CALLWAIT   9
#define SKINNY_CALLWAITTONE   0x2D
#define SKINNY_CFWD_ALL   (1 << 0)
#define SKINNY_CFWD_BUSY   (1 << 1)
#define SKINNY_CFWD_NOANSWER   (1 << 2)
#define SKINNY_CONGESTION   7
#define SKINNY_CONNECTED   5
#define SKINNY_CX_CONF   3
#define SKINNY_CX_CONFERENCE   3
#define SKINNY_CX_INACTIVE   4
#define SKINNY_CX_MUTE   4
#define SKINNY_CX_RECVONLY   1
#define SKINNY_CX_SENDONLY   0
#define SKINNY_CX_SENDRECV   2
#define SKINNY_DEBUG(type, verb_level, text,...)
#define SKINNY_DEVICE_12   4
#define SKINNY_DEVICE_12SP   3
#define SKINNY_DEVICE_12SPPLUS   2
#define SKINNY_DEVICE_30SPPLUS   1
#define SKINNY_DEVICE_30VIP   5
#define SKINNY_DEVICE_7902   30008
#define SKINNY_DEVICE_7905   20000
#define SKINNY_DEVICE_7906   369
#define SKINNY_DEVICE_7910   6
#define SKINNY_DEVICE_7911   307
#define SKINNY_DEVICE_7912   30007
#define SKINNY_DEVICE_7914   124
#define SKINNY_DEVICE_7920   30002
#define SKINNY_DEVICE_7921   365
#define SKINNY_DEVICE_7931   348
#define SKINNY_DEVICE_7935   9
#define SKINNY_DEVICE_7936   30019
#define SKINNY_DEVICE_7937   431
#define SKINNY_DEVICE_7940   8
#define SKINNY_DEVICE_7941   115
#define SKINNY_DEVICE_7941GE   309
#define SKINNY_DEVICE_7942   434
#define SKINNY_DEVICE_7945   435
#define SKINNY_DEVICE_7960   7
#define SKINNY_DEVICE_7961   30018
#define SKINNY_DEVICE_7961GE   308
#define SKINNY_DEVICE_7962   404
#define SKINNY_DEVICE_7965   436
#define SKINNY_DEVICE_7970   30006
#define SKINNY_DEVICE_7971   119
#define SKINNY_DEVICE_7975   437
#define SKINNY_DEVICE_7985   302
#define SKINNY_DEVICE_ATA186   12
#define SKINNY_DEVICE_CIPC   30016
#define SKINNY_DEVICE_NONE   0
#define SKINNY_DEVICE_OPTIONS
#define SKINNY_DEVICE_SCCPGATEWAY_AN   30027
#define SKINNY_DEVICE_SCCPGATEWAY_BRI   30028
#define SKINNY_DEVICE_UNKNOWN   -1
#define SKINNY_DEVICECONTAINER   1
#define SKINNY_DIALTONE   0x21
#define SKINNY_HOLD   8
#define SKINNY_INCOMING   1
#define SKINNY_INVALID   14
#define SKINNY_LAMP_BLINK   5
#define SKINNY_LAMP_FLASH   4
#define SKINNY_LAMP_OFF   1
#define SKINNY_LAMP_ON   2
#define SKINNY_LAMP_WINK   3
#define SKINNY_LINE_OPTIONS
#define SKINNY_LINECONTAINER   2
#define SKINNY_MAX_CAPABILITIES   18
#define SKINNY_MAX_PACKET   2000
#define SKINNY_MICOFF   2
#define SKINNY_MICON   1
#define SKINNY_NOTONE   0x7F
#define SKINNY_OFFHOOK   1
#define SKINNY_ONHOOK   2
#define SKINNY_OUTGOING   2
#define SKINNY_PARK   11
#define SKINNY_PROGRESS   12
#define SKINNY_REORDER   0x25
#define SKINNY_RING_FEATURE   4
#define SKINNY_RING_INSIDE   2
#define SKINNY_RING_OFF   1
#define SKINNY_RING_OUTSIDE   3
#define SKINNY_RINGIN   4
#define SKINNY_RINGOUT   3
#define SKINNY_SDCONTAINER   4
#define SKINNY_SILENCE   0x00
#define SKINNY_SPEAKEROFF   2
#define SKINNY_SPEAKERON   1
#define SKINNY_SUBLINECONTAINER   3
#define SKINNY_TRANSFER   10
#define SKINNY_ZIP   0x32
#define SKINNY_ZIPZIP   0x31
#define SOFT_KEY_EVENT_MESSAGE   0x0026
#define SOFT_KEY_SET_REQ_MESSAGE   0x0025
#define SOFT_KEY_SET_RES_MESSAGE   0x0109
#define SOFT_KEY_TEMPLATE_REQ_MESSAGE   0x0028
#define SOFT_KEY_TEMPLATE_RES_MESSAGE   0x0108
#define SOFTKEY_ANSWER   0x0B
#define SOFTKEY_BKSPC   0x08
#define SOFTKEY_CFWDALL   0x05
#define SOFTKEY_CFWDBUSY   0x06
#define SOFTKEY_CFWDNOANSWER   0x07
#define SOFTKEY_CONFRN   0x0D
#define SOFTKEY_DND   0x13
#define SOFTKEY_ENDCALL   0x09
#define SOFTKEY_FORCEDIAL   0x15
#define SOFTKEY_GPICKUP   0x12
#define SOFTKEY_HOLD   0x03
#define SOFTKEY_IDIVERT   0x14
#define SOFTKEY_INFO   0x0C
#define SOFTKEY_JOIN   0x0F
#define SOFTKEY_MEETME   0x10
#define SOFTKEY_NEWCALL   0x02
#define SOFTKEY_NONE   0x00
#define SOFTKEY_PARK   0x0E
#define SOFTKEY_PICKUP   0x11
#define SOFTKEY_REDIAL   0x01
#define SOFTKEY_RESUME   0x0A
#define SOFTKEY_TRNSFER   0x04
#define SPEED_DIAL_STAT_REQ_MESSAGE   0x000A
#define SPEED_DIAL_STAT_RES_MESSAGE   0x0091
#define START_MEDIA_TRANSMISSION_MESSAGE   0x008A
#define START_TONE_MESSAGE   0x0082
#define STIMULUS_AUTOANSWER   0x11
#define STIMULUS_CALLPARK   0x7E
#define STIMULUS_CALLPICKUP   0x7F
#define STIMULUS_CONFERENCE   0x7D
#define STIMULUS_DISPLAY   0x08
#define STIMULUS_DND   0x3F
#define STIMULUS_FORWARDALL   0x05
#define STIMULUS_FORWARDBUSY   0x06
#define STIMULUS_FORWARDNOANSWER   0x07
#define STIMULUS_HOLD   0x03
#define STIMULUS_LINE   0x09
#define STIMULUS_MESSAGE   0x0005
#define STIMULUS_NONE   0xFF
#define STIMULUS_REDIAL   0x01
#define STIMULUS_SERVICEURL   0x14
#define STIMULUS_SPEEDDIAL   0x02
#define STIMULUS_TRANSFER   0x04
#define STIMULUS_VOICEMAIL   0x0F
#define STOP_MEDIA_TRANSMISSION_MESSAGE   0x008B
#define STOP_TONE_MESSAGE   0x0083
#define SUBSTATE2STR_BUFSIZE   15
#define SUBSTATE_BUSY   6
#define SUBSTATE_CALLWAIT   9
#define SUBSTATE_CONGESTION   7
#define SUBSTATE_CONNECTED   5
#define SUBSTATE_DIALING   101
#define SUBSTATE_HOLD   8
#define SUBSTATE_OFFHOOK   1
#define SUBSTATE_ONHOOK   2
#define SUBSTATE_PROGRESS   12
#define SUBSTATE_RINGIN   4
#define SUBSTATE_RINGOUT   3
#define SUBSTATE_UNSET   0
#define TIME_DATE_REQ_MESSAGE   0x000D
#define TYPE_DEF_DEVICE   2
#define TYPE_DEF_LINE   4
#define TYPE_DEVICE   8
#define TYPE_GENERAL   1
#define TYPE_LINE   16
#define UNREGISTER_MESSAGE   0x0027
#define VERSION_REQ_MESSAGE   0x000F
#define VERSION_RES_MESSAGE   0x0098

Enumerations

enum  skinny_codecs {
  SKINNY_CODEC_ALAW = 2, SKINNY_CODEC_ULAW = 4, SKINNY_CODEC_G722 = 6, SKINNY_CODEC_G723_1 = 9,
  SKINNY_CODEC_G729A = 12, SKINNY_CODEC_G726_32 = 82, SKINNY_CODEC_H261 = 100, SKINNY_CODEC_H263 = 101
}

Functions

static void __init_callstate2str_threadbuf (void)
static void __init_control2str_threadbuf (void)
static void __init_device2str_threadbuf (void)
static void __init_substate2str_threadbuf (void)
static void __reg_module (void)
static void __unreg_module (void)
static char * _skinny_message_clear (int type, int fd, struct mansession *s, const struct message *m, int argc, const char *const *argv)
static char * _skinny_message_set (int type, int fd, struct mansession *s, const struct message *m, int argc, const char *const *argv)
static char * _skinny_show_device (int type, int fd, struct mansession *s, const struct message *m, int argc, const char *const *argv)
static char * _skinny_show_devices (int fd, int *total, struct mansession *s, const struct message *m, int argc, const char *const *argv)
static char * _skinny_show_line (int type, int fd, struct mansession *s, const struct message *m, int argc, const char *const *argv)
static char * _skinny_show_lines (int fd, int *total, struct mansession *s, const struct message *m, int argc, const char *const *argv)
static void _transmit_displayprinotify (struct skinny_device *d, const char *text, const char *extratext, int timeout, int priority)
static void _transmit_displayprinotifyvar (struct skinny_device *d, const char *text, const char *extratext, int timeout, int priority)
static void * accept_thread (void *ignore)
static void activatesub (struct skinny_subchannel *sub, int state)
static struct ast_variableadd_var (const char *buf, struct ast_variable *list)
static void cleanup_stale_contexts (char *new, char *old)
static int codec_ast2skinny (const struct ast_format *astcodec)
static struct ast_formatcodec_skinny2ast (enum skinny_codecs skinnycodec)
static char * complete_skinny_devices (const char *word, int state)
static char * complete_skinny_reset (const char *line, const char *word, int pos, int state)
static char * complete_skinny_show_device (const char *line, const char *word, int pos, int state)
static char * complete_skinny_show_line (const char *line, const char *word, int pos, int state)
static struct skinny_deviceconfig_device (const char *dname, struct ast_variable *v)
static struct skinny_lineconfig_line (const char *lname, struct ast_variable *v)
static int config_load (void)
static void config_parse_variables (int type, void *item, struct ast_variable *vptr)
static char * control2str (int ind)
static void delete_devices (void)
static void destroy_rtp (struct skinny_subchannel *sub)
static void destroy_session (struct skinnysession *s)
static char * device2str (int type)
static void dialandactivatesub (struct skinny_subchannel *sub, char exten[AST_MAX_EXTENSION])
static void dumpsub (struct skinny_subchannel *sub, int forcehangup)
static void end_session (struct skinnysession *s)
static struct skinny_linefind_line_by_instance (struct skinny_device *d, int instance)
static struct skinny_linefind_line_by_name (const char *dest)
static struct skinny_speeddialfind_speeddial_by_instance (struct skinny_device *d, int instance, int isHint)
static struct skinny_subchannelfind_subchannel_by_instance_reference (struct skinny_device *d, int instance, int reference)
static struct skinny_subchannelfind_subchannel_by_reference (struct skinny_device *d, int reference)
static struct skinny_sublinefind_subline_by_callid (struct skinny_device *d, int callid)
static struct skinny_sublinefind_subline_by_name (const char *dest)
static void * get_button_template (struct skinnysession *s, struct button_definition_template *btn)
static int get_devicestate (struct skinny_line *l)
static int handle_button_template_req_message (struct skinny_req *req, struct skinnysession *s)
static void handle_callforward_button (struct skinny_line *l, struct skinny_subchannel *sub, int cfwdtype)
static int handle_capabilities_res_message (struct skinny_req *req, struct skinnysession *s)
static int handle_enbloc_call_message (struct skinny_req *req, struct skinnysession *s)
static int handle_hold_button (struct skinny_subchannel *sub)
static int handle_ip_port_message (struct skinny_req *req, struct skinnysession *s)
static void handle_keepalive_message (struct skinny_req *req, struct skinnysession *s)
static int handle_keypad_button_message (struct skinny_req *req, struct skinnysession *s)
static int handle_message (struct skinny_req *req, struct skinnysession *s)
static int handle_offhook_message (struct skinny_req *req, struct skinnysession *s)
static int handle_onhook_message (struct skinny_req *req, struct skinnysession *s)
static int handle_open_receive_channel_ack_message (struct skinny_req *req, struct skinnysession *s)
static char * handle_skinny_message_clear (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 Handle clearing messages to devices.
static char * handle_skinny_message_set (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 Handle sending messages to devices.
static char * handle_skinny_reload (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static char * handle_skinny_reset (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static char * handle_skinny_show_device (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 Show device information.
static char * handle_skinny_show_devices (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static char * handle_skinny_show_line (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 List line information.
static char * handle_skinny_show_lines (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
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.
static int handle_soft_key_event_message (struct skinny_req *req, struct skinnysession *s)
static int handle_stimulus_message (struct skinny_req *req, struct skinnysession *s)
static int handle_transfer_button (struct skinny_subchannel *sub)
static int keyset_translatebitmask (int keyset, int intmask)
static int load_module (void)
 Load the module.
static int manager_skinny_show_device (struct mansession *s, const struct message *m)
static int manager_skinny_show_devices (struct mansession *s, const struct message *m)
 Show SKINNY devices in the manager API.
static int manager_skinny_show_line (struct mansession *s, const struct message *m)
static int manager_skinny_show_lines (struct mansession *s, const struct message *m)
 Show Skinny lines in the manager API.
static void mwi_event_cb (void *userdata, struct stasis_subscription *sub, struct stasis_message *msg)
static void push_callinfo (struct skinny_subline *subline, struct skinny_subchannel *sub)
static void register_exten (struct skinny_line *l)
static int reload (void)
static struct skinny_reqreq_alloc (size_t size, int response_message)
static void send_callinfo (struct skinny_subchannel *sub)
static void send_displayprinotify (struct skinny_device *d, const char *text, const char *extratext, int timeout, int priority)
static void send_displaypromptstatus (struct skinny_device *d, const char *text, const char *extratext, int t, int instance, int callid)
static int set_callforwards (struct skinny_line *l, const char *cfwd, int cfwdtype)
static void setsubstate (struct skinny_subchannel *sub, int state)
static int skinny_answer (struct ast_channel *ast)
static int skinny_autoanswer_cb (const void *data)
static int skinny_call (struct ast_channel *ast, const char *dest, int timeout)
static int skinny_cfwd_cb (const void *data)
static struct skinny_deviceskinny_device_alloc (const char *dname)
static struct skinny_deviceskinny_device_destroy (struct skinny_device *d)
static int skinny_devicestate (const char *data)
static void skinny_dialer (struct skinny_subchannel *sub, int timedout)
static int skinny_dialer_cb (const void *data)
static int skinny_extensionstate_cb (char *context, char *id, struct ast_state_cb_info *info, void *data)
static int skinny_fixup (struct ast_channel *oldchan, struct ast_channel *newchan)
static enum ast_rtp_glue_result skinny_get_rtp_peer (struct ast_channel *c, struct ast_rtp_instance **instance)
static enum ast_rtp_glue_result skinny_get_vrtp_peer (struct ast_channel *c, struct ast_rtp_instance **instance)
static int skinny_hangup (struct ast_channel *ast)
static int skinny_indicate (struct ast_channel *ast, int ind, const void *data, size_t datalen)
static struct skinny_lineskinny_line_alloc (void)
static struct skinny_lineskinny_line_destroy (struct skinny_line *l)
static void skinny_locksub (struct skinny_subchannel *sub)
static struct ast_channelskinny_new (struct skinny_line *l, struct skinny_subline *subline, int state, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, int direction)
static void * skinny_newcall (void *data)
static int skinny_noauth_cb (const void *data)
static int skinny_nokeepalive_cb (const void *data)
static struct ast_frameskinny_read (struct ast_channel *ast)
static int skinny_register (struct skinny_req *req, struct skinnysession *s)
static int skinny_reload (void)
static struct ast_channelskinny_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)
static struct ast_frameskinny_rtp_read (struct skinny_subchannel *sub)
static int skinny_sched_add (int when, ast_sched_cb callback, struct skinny_subchannel *sub)
static int skinny_sched_del (int sched_id, struct skinny_subchannel *sub)
static int skinny_senddigit_begin (struct ast_channel *ast, char digit)
static int skinny_senddigit_end (struct ast_channel *ast, char digit, unsigned int duration)
static void * skinny_session (void *data)
static void skinny_session_cleanup (void *data)
static void skinny_set_owner (struct skinny_subchannel *sub, struct ast_channel *chan)
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 void skinny_transfer_attended (struct skinny_subchannel *sub)
static void skinny_transfer_blind (struct skinny_subchannel *sub)
static void skinny_unlocksub (struct skinny_subchannel *sub)
static int skinny_write (struct ast_channel *ast, struct ast_frame *frame)
static void start_rtp (struct skinny_subchannel *sub)
static char * substate2str (int ind)
static void transmit_activatecallplane (struct skinny_device *d, struct skinny_line *l)
static void transmit_backspace (struct skinny_device *d, int instance, unsigned callid)
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)
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)
static void transmit_callstate (struct skinny_device *d, int buttonInstance, unsigned callid, int state)
static void transmit_capabilitiesreq (struct skinny_device *d)
static void transmit_cfwdstate (struct skinny_device *d, struct skinny_line *l)
static void transmit_clear_display_message (struct skinny_device *d, int instance, int reference)
static void transmit_clearprinotify (struct skinny_device *d, int priority)
static void transmit_clearpromptmessage (struct skinny_device *d, int instance, int callid)
static void transmit_closereceivechannel (struct skinny_device *d, struct skinny_subchannel *sub)
static void transmit_connect (struct skinny_device *d, struct skinny_subchannel *sub)
static void transmit_definetimedate (struct skinny_device *d)
static void transmit_dialednumber (struct skinny_device *d, const char *text, int instance, int callid)
static void transmit_displaynotify (struct skinny_device *d, const char *text, int t)
static void transmit_displaypromptstatus (struct skinny_device *d, const char *text, const char *extratext, int t, int instance, int callid)
static void transmit_displaypromptstatusvar (struct skinny_device *d, const char *text, const char *extratext, int t, int instance, int callid)
static void transmit_keepaliveack (struct skinnysession *s)
static void transmit_lamp_indication (struct skinny_device *d, int stimulus, int instance, int indication)
static void transmit_linestatres (struct skinny_device *d, int instance)
static void transmit_microphone_mode (struct skinny_device *d, int mode)
static void transmit_registerack (struct skinny_device *d)
static void transmit_registerrej (struct skinnysession *s)
static void transmit_reset (struct skinny_device *d, int fullrestart)
static void transmit_response (struct skinny_device *d, struct skinny_req *req)
static int transmit_response_bysession (struct skinnysession *s, struct skinny_req *req)
static void transmit_ringer_mode (struct skinny_device *d, int mode)
static void transmit_selectsoftkeys (struct skinny_device *d, int instance, int callid, int softkey, int mask)
static void transmit_serverres (struct skinny_device *d)
static void transmit_serviceurlstat (struct skinny_device *d, int instance)
static void transmit_softkeysetres (struct skinny_device *d)
static void transmit_softkeytemplateres (struct skinny_device *d)
static void transmit_speaker_mode (struct skinny_device *d, int mode)
static void transmit_speeddialstatres (struct skinny_device *d, struct skinny_speeddial *sd)
static void transmit_start_tone (struct skinny_device *d, int tone, int instance, int reference)
static void transmit_startmediatransmission (struct skinny_device *d, struct skinny_subchannel *sub, struct sockaddr_in dest, struct ast_format *format, unsigned int framing)
static void transmit_stop_tone (struct skinny_device *d, int instance, int reference)
static void transmit_stopmediatransmission (struct skinny_device *d, struct skinny_subchannel *sub)
static void transmit_versionres (struct skinny_device *d)
static int unload_module (void)
static void unregister_exten (struct skinny_line *l)
static void update_connectedline (struct skinny_subchannel *sub, const void *data, size_t datalen)

Variables

static struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Skinny Client Control Protocol (Skinny)" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = AST_BUILDOPT_SUM, .support_level = AST_MODULE_SUPPORT_EXTENDED, .load = load_module, .unload = unload_module, .reload = reload, .load_pri = AST_MODPRI_CHANNEL_DRIVER, }
static struct in_addr __ourip
static pthread_t accept_t
static struct ast_hostent ahp
static struct ast_module_infoast_module_info = &__mod_info
static int auth_limit = DEFAULT_AUTH_LIMIT
static int auth_timeout = DEFAULT_AUTH_TIMEOUT
static struct sockaddr_in bindaddr
static int callnums = 1
static struct ast_threadstorage callstate2str_threadbuf = { .once = PTHREAD_ONCE_INIT , .key_init = __init_callstate2str_threadbuf , .custom_init = NULL , }
static struct ast_cli_entry cli_skinny []
static const char config [] = "skinny.conf"
static struct ast_threadstorage control2str_threadbuf = { .once = PTHREAD_ONCE_INIT , .key_init = __init_control2str_threadbuf , .custom_init = NULL , }
static char date_format [6] = "D-M-Y"
static struct ast_format_capdefault_cap
static struct
skinny_device_options
default_device = &default_device_struct
static struct skinny_device_options default_device_struct
static struct ast_jb_conf default_jbconf
static struct skinny_line_optionsdefault_line = &default_line_struct
static struct skinny_line_options default_line_struct
static struct ast_threadstorage device2str_threadbuf = { .once = PTHREAD_ONCE_INIT , .key_init = __init_device2str_threadbuf , .custom_init = NULL , }
static int firstdigittimeout = 16000
static int gendigittimeout = 8000
static struct ast_jb_conf global_jbconf
static struct hostent * hp
static char immed_dialchar
static int keep_alive = 120
static int matchdigittimeout = 3000
static ast_mutex_t netlock = { PTHREAD_MUTEX_INITIALIZER , NULL, 1 }
static char ourhost [256]
static int ourport
struct {
   unsigned int   cos
   unsigned int   cos_audio
   unsigned int   cos_video
   unsigned int   tos
   unsigned int   tos_audio
   unsigned int   tos_video
qos
static char regcontext [AST_MAX_CONTEXT]
static struct ast_sched_contextsched = NULL
static int skinny_header_size = 12
static struct ast_rtp_glue skinny_rtp_glue
static struct ast_channel_tech skinny_tech
static int skinnyreload = 0
static int skinnysock = -1
static const uint8_t soft_key_default_connected []
static const uint8_t soft_key_default_connwithconf []
static const uint8_t soft_key_default_connwithtrans []
static const uint8_t soft_key_default_dadfd []
static struct soft_key_definitions soft_key_default_definitions []
static const uint8_t soft_key_default_offhook []
static const uint8_t soft_key_default_offhookwithfeat []
static const uint8_t soft_key_default_onhold []
static const uint8_t soft_key_default_onhook []
static const uint8_t soft_key_default_ringin []
static const uint8_t soft_key_default_ringout []
static const uint8_t soft_key_default_ringoutwithtransfer []
static const uint8_t soft_key_default_SLAconnectednotactive []
static const uint8_t soft_key_default_SLAhold []
static const uint8_t soft_key_default_unknown []
static struct
soft_key_template_definition 
soft_key_template_default []
static struct ast_threadstorage substate2str_threadbuf = { .once = PTHREAD_ONCE_INIT , .key_init = __init_substate2str_threadbuf , .custom_init = NULL , }
static const char tdesc [] = "Skinny Client Control Protocol (Skinny)"
static int unauth_sessions = 0
static char used_context [AST_MAX_EXTENSION]
static char version_id [16] = "P002F202"
static char vmexten [AST_MAX_EXTENSION]


Detailed Description

Implementation of the Skinny protocol.

Author:
Jeremy McNamara & Florian Overkamp & North Antara

Definition in file chan_skinny.c.


Define Documentation

#define __bswap_16 (  ) 

Value:

((((x) & 0xff00) >> 8) | \
    (((x) & 0x00ff) << 8))

Definition at line 239 of file chan_skinny.c.

#define __bswap_32 (  ) 

Value:

((((x) & 0xff000000) >> 24) | \
    (((x) & 0x00ff0000) >>  8) | \
    (((x) & 0x0000ff00) <<  8) | \
    (((x) & 0x000000ff) << 24))

Definition at line 242 of file chan_skinny.c.

#define ACTIVATE_CALL_PLANE_MESSAGE   0x0116

Definition at line 1094 of file chan_skinny.c.

Referenced by transmit_activatecallplane().

#define ALARM_MESSAGE   0x0020

Definition at line 370 of file chan_skinny.c.

Referenced by handle_message().

#define BKSP_REQ_MESSAGE   0x0119

Definition at line 690 of file chan_skinny.c.

Referenced by transmit_backspace().

#define BT_AUTOANSWER   STIMULUS_AUTOANSWER

Definition at line 604 of file chan_skinny.c.

#define BT_CALLPARK   STIMULUS_CALLPARK

Definition at line 608 of file chan_skinny.c.

Referenced by get_button_template().

#define BT_CALLPICKUP   STIMULUS_CALLPICKUP

Definition at line 609 of file chan_skinny.c.

#define BT_CONFERENCE   STIMULUS_CONFERENCE

Definition at line 607 of file chan_skinny.c.

Referenced by get_button_template().

#define BT_CUST_LINE   0xB1

Definition at line 616 of file chan_skinny.c.

Referenced by get_button_template(), and handle_button_template_req_message().

#define BT_CUST_LINESPEEDDIAL   0xB0

Definition at line 615 of file chan_skinny.c.

Referenced by get_button_template(), and handle_button_template_req_message().

#define BT_DISPLAY   STIMULUS_DISPLAY

Definition at line 601 of file chan_skinny.c.

Referenced by get_button_template().

#define BT_DND   STIMULUS_DND

Definition at line 606 of file chan_skinny.c.

#define BT_FORWARDALL   STIMULUS_FORWARDALL

Definition at line 598 of file chan_skinny.c.

Referenced by get_button_template().

#define BT_FORWARDBUSY   STIMULUS_FORWARDBUSY

Definition at line 599 of file chan_skinny.c.

#define BT_FORWARDNOANSWER   STIMULUS_FORWARDNOANSWER

Definition at line 600 of file chan_skinny.c.

#define BT_HOLD   STIMULUS_HOLD

Definition at line 596 of file chan_skinny.c.

Referenced by get_button_template().

#define BT_LINE   STIMULUS_LINE

Definition at line 602 of file chan_skinny.c.

Referenced by get_button_template(), and handle_button_template_req_message().

#define BT_NONE   0x00

Definition at line 610 of file chan_skinny.c.

Referenced by get_button_template(), and handle_button_template_req_message().

#define BT_REDIAL   STIMULUS_REDIAL

Definition at line 594 of file chan_skinny.c.

Referenced by get_button_template().

#define BT_SERVICEURL   STIMULUS_SERVICEURL

Definition at line 605 of file chan_skinny.c.

Referenced by handle_button_template_req_message().

#define BT_SPEEDDIAL   STIMULUS_SPEEDDIAL

Definition at line 595 of file chan_skinny.c.

Referenced by get_button_template(), and handle_button_template_req_message().

#define BT_TRANSFER   STIMULUS_TRANSFER

Definition at line 597 of file chan_skinny.c.

Referenced by get_button_template().

#define BT_VOICEMAIL   STIMULUS_VOICEMAIL

Definition at line 603 of file chan_skinny.c.

Referenced by get_button_template().

#define BUTTON_TEMPLATE_REQ_MESSAGE   0x000E

Definition at line 366 of file chan_skinny.c.

Referenced by handle_message().

#define BUTTON_TEMPLATE_RES_MESSAGE   0x0097

Definition at line 563 of file chan_skinny.c.

Referenced by handle_button_template_req_message().

#define CALL_INFO_MESSAGE   0x008F

Definition at line 501 of file chan_skinny.c.

Referenced by transmit_callinfo().

#define CALL_INFO_MESSAGE_VARIABLE   0x014A

Definition at line 1129 of file chan_skinny.c.

Referenced by transmit_callinfo_variable().

#define CALL_STATE_MESSAGE   0x0111

Definition at line 1065 of file chan_skinny.c.

Referenced by transmit_callstate().

#define CALLSTATE2STR_BUFSIZE   15

Definition at line 281 of file chan_skinny.c.

#define CAPABILITIES_REQ_MESSAGE   0x009B

Definition at line 641 of file chan_skinny.c.

Referenced by transmit_capabilitiesreq().

#define CAPABILITIES_RES_MESSAGE   0x0010

Definition at line 338 of file chan_skinny.c.

Referenced by handle_message().

#define CDEV   ((struct skinny_device *)item)

Definition at line 7726 of file chan_skinny.c.

Referenced by config_parse_variables().

#define CDEV_OPTS   ((struct skinny_device_options *)item)

Definition at line 7725 of file chan_skinny.c.

Referenced by config_parse_variables().

#define CLEAR_DISPLAY_MESSAGE   0x009A

Definition at line 636 of file chan_skinny.c.

Referenced by transmit_clear_display_message().

#define CLEAR_NOTIFY_MESSAGE   0x0115

Definition at line 635 of file chan_skinny.c.

#define CLEAR_PRINOTIFY_MESSAGE   0x0121

Definition at line 1124 of file chan_skinny.c.

Referenced by transmit_clearprinotify().

#define CLEAR_PROMPT_MESSAGE   0x0113

Definition at line 1082 of file chan_skinny.c.

Referenced by transmit_clearpromptmessage().

#define CLINE   ((struct skinny_line *)item)

Definition at line 7724 of file chan_skinny.c.

Referenced by config_parse_variables().

#define CLINE_OPTS   ((struct skinny_line_options *)item)

Definition at line 7723 of file chan_skinny.c.

Referenced by config_parse_variables().

#define CLOSE_RECEIVE_CHANNEL_MESSAGE   0x0106

Definition at line 677 of file chan_skinny.c.

Referenced by transmit_closereceivechannel().

#define CONTROL2STR_BUFSIZE   100

Definition at line 275 of file chan_skinny.c.

Referenced by control2str().

#define DEFAULT_AUTH_LIMIT   50

Definition at line 192 of file chan_skinny.c.

Referenced by config_parse_variables().

#define DEFAULT_AUTH_TIMEOUT   30

Definition at line 191 of file chan_skinny.c.

Referenced by config_parse_variables().

#define DEFAULT_SKINNY_BACKLOG   2

Definition at line 189 of file chan_skinny.c.

Referenced by config_load().

#define DEFAULT_SKINNY_PORT   2000

Definition at line 188 of file chan_skinny.c.

Referenced by config_device(), and config_load().

#define DEFINETIMEDATE_MESSAGE   0x0094

Definition at line 550 of file chan_skinny.c.

Referenced by transmit_definetimedate().

#define DEVICE2STR_BUFSIZE   15

Definition at line 272 of file chan_skinny.c.

Referenced by device2str().

#define DIALED_NUMBER_MESSAGE   0x011D

Definition at line 1099 of file chan_skinny.c.

Referenced by transmit_dialednumber().

#define DIALTYPE_CFWD   1<<1

Definition at line 1381 of file chan_skinny.c.

Referenced by dialandactivatesub(), and handle_callforward_button().

#define DIALTYPE_NORMAL   1<<0

Definition at line 1380 of file chan_skinny.c.

Referenced by dialandactivatesub(), handle_transfer_button(), and skinny_new().

#define DIALTYPE_XFER   1<<2

Definition at line 1382 of file chan_skinny.c.

Referenced by dialandactivatesub(), and handle_transfer_button().

#define DISPLAY_NOTIFY_MESSAGE   0x0114

Definition at line 1088 of file chan_skinny.c.

Referenced by transmit_displaynotify().

#define DISPLAY_PRINOTIFY_MESSAGE   0x0120

Definition at line 1117 of file chan_skinny.c.

Referenced by _transmit_displayprinotify().

#define DISPLAY_PRINOTIFY_MESSAGE_VARIABLE   0x0144

Definition at line 1142 of file chan_skinny.c.

Referenced by _transmit_displayprinotifyvar().

#define DISPLAY_PROMPT_STATUS_MESSAGE   0x0112

Definition at line 1073 of file chan_skinny.c.

Referenced by transmit_displaypromptstatus().

#define DISPLAY_PROMPT_STATUS_MESSAGE_VARIABLE   0x0145

Definition at line 1149 of file chan_skinny.c.

Referenced by transmit_displaypromptstatusvar().

#define DISPLAYTEXT_MESSAGE   0x0099

Definition at line 630 of file chan_skinny.c.

#define ENBLOC_CALL_MESSAGE   0x0004

Definition at line 314 of file chan_skinny.c.

Referenced by handle_message().

#define FORWARD_STAT_MESSAGE   0x0090

Definition at line 523 of file chan_skinny.c.

Referenced by transmit_cfwdstate().

#define HEADSET_STATUS_MESSAGE   0x002B

Definition at line 404 of file chan_skinny.c.

Referenced by handle_message().

#define htolel (  )     __bswap_32(x)

#define htoles (  )     __bswap_16(x)

Definition at line 250 of file chan_skinny.c.

Referenced by transmit_softkeysetres().

#define IP_PORT_MESSAGE   0x0002

Definition at line 304 of file chan_skinny.c.

Referenced by handle_message().

#define KEEP_ALIVE_ACK_MESSAGE   0x0100

Definition at line 664 of file chan_skinny.c.

Referenced by transmit_keepaliveack().

#define KEEP_ALIVE_MESSAGE   0x0000

Definition at line 287 of file chan_skinny.c.

Referenced by handle_message().

#define KEYDEF_CONNECTED   1

Definition at line 697 of file chan_skinny.c.

Referenced by setsubstate(), and skinny_extensionstate_cb().

#define KEYDEF_CONNWITHCONF   7

Definition at line 703 of file chan_skinny.c.

#define KEYDEF_CONNWITHTRANS   5

Definition at line 701 of file chan_skinny.c.

#define KEYDEF_DADFD   6

Definition at line 702 of file chan_skinny.c.

Referenced by handle_keypad_button_message(), and skinny_dialer().

#define KEYDEF_OFFHOOK   4

Definition at line 700 of file chan_skinny.c.

Referenced by handle_soft_key_event_message(), and setsubstate().

#define KEYDEF_OFFHOOKWITHFEAT   9

Definition at line 705 of file chan_skinny.c.

#define KEYDEF_ONHOLD   2

Definition at line 698 of file chan_skinny.c.

Referenced by setsubstate().

#define KEYDEF_ONHOOK   0

Definition at line 696 of file chan_skinny.c.

Referenced by handle_message(), and skinny_extensionstate_cb().

#define KEYDEF_RINGIN   3

Definition at line 699 of file chan_skinny.c.

Referenced by setsubstate().

#define KEYDEF_RINGOUT   8

Definition at line 704 of file chan_skinny.c.

Referenced by setsubstate().

#define KEYDEF_RINGOUTWITHTRANS   13

Definition at line 709 of file chan_skinny.c.

Referenced by setsubstate().

#define KEYDEF_SLACONNECTEDNOTACTIVE   12

Definition at line 708 of file chan_skinny.c.

Referenced by setsubstate(), and skinny_extensionstate_cb().

#define KEYDEF_SLAHOLD   11

Definition at line 707 of file chan_skinny.c.

Referenced by skinny_extensionstate_cb().

#define KEYDEF_UNKNOWN   10

Definition at line 706 of file chan_skinny.c.

#define KEYMASK_ALL   0xFFFFFFFF

#define KEYMASK_ANSWER   (1 << 11)

Definition at line 746 of file chan_skinny.c.

#define KEYMASK_BKSPC   (1 << 8)

Definition at line 743 of file chan_skinny.c.

#define KEYMASK_CFWDALL   (1 << 5)

Definition at line 740 of file chan_skinny.c.

#define KEYMASK_CFWDBUSY   (1 << 6)

Definition at line 741 of file chan_skinny.c.

#define KEYMASK_CFWDNOANSWER   (1 << 7)

Definition at line 742 of file chan_skinny.c.

#define KEYMASK_CONFRN   (1 << 13)

Definition at line 748 of file chan_skinny.c.

#define KEYMASK_DND   (1 << 29)

Definition at line 754 of file chan_skinny.c.

#define KEYMASK_ENDCALL   (1 << 9)

Definition at line 744 of file chan_skinny.c.

#define KEYMASK_FORCEDIAL   (1 << 21)

Definition at line 756 of file chan_skinny.c.

Referenced by handle_keypad_button_message().

#define KEYMASK_GPICKUP   (1 << 18)

Definition at line 753 of file chan_skinny.c.

#define KEYMASK_HOLD   (1 << 3)

Definition at line 738 of file chan_skinny.c.

#define KEYMASK_IDIVERT   (1 << 20)

Definition at line 755 of file chan_skinny.c.

#define KEYMASK_INFO   (1 << 12)

Definition at line 747 of file chan_skinny.c.

#define KEYMASK_JOIN   (1 << 15)

Definition at line 750 of file chan_skinny.c.

#define KEYMASK_MEETME   (1 << 16)

Definition at line 751 of file chan_skinny.c.

#define KEYMASK_NEWCALL   (1 << 2)

Definition at line 737 of file chan_skinny.c.

#define KEYMASK_NONE   (1 << 0)

Definition at line 735 of file chan_skinny.c.

#define KEYMASK_PARK   (1 << 14)

Definition at line 749 of file chan_skinny.c.

#define KEYMASK_PICKUP   (1 << 17)

Definition at line 752 of file chan_skinny.c.

#define KEYMASK_REDIAL   (1 << 1)

Definition at line 736 of file chan_skinny.c.

#define KEYMASK_RESUME   (1 << 10)

Definition at line 745 of file chan_skinny.c.

#define KEYMASK_TRNSFER   (1 << 4)

Definition at line 739 of file chan_skinny.c.

#define KEYPAD_BUTTON_MESSAGE   0x0003

Definition at line 306 of file chan_skinny.c.

Referenced by handle_message().

#define letohl (  )     __bswap_32(x)

#define letohs (  )     __bswap_16(x)

Definition at line 248 of file chan_skinny.c.

#define LINE_STAT_RES_MESSAGE   0x0092

Definition at line 542 of file chan_skinny.c.

Referenced by transmit_linestatres().

#define LINE_STATE_REQ_MESSAGE   0x000B

Definition at line 360 of file chan_skinny.c.

Referenced by handle_message().

#define MAX_SERVICEURL   256

Definition at line 1106 of file chan_skinny.c.

#define MAXCALLINFOSTR   256

Definition at line 1114 of file chan_skinny.c.

Referenced by transmit_callinfo_variable(), and transmit_displaypromptstatusvar().

#define MAXDISPLAYNOTIFYSTR   32

Definition at line 1115 of file chan_skinny.c.

Referenced by _transmit_displayprinotifyvar().

#define OCTAL_ANSWER   "\200\013"

Definition at line 772 of file chan_skinny.c.

#define OCTAL_BARGE   "\200\103"

Definition at line 828 of file chan_skinny.c.

#define OCTAL_BARGEEXIST   "\200\105"

Definition at line 830 of file chan_skinny.c.

#define OCTAL_BARGEFAIL   "\200\104"

Definition at line 829 of file chan_skinny.c.

#define OCTAL_BKSPC   "\200\010"

Definition at line 769 of file chan_skinny.c.

#define OCTAL_BUSY   "\200\031"

Definition at line 786 of file chan_skinny.c.

Referenced by setsubstate().

#define OCTAL_CALLBACK   "\200\101"

Definition at line 826 of file chan_skinny.c.

#define OCTAL_CALLDURTIMEOUT   "\200\131"

Definition at line 850 of file chan_skinny.c.

#define OCTAL_CALLPARK   "\200\035"

Definition at line 790 of file chan_skinny.c.

#define OCTAL_CALLPROCEED   "\200\036"

Definition at line 791 of file chan_skinny.c.

#define OCTAL_CALLWAITING   "\200\033"

Definition at line 788 of file chan_skinny.c.

Referenced by setsubstate().

#define OCTAL_CALLXFER   "\200\034"

Definition at line 789 of file chan_skinny.c.

#define OCTAL_CANTCOMPCNF   "\200\046"

Definition at line 799 of file chan_skinny.c.

#define OCTAL_CANTCOMPLXFER   "\200\122"

Definition at line 843 of file chan_skinny.c.

#define OCTAL_CANTJOINCALLS   "\200\123"

Definition at line 844 of file chan_skinny.c.

#define OCTAL_CBARGE   "\200\121"

Definition at line 842 of file chan_skinny.c.

#define OCTAL_CFWDALL   "\200\005"

Definition at line 766 of file chan_skinny.c.

#define OCTAL_CFWDBUSY   "\200\006"

Definition at line 767 of file chan_skinny.c.

#define OCTAL_CFWDNOAN   "\200\007"

Definition at line 768 of file chan_skinny.c.

#define OCTAL_CM1   "\200\167"

Definition at line 880 of file chan_skinny.c.

#define OCTAL_CM2   "\200\170"

Definition at line 881 of file chan_skinny.c.

#define OCTAL_CM3   "\200\171"

Definition at line 882 of file chan_skinny.c.

#define OCTAL_CM4   "\200\172"

Definition at line 883 of file chan_skinny.c.

#define OCTAL_CM5   "\200\173"

Definition at line 884 of file chan_skinny.c.

#define OCTAL_CONFERENCE   "\200\064"

Definition at line 813 of file chan_skinny.c.

#define OCTAL_CONFLIST   "\200\117"

Definition at line 840 of file chan_skinny.c.

#define OCTAL_CONFRN   "\200\015"

Definition at line 774 of file chan_skinny.c.

#define OCTAL_CONNECTED   "\200\030"

Definition at line 785 of file chan_skinny.c.

Referenced by setsubstate(), and skinny_extensionstate_cb().

#define OCTAL_CUROPTS   "\200\023"

Definition at line 780 of file chan_skinny.c.

#define OCTAL_DIRTRFR   "\200\115"

Definition at line 838 of file chan_skinny.c.

#define OCTAL_DIVALL   "\200\100"

Definition at line 825 of file chan_skinny.c.

#define OCTAL_DND   "\200\077"

Definition at line 824 of file chan_skinny.c.

#define OCTAL_DNS1   "\200\160"

Definition at line 873 of file chan_skinny.c.

#define OCTAL_DNS2   "\200\161"

Definition at line 874 of file chan_skinny.c.

#define OCTAL_DNS3   "\200\162"

Definition at line 875 of file chan_skinny.c.

#define OCTAL_DNS4   "\200\163"

Definition at line 876 of file chan_skinny.c.

#define OCTAL_DNS5   "\200\164"

Definition at line 877 of file chan_skinny.c.

#define OCTAL_DOMAIN   "\200\147"

Definition at line 864 of file chan_skinny.c.

#define OCTAL_ENDCALL   "\200\011"

Definition at line 770 of file chan_skinny.c.

#define OCTAL_ENTRNUM   "\200\040"

Definition at line 793 of file chan_skinny.c.

Referenced by setsubstate().

#define OCTAL_ERRDB   "\200\060"

Definition at line 809 of file chan_skinny.c.

#define OCTAL_ERRDBCFG   "\200\057"

Definition at line 808 of file chan_skinny.c.

#define OCTAL_ERRMISMATCH   "\200\063"

Definition at line 812 of file chan_skinny.c.

#define OCTAL_ERRNOLIC   "\200\056"

Definition at line 807 of file chan_skinny.c.

#define OCTAL_ERRPASSLMT   "\200\061"

Definition at line 810 of file chan_skinny.c.

#define OCTAL_ERRUNK   "\200\062"

Definition at line 811 of file chan_skinny.c.

#define OCTAL_EXTXFERRESTRICT   "\200\141"

Definition at line 858 of file chan_skinny.c.

#define OCTAL_FROM   "\200\027"

Definition at line 784 of file chan_skinny.c.

Referenced by setsubstate().

#define OCTAL_FWDEDTO   "\200\045"

Definition at line 798 of file chan_skinny.c.

#define OCTAL_GPICKUP   "\200\022"

Definition at line 779 of file chan_skinny.c.

#define OCTAL_HAVEVMAIL   "\200\044"

Definition at line 797 of file chan_skinny.c.

#define OCTAL_HITRAFFIC   "\200\112"

Definition at line 835 of file chan_skinny.c.

#define OCTAL_HOLD   "\200\003"

Definition at line 764 of file chan_skinny.c.

#define OCTAL_HOLDDURTIMEOUT   "\200\132"

Definition at line 851 of file chan_skinny.c.

#define OCTAL_HOST   "\200\146"

Definition at line 863 of file chan_skinny.c.

#define OCTAL_IDIVERT   "\200\120"

Definition at line 841 of file chan_skinny.c.

#define OCTAL_IMMDIV   "\200\073"

Definition at line 820 of file chan_skinny.c.

#define OCTAL_INCOMPATDEV   "\200\106"

Definition at line 831 of file chan_skinny.c.

#define OCTAL_INCONFALREADY   "\200\052"

Definition at line 803 of file chan_skinny.c.

#define OCTAL_INFO   "\200\014"

Definition at line 773 of file chan_skinny.c.

#define OCTAL_INSUFBANDW   "\200\067"

Definition at line 816 of file chan_skinny.c.

#define OCTAL_INTRCPT   "\200\074"

Definition at line 821 of file chan_skinny.c.

#define OCTAL_INUSEREMOTE   "\200\037"

Definition at line 792 of file chan_skinny.c.

#define OCTAL_INVALCONFPART   "\200\051"

Definition at line 802 of file chan_skinny.c.

#define OCTAL_IPADD   "\200\150"

Definition at line 865 of file chan_skinny.c.

#define OCTAL_JOIN   "\200\017"

Definition at line 776 of file chan_skinny.c.

#define OCTAL_KEYNOTACTIVE   "\200\055"

Definition at line 806 of file chan_skinny.c.

#define OCTAL_LINEINUSE   "\200\032"

Definition at line 787 of file chan_skinny.c.

#define OCTAL_MACADD   "\200\145"

Definition at line 862 of file chan_skinny.c.

#define OCTAL_MAXPARTEXCEED   "\200\054"

Definition at line 805 of file chan_skinny.c.

#define OCTAL_MCID   "\200\114"

Definition at line 837 of file chan_skinny.c.

#define OCTAL_MCIDSUCCESS   "\200\124"

Definition at line 845 of file chan_skinny.c.

#define OCTAL_MEETME   "\200\020"

Definition at line 777 of file chan_skinny.c.

#define OCTAL_NETCNGREROUT   "\200\102"

Definition at line 827 of file chan_skinny.c.

#define OCTAL_NEWCALL   "\200\002"

Definition at line 763 of file chan_skinny.c.

#define OCTAL_NOCONFBRDG   "\200\047"

Definition at line 800 of file chan_skinny.c.

#define OCTAL_NOPARTINFO   "\200\053"

Definition at line 804 of file chan_skinny.c.

#define OCTAL_NOPRIMARYCTL   "\200\050"

Definition at line 801 of file chan_skinny.c.

#define OCTAL_NUMNOTCFG   "\200\125"

Definition at line 846 of file chan_skinny.c.

#define OCTAL_OFFHOOK   "\200\024"

Definition at line 781 of file chan_skinny.c.

#define OCTAL_ONHOOK   "\200\025"

Definition at line 782 of file chan_skinny.c.

#define OCTAL_OPICKUP   "\200\133"

Definition at line 852 of file chan_skinny.c.

#define OCTAL_PARK   "\200\016"

Definition at line 775 of file chan_skinny.c.

#define OCTAL_PARKAT   "\200\041"

Definition at line 794 of file chan_skinny.c.

#define OCTAL_PARKNO   "\200\065"

Definition at line 814 of file chan_skinny.c.

#define OCTAL_PARKNONUM   "\200\107"

Definition at line 832 of file chan_skinny.c.

#define OCTAL_PARKREVERSION   "\200\110"

Definition at line 833 of file chan_skinny.c.

#define OCTAL_PICKUP   "\200\021"

Definition at line 778 of file chan_skinny.c.

#define OCTAL_PRIMONLY   "\200\042"

Definition at line 795 of file chan_skinny.c.

#define OCTAL_PRIVATE   "\200\066"

Definition at line 815 of file chan_skinny.c.

#define OCTAL_QRT   "\200\113"

Definition at line 836 of file chan_skinny.c.

#define OCTAL_REDIAL   "\200\001"

Definition at line 762 of file chan_skinny.c.

#define OCTAL_RESUME   "\200\012"

Definition at line 771 of file chan_skinny.c.

#define OCTAL_RINGOUT   "\200\026"

Definition at line 783 of file chan_skinny.c.

Referenced by setsubstate().

#define OCTAL_RMLSTC   "\200\071"

Definition at line 818 of file chan_skinny.c.

#define OCTAL_ROUTER1   "\200\153"

Definition at line 868 of file chan_skinny.c.

#define OCTAL_ROUTER2   "\200\154"

Definition at line 869 of file chan_skinny.c.

#define OCTAL_ROUTER3   "\200\155"

Definition at line 870 of file chan_skinny.c.

#define OCTAL_ROUTER4   "\200\156"

Definition at line 871 of file chan_skinny.c.

#define OCTAL_ROUTER5   "\200\157"

Definition at line 872 of file chan_skinny.c.

#define OCTAL_SECERROR   "\200\126"

Definition at line 847 of file chan_skinny.c.

#define OCTAL_SELECT   "\200\116"

Definition at line 839 of file chan_skinny.c.

#define OCTAL_SETWTCH   "\200\075"

Definition at line 822 of file chan_skinny.c.

#define OCTAL_SRVNOTACTIVE   "\200\111"

Definition at line 834 of file chan_skinny.c.

#define OCTAL_SUBMASK   "\200\151"

Definition at line 866 of file chan_skinny.c.

#define OCTAL_TFTP1   "\200\152"

Definition at line 867 of file chan_skinny.c.

#define OCTAL_TMPFAIL   "\200\043"

Definition at line 796 of file chan_skinny.c.

#define OCTAL_TRANSFER   "\200\004"

Definition at line 765 of file chan_skinny.c.

#define OCTAL_TRNSFVM   "\200\076"

Definition at line 823 of file chan_skinny.c.

#define OCTAL_UNKNUM   "\200\070"

Definition at line 817 of file chan_skinny.c.

#define OCTAL_URLDIRS   "\200\175"

Definition at line 886 of file chan_skinny.c.

#define OCTAL_URLINFO   "\200\174"

Definition at line 885 of file chan_skinny.c.

#define OCTAL_URLMSGS   "\200\176"

Definition at line 887 of file chan_skinny.c.

#define OCTAL_URLSRVS   "\200\177"

Definition at line 888 of file chan_skinny.c.

#define OCTAL_VIDBANDWNA   "\200\127"

Definition at line 848 of file chan_skinny.c.

#define OCTAL_VIDMODE   "\200\130"

Definition at line 849 of file chan_skinny.c.

#define OCTAL_VLANADID   "\200\166"

Definition at line 879 of file chan_skinny.c.

#define OCTAL_VLANOPID   "\200\165"

Definition at line 878 of file chan_skinny.c.

#define OCTAL_VOICEMAIL   "\200\072"

Definition at line 819 of file chan_skinny.c.

#define OFFHOOK_MESSAGE   0x0006

Definition at line 326 of file chan_skinny.c.

Referenced by handle_message().

#define ONHOOK_MESSAGE   0x0007

Definition at line 332 of file chan_skinny.c.

Referenced by handle_message().

#define OPEN_RECEIVE_CHANNEL_ACK_MESSAGE   0x0022

Definition at line 378 of file chan_skinny.c.

Referenced by handle_message().

#define OPEN_RECEIVE_CHANNEL_MESSAGE   0x0105

Definition at line 666 of file chan_skinny.c.

Referenced by transmit_connect().

#define REGISTER_ACK_MESSAGE   0x0081

Definition at line 412 of file chan_skinny.c.

Referenced by transmit_registerack().

#define REGISTER_AVAILABLE_LINES_MESSAGE   0x002D

Definition at line 405 of file chan_skinny.c.

Referenced by handle_message().

#define REGISTER_MESSAGE   0x0001

Definition at line 290 of file chan_skinny.c.

Referenced by handle_message().

#define REGISTER_REJ_MESSAGE   0x009D

Definition at line 643 of file chan_skinny.c.

Referenced by transmit_registerrej().

#define RESET_MESSAGE   0x009F

Definition at line 659 of file chan_skinny.c.

Referenced by transmit_reset().

#define SELECT_SOFT_KEYS_MESSAGE   0x0110

Definition at line 1057 of file chan_skinny.c.

Referenced by transmit_selectsoftkeys().

#define SERVER_REQUEST_MESSAGE   0x0012

Definition at line 368 of file chan_skinny.c.

Referenced by handle_message().

#define SERVER_RES_MESSAGE   0x009E

Definition at line 648 of file chan_skinny.c.

Referenced by transmit_serverres().

#define SERVICEURL_STAT_MESSAGE   0x012F

Definition at line 1107 of file chan_skinny.c.

Referenced by transmit_serviceurlstat().

#define SERVICEURL_STATREQ_MESSAGE   0x0033

Definition at line 407 of file chan_skinny.c.

Referenced by handle_message().

#define SET_LAMP_MESSAGE   0x0086

Definition at line 444 of file chan_skinny.c.

Referenced by transmit_lamp_indication().

#define SET_MICROPHONE_MESSAGE   0x0089

Definition at line 457 of file chan_skinny.c.

Referenced by transmit_microphone_mode().

#define SET_RINGER_MESSAGE   0x0085

Definition at line 436 of file chan_skinny.c.

Referenced by transmit_ringer_mode().

#define SET_SPEAKER_MESSAGE   0x0088

Definition at line 451 of file chan_skinny.c.

Referenced by transmit_speaker_mode().

#define SKINNY_ALERT   0x24

Definition at line 1309 of file chan_skinny.c.

Referenced by setsubstate().

#define SKINNY_BARGIN   0x43

Definition at line 1315 of file chan_skinny.c.

#define SKINNY_BEEPBONK   0x33

Definition at line 1314 of file chan_skinny.c.

#define SKINNY_BUSY   6

Definition at line 1293 of file chan_skinny.c.

Referenced by setsubstate().

#define SKINNY_BUSYTONE   0x23

Definition at line 1308 of file chan_skinny.c.

Referenced by setsubstate().

#define SKINNY_CALLREMOTEMULTILINE   13

Definition at line 1300 of file chan_skinny.c.

Referenced by setsubstate(), and skinny_extensionstate_cb().

#define SKINNY_CALLWAIT   9

Definition at line 1296 of file chan_skinny.c.

Referenced by setsubstate().

#define SKINNY_CALLWAITTONE   0x2D

Definition at line 1311 of file chan_skinny.c.

Referenced by setsubstate().

#define SKINNY_CFWD_ALL   (1 << 0)

#define SKINNY_CFWD_BUSY   (1 << 1)

#define SKINNY_CFWD_NOANSWER   (1 << 2)

#define SKINNY_CONGESTION   7

Definition at line 1294 of file chan_skinny.c.

Referenced by setsubstate().

#define SKINNY_CONNECTED   5

Definition at line 1292 of file chan_skinny.c.

Referenced by setsubstate(), skinny_autoanswer_cb(), and skinny_extensionstate_cb().

#define SKINNY_CX_CONF   3

Definition at line 1337 of file chan_skinny.c.

#define SKINNY_CX_CONFERENCE   3

Definition at line 1338 of file chan_skinny.c.

#define SKINNY_CX_INACTIVE   4

Definition at line 1340 of file chan_skinny.c.

Referenced by skinny_new().

#define SKINNY_CX_MUTE   4

Definition at line 1339 of file chan_skinny.c.

#define SKINNY_CX_RECVONLY   1

Definition at line 1335 of file chan_skinny.c.

Referenced by setsubstate().

#define SKINNY_CX_SENDONLY   0

Definition at line 1334 of file chan_skinny.c.

#define SKINNY_CX_SENDRECV   2

Definition at line 1336 of file chan_skinny.c.

Referenced by skinny_answer().

#define SKINNY_DEBUG ( type,
verb_level,
text,
...   ) 

Definition at line 166 of file chan_skinny.c.

Referenced by _transmit_displayprinotify(), _transmit_displayprinotifyvar(), accept_thread(), activatesub(), destroy_rtp(), dialandactivatesub(), dumpsub(), handle_button_template_req_message(), handle_capabilities_res_message(), handle_keepalive_message(), handle_keypad_button_message(), handle_message(), handle_open_receive_channel_ack_message(), handle_soft_key_event_message(), handle_stimulus_message(), setsubstate(), skinny_answer(), skinny_call(), skinny_cfwd_cb(), skinny_dialer(), skinny_dialer_cb(), skinny_extensionstate_cb(), skinny_get_rtp_peer(), skinny_hangup(), skinny_indicate(), skinny_new(), skinny_sched_add(), skinny_sched_del(), skinny_set_rtp_peer(), skinny_transfer_attended(), skinny_transfer_blind(), start_rtp(), transmit_activatecallplane(), transmit_backspace(), transmit_callinfo(), transmit_callinfo_variable(), transmit_callstate(), transmit_capabilitiesreq(), transmit_cfwdstate(), transmit_clear_display_message(), transmit_clearprinotify(), transmit_clearpromptmessage(), transmit_closereceivechannel(), transmit_connect(), transmit_definetimedate(), transmit_dialednumber(), transmit_displaynotify(), transmit_displaypromptstatus(), transmit_displaypromptstatusvar(), transmit_keepaliveack(), transmit_lamp_indication(), transmit_linestatres(), transmit_microphone_mode(), transmit_registerack(), transmit_registerrej(), transmit_reset(), transmit_ringer_mode(), transmit_selectsoftkeys(), transmit_serverres(), transmit_serviceurlstat(), transmit_softkeysetres(), transmit_softkeytemplateres(), transmit_speaker_mode(), transmit_speeddialstatres(), transmit_start_tone(), transmit_startmediatransmission(), transmit_stop_tone(), transmit_stopmediatransmission(), transmit_versionres(), and update_connectedline().

#define SKINNY_DEVICE_12   4

Definition at line 1248 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_12SP   3

Definition at line 1247 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_12SPPLUS   2

Definition at line 1246 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_30SPPLUS   1

Definition at line 1245 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_30VIP   5

Definition at line 1249 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_7902   30008

Definition at line 1275 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_7905   20000

Definition at line 1271 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_7906   369

Definition at line 1264 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_7910   6

Definition at line 1250 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_7911   307

Definition at line 1259 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_7912   30007

Definition at line 1274 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_7914   124

Definition at line 1257 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_7920   30002

Definition at line 1272 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_7921   365

Definition at line 1263 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_7931   348

Definition at line 1262 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_7935   9

Definition at line 1253 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_7936   30019

Definition at line 1278 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_7937   431

Definition at line 1266 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_7940   8

Definition at line 1252 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_7941   115

Definition at line 1255 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_7941GE   309

Definition at line 1261 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_7942   434

Definition at line 1267 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_7945   435

Definition at line 1268 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_7960   7

Definition at line 1251 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_7961   30018

Definition at line 1277 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_7961GE   308

Definition at line 1260 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_7962   404

Definition at line 1265 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_7965   436

Definition at line 1269 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_7970   30006

Definition at line 1273 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_7971   119

Definition at line 1256 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_7975   437

Definition at line 1270 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_7985   302

Definition at line 1258 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_ATA186   12

Definition at line 1254 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_CIPC   30016

Definition at line 1276 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_NONE   0

Definition at line 1244 of file chan_skinny.c.

Referenced by device2str().

#define SKINNY_DEVICE_OPTIONS

Definition at line 1557 of file chan_skinny.c.

#define SKINNY_DEVICE_SCCPGATEWAY_AN   30027

Definition at line 1279 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_SCCPGATEWAY_BRI   30028

Definition at line 1280 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_UNKNOWN   -1

Definition at line 1243 of file chan_skinny.c.

Referenced by device2str().

#define SKINNY_DEVICECONTAINER   1

Definition at line 1540 of file chan_skinny.c.

#define SKINNY_DIALTONE   0x21

Definition at line 1307 of file chan_skinny.c.

Referenced by handle_soft_key_event_message(), and setsubstate().

#define SKINNY_HOLD   8

Definition at line 1295 of file chan_skinny.c.

Referenced by setsubstate(), and skinny_extensionstate_cb().

#define SKINNY_INCOMING   1

#define SKINNY_INVALID   14

Definition at line 1301 of file chan_skinny.c.

#define SKINNY_LAMP_BLINK   5

Definition at line 1322 of file chan_skinny.c.

Referenced by mwi_event_cb(), setsubstate(), and skinny_extensionstate_cb().

#define SKINNY_LAMP_FLASH   4

Definition at line 1321 of file chan_skinny.c.

Referenced by skinny_extensionstate_cb().

#define SKINNY_LAMP_OFF   1

#define SKINNY_LAMP_ON   2

#define SKINNY_LAMP_WINK   3

Definition at line 1320 of file chan_skinny.c.

Referenced by setsubstate(), and skinny_extensionstate_cb().

#define SKINNY_LINE_OPTIONS

Definition at line 1416 of file chan_skinny.c.

#define SKINNY_LINECONTAINER   2

Definition at line 1541 of file chan_skinny.c.

Referenced by config_line().

#define SKINNY_MAX_CAPABILITIES   18

Definition at line 348 of file chan_skinny.c.

Referenced by handle_capabilities_res_message().

#define SKINNY_MAX_PACKET   2000

Definition at line 190 of file chan_skinny.c.

Referenced by skinny_session(), and transmit_response_bysession().

#define SKINNY_MICOFF   2

Definition at line 1286 of file chan_skinny.c.

Referenced by setsubstate().

#define SKINNY_MICON   1

Definition at line 1285 of file chan_skinny.c.

#define SKINNY_NOTONE   0x7F

Definition at line 1316 of file chan_skinny.c.

#define SKINNY_OFFHOOK   1

#define SKINNY_ONHOOK   2

#define SKINNY_OUTGOING   2

#define SKINNY_PARK   11

Definition at line 1298 of file chan_skinny.c.

#define SKINNY_PROGRESS   12

Definition at line 1299 of file chan_skinny.c.

Referenced by setsubstate().

#define SKINNY_REORDER   0x25

Definition at line 1310 of file chan_skinny.c.

Referenced by setsubstate(), skinny_dialer(), and skinny_newcall().

#define SKINNY_RING_FEATURE   4

Definition at line 1327 of file chan_skinny.c.

#define SKINNY_RING_INSIDE   2

Definition at line 1325 of file chan_skinny.c.

Referenced by setsubstate().

#define SKINNY_RING_OFF   1

#define SKINNY_RING_OUTSIDE   3

Definition at line 1326 of file chan_skinny.c.

#define SKINNY_RINGIN   4

Definition at line 1291 of file chan_skinny.c.

Referenced by setsubstate(), and skinny_extensionstate_cb().

#define SKINNY_RINGOUT   3

Definition at line 1290 of file chan_skinny.c.

Referenced by setsubstate().

#define SKINNY_SDCONTAINER   4

Definition at line 1543 of file chan_skinny.c.

Referenced by config_parse_variables(), and skinny_extensionstate_cb().

#define SKINNY_SILENCE   0x00

Definition at line 1306 of file chan_skinny.c.

#define SKINNY_SPEAKEROFF   2

Definition at line 1283 of file chan_skinny.c.

Referenced by dumpsub().

#define SKINNY_SPEAKERON   1

#define SKINNY_SUBLINECONTAINER   3

Definition at line 1542 of file chan_skinny.c.

Referenced by config_parse_variables(), and skinny_extensionstate_cb().

#define SKINNY_TRANSFER   10

Definition at line 1297 of file chan_skinny.c.

#define SKINNY_ZIP   0x32

Definition at line 1313 of file chan_skinny.c.

Referenced by setsubstate().

#define SKINNY_ZIPZIP   0x31

Definition at line 1312 of file chan_skinny.c.

#define SOFT_KEY_EVENT_MESSAGE   0x0026

Definition at line 395 of file chan_skinny.c.

Referenced by handle_message().

#define SOFT_KEY_SET_REQ_MESSAGE   0x0025

Definition at line 393 of file chan_skinny.c.

Referenced by handle_message().

#define SOFT_KEY_SET_RES_MESSAGE   0x0109

Definition at line 1042 of file chan_skinny.c.

Referenced by transmit_softkeysetres().

#define SOFT_KEY_TEMPLATE_REQ_MESSAGE   0x0028

Definition at line 403 of file chan_skinny.c.

Referenced by handle_message().

#define SOFT_KEY_TEMPLATE_RES_MESSAGE   0x0108

Definition at line 684 of file chan_skinny.c.

Referenced by transmit_softkeytemplateres().

#define SOFTKEY_ANSWER   0x0B

Definition at line 722 of file chan_skinny.c.

Referenced by handle_soft_key_event_message().

#define SOFTKEY_BKSPC   0x08

Definition at line 719 of file chan_skinny.c.

Referenced by handle_soft_key_event_message().

#define SOFTKEY_CFWDALL   0x05

Definition at line 716 of file chan_skinny.c.

Referenced by handle_soft_key_event_message().

#define SOFTKEY_CFWDBUSY   0x06

Definition at line 717 of file chan_skinny.c.

Referenced by handle_soft_key_event_message().

#define SOFTKEY_CFWDNOANSWER   0x07

Definition at line 718 of file chan_skinny.c.

Referenced by handle_soft_key_event_message().

#define SOFTKEY_CONFRN   0x0D

Definition at line 724 of file chan_skinny.c.

Referenced by handle_soft_key_event_message().

#define SOFTKEY_DND   0x13

Definition at line 730 of file chan_skinny.c.

Referenced by handle_soft_key_event_message().

#define SOFTKEY_ENDCALL   0x09

Definition at line 720 of file chan_skinny.c.

Referenced by handle_soft_key_event_message().

#define SOFTKEY_FORCEDIAL   0x15

Definition at line 732 of file chan_skinny.c.

Referenced by handle_soft_key_event_message().

#define SOFTKEY_GPICKUP   0x12

Definition at line 729 of file chan_skinny.c.

Referenced by handle_soft_key_event_message().

#define SOFTKEY_HOLD   0x03

Definition at line 714 of file chan_skinny.c.

Referenced by handle_soft_key_event_message().

#define SOFTKEY_IDIVERT   0x14

Definition at line 731 of file chan_skinny.c.

#define SOFTKEY_INFO   0x0C

Definition at line 723 of file chan_skinny.c.

Referenced by handle_soft_key_event_message().

#define SOFTKEY_JOIN   0x0F

Definition at line 726 of file chan_skinny.c.

Referenced by handle_soft_key_event_message().

#define SOFTKEY_MEETME   0x10

Definition at line 727 of file chan_skinny.c.

Referenced by handle_soft_key_event_message().

#define SOFTKEY_NEWCALL   0x02

Definition at line 713 of file chan_skinny.c.

Referenced by handle_soft_key_event_message().

#define SOFTKEY_NONE   0x00

Definition at line 711 of file chan_skinny.c.

Referenced by handle_soft_key_event_message().

#define SOFTKEY_PARK   0x0E

Definition at line 725 of file chan_skinny.c.

Referenced by handle_soft_key_event_message().

#define SOFTKEY_PICKUP   0x11

Definition at line 728 of file chan_skinny.c.

Referenced by handle_soft_key_event_message().

#define SOFTKEY_REDIAL   0x01

Definition at line 712 of file chan_skinny.c.

Referenced by handle_soft_key_event_message().

#define SOFTKEY_RESUME   0x0A

Definition at line 721 of file chan_skinny.c.

Referenced by handle_soft_key_event_message().

#define SOFTKEY_TRNSFER   0x04

Definition at line 715 of file chan_skinny.c.

Referenced by handle_soft_key_event_message().

#define SPEED_DIAL_STAT_REQ_MESSAGE   0x000A

Definition at line 355 of file chan_skinny.c.

Referenced by handle_message().

#define SPEED_DIAL_STAT_RES_MESSAGE   0x0091

Definition at line 535 of file chan_skinny.c.

Referenced by transmit_speeddialstatres().

#define START_MEDIA_TRANSMISSION_MESSAGE   0x008A

Definition at line 462 of file chan_skinny.c.

Referenced by transmit_startmediatransmission().

#define START_TONE_MESSAGE   0x0082

Definition at line 421 of file chan_skinny.c.

Referenced by transmit_start_tone().

#define STIMULUS_AUTOANSWER   0x11

Definition at line 585 of file chan_skinny.c.

#define STIMULUS_CALLPARK   0x7E

Definition at line 589 of file chan_skinny.c.

Referenced by handle_stimulus_message().

#define STIMULUS_CALLPICKUP   0x7F

Definition at line 590 of file chan_skinny.c.

#define STIMULUS_CONFERENCE   0x7D

Definition at line 588 of file chan_skinny.c.

Referenced by handle_stimulus_message().

#define STIMULUS_DISPLAY   0x08

Definition at line 582 of file chan_skinny.c.

Referenced by handle_stimulus_message().

#define STIMULUS_DND   0x3F

Definition at line 587 of file chan_skinny.c.

Referenced by handle_soft_key_event_message(), and handle_stimulus_message().

#define STIMULUS_FORWARDALL   0x05

Definition at line 579 of file chan_skinny.c.

Referenced by handle_stimulus_message().

#define STIMULUS_FORWARDBUSY   0x06

Definition at line 580 of file chan_skinny.c.

Referenced by handle_stimulus_message().

#define STIMULUS_FORWARDNOANSWER   0x07

Definition at line 581 of file chan_skinny.c.

Referenced by handle_stimulus_message().

#define STIMULUS_HOLD   0x03

Definition at line 577 of file chan_skinny.c.

Referenced by handle_stimulus_message().

#define STIMULUS_LINE   0x09

#define STIMULUS_MESSAGE   0x0005

Definition at line 319 of file chan_skinny.c.

Referenced by handle_message().

#define STIMULUS_NONE   0xFF

#define STIMULUS_REDIAL   0x01

Definition at line 575 of file chan_skinny.c.

Referenced by handle_stimulus_message().

#define STIMULUS_SERVICEURL   0x14

Definition at line 586 of file chan_skinny.c.

#define STIMULUS_SPEEDDIAL   0x02

Definition at line 576 of file chan_skinny.c.

Referenced by handle_stimulus_message().

#define STIMULUS_TRANSFER   0x04

Definition at line 578 of file chan_skinny.c.

Referenced by handle_stimulus_message().

#define STIMULUS_VOICEMAIL   0x0F

Definition at line 584 of file chan_skinny.c.

Referenced by handle_stimulus_message(), and mwi_event_cb().

#define STOP_MEDIA_TRANSMISSION_MESSAGE   0x008B

Definition at line 494 of file chan_skinny.c.

Referenced by transmit_stopmediatransmission().

#define STOP_TONE_MESSAGE   0x0083

Definition at line 429 of file chan_skinny.c.

Referenced by transmit_stop_tone().

#define SUBSTATE2STR_BUFSIZE   15

Definition at line 278 of file chan_skinny.c.

Referenced by substate2str().

#define SUBSTATE_BUSY   6

Definition at line 1373 of file chan_skinny.c.

Referenced by setsubstate(), skinny_indicate(), and substate2str().

#define SUBSTATE_CALLWAIT   9

Definition at line 1376 of file chan_skinny.c.

Referenced by activatesub(), dumpsub(), setsubstate(), and substate2str().

#define SUBSTATE_CONGESTION   7

Definition at line 1374 of file chan_skinny.c.

Referenced by setsubstate(), skinny_indicate(), and substate2str().

#define SUBSTATE_CONNECTED   5

#define SUBSTATE_DIALING   101

Definition at line 1378 of file chan_skinny.c.

Referenced by dialandactivatesub(), setsubstate(), and substate2str().

#define SUBSTATE_HOLD   8

#define SUBSTATE_OFFHOOK   1

#define SUBSTATE_ONHOOK   2

Definition at line 1369 of file chan_skinny.c.

Referenced by activatesub(), dumpsub(), setsubstate(), and substate2str().

#define SUBSTATE_PROGRESS   12

Definition at line 1377 of file chan_skinny.c.

Referenced by setsubstate(), skinny_indicate(), and substate2str().

#define SUBSTATE_RINGIN   4

Definition at line 1371 of file chan_skinny.c.

Referenced by activatesub(), dumpsub(), setsubstate(), skinny_call(), and substate2str().

#define SUBSTATE_RINGOUT   3

Definition at line 1370 of file chan_skinny.c.

Referenced by setsubstate(), skinny_indicate(), and substate2str().

#define SUBSTATE_UNSET   0

Definition at line 1367 of file chan_skinny.c.

Referenced by handle_stimulus_message(), skinny_request(), and substate2str().

#define TIME_DATE_REQ_MESSAGE   0x000D

Definition at line 365 of file chan_skinny.c.

Referenced by handle_message().

#define TYPE_DEF_DEVICE   2

Definition at line 7718 of file chan_skinny.c.

Referenced by config_load(), and config_parse_variables().

#define TYPE_DEF_LINE   4

Definition at line 7719 of file chan_skinny.c.

Referenced by config_load(), and config_parse_variables().

#define TYPE_DEVICE   8

Definition at line 7720 of file chan_skinny.c.

Referenced by config_device(), and config_parse_variables().

#define TYPE_GENERAL   1

Definition at line 7717 of file chan_skinny.c.

Referenced by config_load(), and config_parse_variables().

#define TYPE_LINE   16

Definition at line 7721 of file chan_skinny.c.

#define UNREGISTER_MESSAGE   0x0027

Definition at line 402 of file chan_skinny.c.

Referenced by handle_message().

#define VERSION_REQ_MESSAGE   0x000F

Definition at line 367 of file chan_skinny.c.

Referenced by handle_message().

#define VERSION_RES_MESSAGE   0x0098

Definition at line 625 of file chan_skinny.c.

Referenced by transmit_versionres().


Enumeration Type Documentation

Enumerator:
SKINNY_CODEC_ALAW 
SKINNY_CODEC_ULAW 
SKINNY_CODEC_G722 
SKINNY_CODEC_G723_1 
SKINNY_CODEC_G729A 
SKINNY_CODEC_G726_32 
SKINNY_CODEC_H261 
SKINNY_CODEC_H263 

Definition at line 177 of file chan_skinny.c.

00177                    {
00178    SKINNY_CODEC_ALAW = 2,
00179    SKINNY_CODEC_ULAW = 4,
00180    SKINNY_CODEC_G722 = 6,
00181    SKINNY_CODEC_G723_1 = 9,
00182    SKINNY_CODEC_G729A = 12,
00183    SKINNY_CODEC_G726_32 = 82, /* XXX Which packing order does this translate to? */
00184    SKINNY_CODEC_H261 = 100,
00185    SKINNY_CODEC_H263 = 101
00186 };


Function Documentation

static void __init_callstate2str_threadbuf ( void   )  [static]

Definition at line 280 of file chan_skinny.c.

00291 {

static void __init_control2str_threadbuf ( void   )  [static]

Definition at line 274 of file chan_skinny.c.

00291 {

static void __init_device2str_threadbuf ( void   )  [static]

Definition at line 271 of file chan_skinny.c.

00291 {

static void __init_substate2str_threadbuf ( void   )  [static]

Definition at line 277 of file chan_skinny.c.

00291 {

static void __reg_module ( void   )  [static]

Definition at line 8792 of file chan_skinny.c.

static void __unreg_module ( void   )  [static]

Definition at line 8792 of file chan_skinny.c.

static char* _skinny_message_clear ( int  type,
int  fd,
struct mansession s,
const struct message m,
int  argc,
const char *const *  argv 
) [static]

Definition at line 4683 of file chan_skinny.c.

References AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, CLI_SHOWUSAGE, CLI_SUCCESS, d, and transmit_clearprinotify().

Referenced by handle_skinny_message_clear().

04684 {
04685    struct skinny_device *d;
04686 
04687    if (argc != 5) {
04688       return CLI_SHOWUSAGE;
04689    }
04690 
04691    AST_LIST_LOCK(&devices);
04692    AST_LIST_TRAVERSE(&devices, d, list) {
04693       if (!strcasecmp(argv[3], d->name)) {
04694          int priority = atoi(argv[4]);
04695          transmit_clearprinotify(d, priority);
04696       }
04697    }
04698    AST_LIST_UNLOCK(&devices);
04699    return CLI_SUCCESS;
04700 }

static char* _skinny_message_set ( int  type,
int  fd,
struct mansession s,
const struct message m,
int  argc,
const char *const *  argv 
) [static]

Definition at line 4633 of file chan_skinny.c.

References ast_copy_string(), AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, CLI_SHOWUSAGE, CLI_SUCCESS, d, send_displayprinotify(), and timeout.

Referenced by handle_skinny_message_set().

04634 {
04635    struct skinny_device *d;
04636    char text_buf[32];
04637 
04638    if (argc < 7) {
04639       return CLI_SHOWUSAGE;
04640    }
04641 
04642    AST_LIST_LOCK(&devices);
04643    AST_LIST_TRAVERSE(&devices, d, list) {
04644       if (!strcasecmp(argv[3], d->name)) {
04645          int i;
04646          char *strp = text_buf;
04647          int charleft = sizeof(text_buf);
04648          int priority = atoi(argv[4]);
04649          int timeout = atoi(argv[5]);
04650          ast_copy_string(strp, argv[6], charleft);
04651          charleft -= strlen(strp);
04652          strp += strlen(strp);
04653          for(i=7; i<argc; i++) {
04654             ast_copy_string(strp++, " ", charleft--);
04655             ast_copy_string(strp, argv[i], charleft);
04656             charleft -= strlen(strp);
04657             strp += strlen(strp);
04658          }
04659          send_displayprinotify(d, text_buf, "", timeout, priority);
04660       }
04661    }
04662    AST_LIST_UNLOCK(&devices);
04663    return CLI_SUCCESS;
04664 }

static char* _skinny_show_device ( int  type,
int  fd,
struct mansession s,
const struct message m,
int  argc,
const char *const *  argv 
) [static]

Definition at line 4173 of file chan_skinny.c.

References skinny_device::addons, ast_cli(), ast_format_cap_get_names(), ast_inet_ntoa(), AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_str_alloca, astman_append(), skinny_device::cap, CLI_SHOWUSAGE, CLI_SUCCESS, skinny_device::confcap, d, device2str(), skinny_serviceurl::displayName, skinny_speeddial::exten, skinny_speeddial::isHint, skinny_speeddial::label, skinny_device::lines, S_OR, skinny_device::serviceurls, skinny_device::session, skinnysession::sin, skinny_device::speeddials, skinny_addon::type, and skinny_serviceurl::url.

Referenced by handle_skinny_show_device(), and manager_skinny_show_device().

04174 {
04175    struct skinny_device *d;
04176    struct skinny_line *l;
04177    struct skinny_speeddial *sd;
04178    struct skinny_addon *sa;
04179    struct skinny_serviceurl *surl;
04180    struct ast_str *codec_buf = ast_str_alloca(64);
04181 
04182    if (argc < 4) {
04183       return CLI_SHOWUSAGE;
04184    }
04185 
04186    AST_LIST_LOCK(&devices);
04187    AST_LIST_TRAVERSE(&devices, d, list) {
04188       if (!strcasecmp(argv[3], d->id) || !strcasecmp(argv[3], d->name)) {
04189          int numlines = 0, numaddons = 0, numspeeddials = 0, numserviceurls = 0;
04190 
04191          AST_LIST_TRAVERSE(&d->lines, l, list){
04192             numlines++;
04193          }
04194 
04195          AST_LIST_TRAVERSE(&d->addons, sa, list) {
04196             numaddons++;
04197          }
04198 
04199          AST_LIST_TRAVERSE(&d->speeddials, sd, list) {
04200             numspeeddials++;
04201          }
04202 
04203          AST_LIST_TRAVERSE(&d->serviceurls, surl, list) {
04204             numserviceurls++;
04205          }
04206 
04207          if (type == 0) { /* CLI */
04208             ast_cli(fd, "Name:        %s\n", d->name);
04209             ast_cli(fd, "Id:          %s\n", d->id);
04210             ast_cli(fd, "version:     %s\n", S_OR(d->version_id, "Unknown"));
04211             ast_cli(fd, "Ip address:  %s\n", (d->session ? ast_inet_ntoa(d->session->sin.sin_addr) : "Unknown"));
04212             ast_cli(fd, "Port:        %d\n", (d->session ? ntohs(d->session->sin.sin_port) : 0));
04213             ast_cli(fd, "Device Type: %s\n", device2str(d->type));
04214             ast_cli(fd, "Conf Codecs: %s\n", ast_format_cap_get_names(d->confcap, &codec_buf));
04215             ast_cli(fd, "Neg Codecs: %s\n", ast_format_cap_get_names(d->cap, &codec_buf));
04216             ast_cli(fd, "Registered:  %s\n", (d->session ? "Yes" : "No"));
04217             ast_cli(fd, "Lines:       %d\n", numlines);
04218             AST_LIST_TRAVERSE(&d->lines, l, list) {
04219                ast_cli(fd, "  %s (%s)\n", l->name, l->label);
04220             }
04221             ast_cli(fd, "Addons:      %d\n", numaddons);
04222             AST_LIST_TRAVERSE(&d->addons, sa, list) {
04223                ast_cli(fd, "  %s\n", sa->type);
04224             }
04225             ast_cli(fd, "Speeddials:  %d\n", numspeeddials);
04226             AST_LIST_TRAVERSE(&d->speeddials, sd, list) {
04227                ast_cli(fd, "  %s (%s) ishint: %d\n", sd->exten, sd->label, sd->isHint);
04228             }
04229             ast_cli(fd, "ServiceURLs:  %d\n", numserviceurls);
04230             AST_LIST_TRAVERSE(&d->serviceurls, surl, list) {
04231                ast_cli(fd, "  %s (%s)\n", surl->displayName, surl->url);
04232             }
04233          } else { /* manager */
04234             astman_append(s, "Channeltype: SKINNY\r\n");
04235             astman_append(s, "ObjectName: %s\r\n", d->name);
04236             astman_append(s, "ChannelObjectType: device\r\n");
04237             astman_append(s, "Id: %s\r\n", d->id);
04238             astman_append(s, "version: %s\r\n", S_OR(d->version_id, "Unknown"));
04239             astman_append(s, "Ipaddress: %s\r\n", (d->session ? ast_inet_ntoa(d->session->sin.sin_addr) : "Unknown"));
04240             astman_append(s, "Port: %d\r\n", (d->session ? ntohs(d->session->sin.sin_port) : 0));
04241             astman_append(s, "DeviceType: %s\r\n", device2str(d->type));
04242             astman_append(s, "Codecs: %s\r\n", ast_format_cap_get_names(d->confcap, &codec_buf));
04243             astman_append(s, "CodecOrder: %s\r\n", ast_format_cap_get_names(d->cap, &codec_buf));
04244             astman_append(s, "Devicestatus: %s\r\n", (d->session?"registered":"unregistered"));
04245             astman_append(s, "NumberOfLines: %d\r\n", numlines);
04246             AST_LIST_TRAVERSE(&d->lines, l, list) {
04247                astman_append(s, "Line: %s (%s)\r\n", l->name, l->label);
04248             }
04249             astman_append(s, "NumberOfAddons: %d\r\n", numaddons);
04250             AST_LIST_TRAVERSE(&d->addons, sa, list) {
04251                astman_append(s, "Addon: %s\r\n", sa->type);
04252             }
04253             astman_append(s, "NumberOfSpeeddials: %d\r\n", numspeeddials);
04254             AST_LIST_TRAVERSE(&d->speeddials, sd, list) {
04255                astman_append(s, "Speeddial: %s (%s) ishint: %d\r\n", sd->exten, sd->label, sd->isHint);
04256             }
04257             astman_append(s, "ServiceURLs:  %d\r\n", numserviceurls);
04258             AST_LIST_TRAVERSE(&d->serviceurls, surl, list) {
04259                astman_append(s, "  %s (%s)\r\n", surl->displayName, surl->url);
04260             }
04261          }
04262       }
04263    }
04264    AST_LIST_UNLOCK(&devices);
04265    return CLI_SUCCESS;
04266 }

static char* _skinny_show_devices ( int  fd,
int *  total,
struct mansession s,
const struct message m,
int  argc,
const char *const *  argv 
) [static]

Definition at line 4069 of file chan_skinny.c.

References ast_cli(), ast_inet_ntoa(), AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_strlen_zero, astman_append(), astman_get_header(), CLI_SHOWUSAGE, CLI_SUCCESS, d, device2str(), id, skinny_device::lines, skinny_device::session, and skinnysession::sin.

Referenced by handle_skinny_show_devices(), and manager_skinny_show_devices().

04070 {
04071    struct skinny_device *d;
04072    struct skinny_line *l;
04073    const char *id;
04074    char idtext[256] = "";
04075    int total_devices = 0;
04076 
04077    if (s) { /* Manager - get ActionID */
04078       id = astman_get_header(m, "ActionID");
04079       if (!ast_strlen_zero(id))
04080          snprintf(idtext, sizeof(idtext), "ActionID: %s\r\n", id);
04081    }
04082 
04083    switch (argc) {
04084    case 3:
04085       break;
04086    default:
04087       return CLI_SHOWUSAGE;
04088    }
04089 
04090    if (!s) {
04091       ast_cli(fd, "Name                 DeviceId         IP              Type            R NL\n");
04092       ast_cli(fd, "-------------------- ---------------- --------------- --------------- - --\n");
04093    }
04094 
04095    AST_LIST_LOCK(&devices);
04096    AST_LIST_TRAVERSE(&devices, d, list) {
04097       int numlines = 0;
04098       total_devices++;
04099       AST_LIST_TRAVERSE(&d->lines, l, list) {
04100          numlines++;
04101       }
04102       if (!s) {
04103          ast_cli(fd, "%-20s %-16s %-15s %-15s %c %2d\n",
04104             d->name,
04105             d->id,
04106             d->session?ast_inet_ntoa(d->session->sin.sin_addr):"",
04107             device2str(d->type),
04108             d->session?'Y':'N',
04109             numlines);
04110       } else {
04111          astman_append(s,
04112             "Event: DeviceEntry\r\n%s"
04113             "Channeltype: SKINNY\r\n"
04114             "ObjectName: %s\r\n"
04115             "ChannelObjectType: device\r\n"
04116             "DeviceId: %s\r\n"
04117             "IPaddress: %s\r\n"
04118             "Type: %s\r\n"
04119             "Devicestatus: %s\r\n"
04120             "NumberOfLines: %d\r\n",
04121             idtext,
04122             d->name,
04123             d->id,
04124             d->session?ast_inet_ntoa(d->session->sin.sin_addr):"-none-",
04125             device2str(d->type),
04126             d->session?"registered":"unregistered",
04127             numlines);
04128       }
04129    }
04130    AST_LIST_UNLOCK(&devices);
04131 
04132    if (total)
04133       *total = total_devices;
04134 
04135    return CLI_SUCCESS;
04136 }

static char* _skinny_show_line ( int  type,
int  fd,
struct mansession s,
const struct message m,
int  argc,
const char *const *  argv 
) [static]

Definition at line 4424 of file chan_skinny.c.

References ast_callerid_merge(), ast_channel_amaflags2string(), ast_cli(), ast_format_cap_get_names(), AST_LIST_FIRST, AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_print_group(), ast_print_namedgroups(), ast_str_alloca, ast_str_reset(), astman_append(), skinny_line::cap, CLI_SHOWUSAGE, CLI_SUCCESS, skinny_line::confcap, skinny_subline::context, d, skinny_subline::exten, skinny_device::lines, skinny_subline::name, S_COR, S_OR, SKINNY_CFWD_ALL, SKINNY_CFWD_BUSY, SKINNY_CFWD_NOANSWER, and skinny_line::sublines.

Referenced by handle_skinny_show_line(), and manager_skinny_show_line().

04425 {
04426    struct skinny_device *d;
04427    struct skinny_line *l;
04428    struct skinny_subline *subline;
04429    struct ast_str *codec_buf = ast_str_alloca(64);
04430    char group_buf[256];
04431    char cbuf[256];
04432 
04433    switch (argc) {
04434    case 4:
04435       break;
04436    case 6:
04437       break;
04438    default:
04439       return CLI_SHOWUSAGE;
04440    }
04441 
04442    AST_LIST_LOCK(&devices);
04443 
04444    /* Show all lines matching the one supplied */
04445    AST_LIST_TRAVERSE(&devices, d, list) {
04446       if (argc == 6 && (strcasecmp(argv[5], d->id) && strcasecmp(argv[5], d->name))) {
04447          continue;
04448       }
04449       AST_LIST_TRAVERSE(&d->lines, l, list) {
04450          struct ast_str *tmp_str = ast_str_alloca(512);
04451 
04452          if (strcasecmp(argv[3], l->name)) {
04453             continue;
04454          }
04455          if (type == 0) { /* CLI */
04456             ast_cli(fd, "Line:             %s\n", l->name);
04457             ast_cli(fd, "On Device:        %s\n", d->name);
04458             ast_cli(fd, "Line Label:       %s\n", l->label);
04459             ast_cli(fd, "Extension:        %s\n", S_OR(l->exten, "<not set>"));
04460             ast_cli(fd, "Context:          %s\n", l->context);
04461             ast_cli(fd, "CallGroup:        %s\n", ast_print_group(group_buf, sizeof(group_buf), l->callgroup));
04462             ast_cli(fd, "PickupGroup:      %s\n", ast_print_group(group_buf, sizeof(group_buf), l->pickupgroup));
04463             ast_cli(fd, "NamedCallGroup:   %s\n", ast_print_namedgroups(&tmp_str, l->named_callgroups));
04464             ast_str_reset(tmp_str);
04465             ast_cli(fd, "NamedPickupGroup: %s\n", ast_print_namedgroups(&tmp_str, l->named_pickupgroups));
04466             ast_str_reset(tmp_str);
04467             ast_cli(fd, "Language:         %s\n", S_OR(l->language, "<not set>"));
04468             ast_cli(fd, "Accountcode:      %s\n", S_OR(l->accountcode, "<not set>"));
04469             ast_cli(fd, "AmaFlag:          %s\n", ast_channel_amaflags2string(l->amaflags));
04470             ast_cli(fd, "CallerId Number:  %s\n", S_OR(l->cid_num, "<not set>"));
04471             ast_cli(fd, "CallerId Name:    %s\n", S_OR(l->cid_name, "<not set>"));
04472             ast_cli(fd, "Hide CallerId:    %s\n", (l->hidecallerid ? "Yes" : "No"));
04473             ast_cli(fd, "CFwdAll:          %s\n", S_COR((l->cfwdtype & SKINNY_CFWD_ALL), l->call_forward_all, "<not set>"));
04474             ast_cli(fd, "CFwdBusy:         %s\n", S_COR((l->cfwdtype & SKINNY_CFWD_BUSY), l->call_forward_busy, "<not set>"));
04475             ast_cli(fd, "CFwdNoAnswer:     %s\n", S_COR((l->cfwdtype & SKINNY_CFWD_NOANSWER), l->call_forward_noanswer, "<not set>"));
04476             ast_cli(fd, "CFwdTimeout:      %dms\n", l->callfwdtimeout);
04477             ast_cli(fd, "VoicemailBox:     %s\n", S_OR(l->mailbox, "<not set>"));
04478             ast_cli(fd, "VoicemailNumber:  %s\n", S_OR(l->vmexten, "<not set>"));
04479             ast_cli(fd, "MWIblink:         %d\n", l->mwiblink);
04480             ast_cli(fd, "Regextension:     %s\n", S_OR(l->regexten, "<not set>"));
04481             ast_cli(fd, "Regcontext:       %s\n", S_OR(l->regcontext, "<not set>"));
04482             ast_cli(fd, "MoHInterpret:     %s\n", S_OR(l->mohinterpret, "<not set>"));
04483             ast_cli(fd, "MoHSuggest:       %s\n", S_OR(l->mohsuggest, "<not set>"));
04484             ast_cli(fd, "Last dialed nr:   %s\n", S_OR(l->lastnumberdialed, "<no calls made yet>"));
04485             ast_cli(fd, "Last CallerID:    %s\n", S_OR(l->lastcallerid, "<not set>"));
04486             ast_cli(fd, "Transfer enabled: %s\n", (l->transfer ? "Yes" : "No"));
04487             ast_cli(fd, "Callwaiting:      %s\n", (l->callwaiting ? "Yes" : "No"));
04488             ast_cli(fd, "3Way Calling:     %s\n", (l->threewaycalling ? "Yes" : "No"));
04489             ast_cli(fd, "Can forward:      %s\n", (l->cancallforward ? "Yes" : "No"));
04490             ast_cli(fd, "Do Not Disturb:   %s\n", (l->dnd ? "Yes" : "No"));
04491             ast_cli(fd, "NAT:              %s\n", (l->nat ? "Yes" : "No"));
04492             ast_cli(fd, "immediate:        %s\n", (l->immediate ? "Yes" : "No"));
04493             ast_cli(fd, "Group:            %d\n", l->group);
04494             ast_cli(fd, "Parkinglot:       %s\n", S_OR(l->parkinglot, "<not set>"));
04495             ast_cli(fd, "Conf Codecs:      %s\n", ast_format_cap_get_names(l->confcap, &codec_buf));
04496             ast_cli(fd, "Neg Codecs:       %s\n", ast_format_cap_get_names(l->cap, &codec_buf));
04497             if  (AST_LIST_FIRST(&l->sublines)) {
04498                ast_cli(fd, "Sublines:\n");
04499                AST_LIST_TRAVERSE(&l->sublines, subline, list) {
04500                   ast_cli(fd, "     %s, %s@%s\n", subline->name, subline->exten, subline->context);
04501                }
04502             }
04503             ast_cli(fd, "\n");
04504          } else { /* manager */
04505             astman_append(s, "Channeltype: SKINNY\r\n");
04506             astman_append(s, "ObjectName: %s\r\n", l->name);
04507             astman_append(s, "ChannelObjectType: line\r\n");
04508             astman_append(s, "Device: %s\r\n", d->name);
04509             astman_append(s, "LineLabel: %s\r\n", l->label);
04510             astman_append(s, "Extension: %s\r\n", S_OR(l->exten, "<not set>"));
04511             astman_append(s, "Context: %s\r\n", l->context);
04512             astman_append(s, "CallGroup: %s\r\n", ast_print_group(group_buf, sizeof(group_buf), l->callgroup));
04513             astman_append(s, "PickupGroup: %s\r\n", ast_print_group(group_buf, sizeof(group_buf), l->pickupgroup));
04514             astman_append(s, "NamedCallGroup: %s\r\n", ast_print_namedgroups(&tmp_str, l->named_callgroups));
04515             ast_str_reset(tmp_str);
04516             astman_append(s, "NamedPickupGroup: %s\r\n", ast_print_namedgroups(&tmp_str, l->named_pickupgroups));
04517             ast_str_reset(tmp_str);
04518             astman_append(s, "Language: %s\r\n", S_OR(l->language, "<not set>"));
04519             astman_append(s, "Accountcode: %s\r\n", S_OR(l->accountcode, "<not set>"));
04520             astman_append(s, "AMAflags: %s\r\n", ast_channel_amaflags2string(l->amaflags));
04521             astman_append(s, "Callerid: %s\r\n", ast_callerid_merge(cbuf, sizeof(cbuf), l->cid_name, l->cid_num, ""));
04522             astman_append(s, "HideCallerId: %s\r\n", (l->hidecallerid ? "Yes" : "No"));
04523             astman_append(s, "CFwdAll: %s\r\n", S_COR((l->cfwdtype & SKINNY_CFWD_ALL), l->call_forward_all, "<not set>"));
04524             astman_append(s, "CFwdBusy: %s\r\n", S_COR((l->cfwdtype & SKINNY_CFWD_BUSY), l->call_forward_busy, "<not set>"));
04525             astman_append(s, "CFwdNoAnswer: %s\r\n", S_COR((l->cfwdtype & SKINNY_CFWD_NOANSWER), l->call_forward_noanswer, "<not set>"));
04526             astman_append(s, "VoicemailBox: %s\r\n", S_OR(l->mailbox, "<not set>"));
04527             astman_append(s, "VoicemailNumber: %s\r\n", S_OR(l->vmexten, "<not set>"));
04528             astman_append(s, "MWIblink: %d\r\n", l->mwiblink);
04529             astman_append(s, "RegExtension: %s\r\n", S_OR(l->regexten, "<not set>"));
04530             astman_append(s, "Regcontext: %s\r\n", S_OR(l->regcontext, "<not set>"));
04531             astman_append(s, "MoHInterpret: %s\r\n", S_OR(l->mohinterpret, "<not set>"));
04532             astman_append(s, "MoHSuggest: %s\r\n", S_OR(l->mohsuggest, "<not set>"));
04533             astman_append(s, "LastDialedNr: %s\r\n", S_OR(l->lastnumberdialed, "<no calls made yet>"));
04534             astman_append(s, "LastCallerID: %s\r\n", S_OR(l->lastcallerid, "<not set>"));
04535             astman_append(s, "Transfer: %s\r\n", (l->transfer ? "Yes" : "No"));
04536             astman_append(s, "Callwaiting: %s\r\n", (l->callwaiting ? "Yes" : "No"));
04537             astman_append(s, "3WayCalling: %s\r\n", (l->threewaycalling ? "Yes" : "No"));
04538             astman_append(s, "CanForward: %s\r\n", (l->cancallforward ? "Yes" : "No"));
04539             astman_append(s, "DoNotDisturb: %s\r\n", (l->dnd ? "Yes" : "No"));
04540             astman_append(s, "NAT: %s\r\n", (l->nat ? "Yes" : "No"));
04541             astman_append(s, "immediate: %s\r\n", (l->immediate ? "Yes" : "No"));
04542             astman_append(s, "Group: %d\r\n", l->group);
04543             astman_append(s, "Parkinglot: %s\r\n", S_OR(l->parkinglot, "<not set>"));
04544             astman_append(s, "Codecs: %s\r\n", ast_format_cap_get_names(l->confcap, &codec_buf));
04545             astman_append(s, "\r\n");
04546          }
04547       }
04548    }
04549 
04550    AST_LIST_UNLOCK(&devices);
04551    return CLI_SUCCESS;
04552 }

static char* _skinny_show_lines ( int  fd,
int *  total,
struct mansession s,
const struct message m,
int  argc,
const char *const *  argv 
) [static]

Definition at line 4305 of file chan_skinny.c.

References skinny_line::activesub, ao2_cleanup, ast_channel_bridge_peer(), ast_channel_name(), ast_cli(), AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_strlen_zero, astman_append(), astman_get_header(), CLI_SHOWUSAGE, CLI_SUCCESS, skinny_line::device, id, skinny_subchannel::owner, RAII_VAR, skinny_line::sub, and sub.

Referenced by handle_skinny_show_lines(), and manager_skinny_show_lines().

04306 {
04307    struct skinny_line *l;
04308    struct skinny_subchannel *sub;
04309    int total_lines = 0;
04310    int verbose = 0;
04311    const char *id;
04312    char idtext[256] = "";
04313 
04314    if (s) { /* Manager - get ActionID */
04315       id = astman_get_header(m, "ActionID");
04316       if (!ast_strlen_zero(id))
04317          snprintf(idtext, sizeof(idtext), "ActionID: %s\r\n", id);
04318    }
04319 
04320    switch (argc) {
04321    case 4:
04322       verbose = 1;
04323       break;
04324    case 3:
04325       verbose = 0;
04326       break;
04327    default:
04328       return CLI_SHOWUSAGE;
04329    }
04330 
04331    if (!s) {
04332       ast_cli(fd, "Name                 Device Name          Instance Label               \n");
04333       ast_cli(fd, "-------------------- -------------------- -------- --------------------\n");
04334    }
04335    AST_LIST_LOCK(&lines);
04336    AST_LIST_TRAVERSE(&lines, l, all) {
04337       total_lines++;
04338       if (!s) {
04339          ast_cli(fd, "%-20s %-20s %8d %-20s\n",
04340             l->name,
04341             (l->device ? l->device->name : "Not connected"),
04342             l->instance,
04343             l->label);
04344          if (verbose) {
04345             AST_LIST_TRAVERSE(&l->sub, sub, list) {
04346                RAII_VAR(struct ast_channel *, bridged, ast_channel_bridge_peer(sub->owner), ao2_cleanup);
04347 
04348                ast_cli(fd, "  %s> %s to %s\n",
04349                   (sub == l->activesub?"Active  ":"Inactive"),
04350                   ast_channel_name(sub->owner),
04351                   bridged ? ast_channel_name(bridged) : ""
04352                );
04353             }
04354          }
04355       } else {
04356          astman_append(s,
04357             "Event: LineEntry\r\n%s"
04358             "Channeltype: SKINNY\r\n"
04359             "ObjectName: %s\r\n"
04360             "ChannelObjectType: line\r\n"
04361             "Device: %s\r\n"
04362             "Instance: %d\r\n"
04363             "Label: %s\r\n",
04364             idtext,
04365             l->name,
04366             (l->device ? l->device->name : "None"),
04367             l->instance,
04368             l->label);
04369       }
04370    }
04371    AST_LIST_UNLOCK(&lines);
04372 
04373    if (total) {
04374       *total = total_lines;
04375    }
04376 
04377    return CLI_SUCCESS;
04378 }

static void _transmit_displayprinotify ( struct skinny_device d,
const char *  text,
const char *  extratext,
int  timeout,
int  priority 
) [static]

Definition at line 2844 of file chan_skinny.c.

References ast_copy_string(), skinny_req::data, DISPLAY_PRINOTIFY_MESSAGE, skinny_data::displayprinotify, htolel, display_prinotify_message::priority, req_alloc(), SKINNY_DEBUG, display_prinotify_message::text, display_prinotify_message::timeout, and transmit_response().

Referenced by send_displayprinotify().

02845 {
02846    struct skinny_req *req;
02847 
02848    if (!(req = req_alloc(sizeof(struct display_prinotify_message), DISPLAY_PRINOTIFY_MESSAGE)))
02849       return;
02850 
02851    req->data.displayprinotify.timeout = htolel(timeout);
02852    req->data.displayprinotify.priority = htolel(priority);
02853 
02854    if ((char)*text == '\200') {
02855       int octalstrlen = strlen(text);
02856       ast_copy_string(req->data.displayprinotify.text, text, sizeof(req->data.displayprinotify.text));
02857       ast_copy_string(req->data.displayprinotify.text+octalstrlen, extratext, sizeof(req->data.displayprinotify.text)-octalstrlen);
02858       SKINNY_DEBUG(DEBUG_PACKET, 3, "Transmitting DISPLAY_PRINOTIFY_MESSAGE to %s, '\\%03o\\%03o', '%s', timeout=%d, priority=%d\n",
02859          d->name, (unsigned)*text, (unsigned)*(text+1), extratext, timeout, priority);
02860    } else {
02861       ast_copy_string(req->data.displayprinotify.text, text, sizeof(req->data.displayprinotify.text));
02862       SKINNY_DEBUG(DEBUG_PACKET, 3, "Transmitting DISPLAY_PRINOTIFY_MESSAGE to %s, '%s', timeout=%d, priority=%d\n",
02863          d->name, text, timeout, priority);
02864    }
02865 
02866    transmit_response(d, req);
02867 }

static void _transmit_displayprinotifyvar ( struct skinny_device d,
const char *  text,
const char *  extratext,
int  timeout,
int  priority 
) [static]

Definition at line 2869 of file chan_skinny.c.

References ast_copy_string(), skinny_req::data, DISPLAY_PRINOTIFY_MESSAGE_VARIABLE, skinny_data::displayprinotifyvar, htolel, skinny_req::len, MAXDISPLAYNOTIFYSTR, display_prinotify_message_variable::priority, req_alloc(), SKINNY_DEBUG, display_prinotify_message_variable::text, display_prinotify_message_variable::timeout, and transmit_response().

Referenced by send_displayprinotify().

02870 {
02871    struct skinny_req *req;
02872    int packetlen;
02873 
02874    if (!(req = req_alloc(sizeof(struct display_prinotify_message_variable), DISPLAY_PRINOTIFY_MESSAGE_VARIABLE)))
02875       return;
02876 
02877    req->data.displayprinotifyvar.timeout = htolel(timeout);
02878    req->data.displayprinotifyvar.priority = htolel(priority);
02879 
02880    if ((char)*text == '\200') {
02881       int octalstrlen = strlen(text);
02882       ast_copy_string(req->data.displayprinotifyvar.text, text, sizeof(req->data.displayprinotifyvar.text));
02883       ast_copy_string(req->data.displayprinotifyvar.text+octalstrlen, extratext, sizeof(req->data.displayprinotifyvar.text)-octalstrlen);
02884       packetlen = req->len - MAXDISPLAYNOTIFYSTR + strlen(text) + strlen(extratext);
02885       SKINNY_DEBUG(DEBUG_PACKET, 3, "Transmitting DISPLAY_PRINOTIFY_MESSAGE_VARIABLE to %s, '\\%03o\\%03o', '%s', timeout=%d, priority=%d\n",
02886          d->name, (unsigned)*text, (unsigned)*(text+1), extratext, timeout, priority);
02887    } else {
02888       ast_copy_string(req->data.displayprinotifyvar.text, text, sizeof(req->data.displayprinotifyvar.text));
02889       packetlen = req->len - MAXDISPLAYNOTIFYSTR + strlen(text);
02890       SKINNY_DEBUG(DEBUG_PACKET, 3, "Transmitting DISPLAY_PRINOTIFY_MESSAGE_VARIABLE to %s, '%s', timeout=%d, priority=%d\n",
02891          d->name, text, timeout, priority);
02892    }
02893 
02894    req->len = (packetlen & ~0x3) + 4;
02895 
02896    transmit_response(d, req);
02897 }

static void* accept_thread ( void *  ignore  )  [static]

Definition at line 7615 of file chan_skinny.c.

References ast_atomic_fetchadd_int(), ast_calloc, ast_log, ast_mutex_init, ast_pthread_create, destroy_session(), errno, skinnysession::fd, skinnysession::lock, LOG_NOTICE, LOG_WARNING, NULL, skinnysession::sin, SKINNY_DEBUG, skinny_session(), and skinnysession::t.

Referenced by config_load().

07616 {
07617    int as;
07618    struct sockaddr_in sin;
07619    socklen_t sinlen;
07620    struct skinnysession *s;
07621    struct protoent *p;
07622    int arg = 1;
07623 
07624    for (;;) {
07625       sinlen = sizeof(sin);
07626       as = accept(skinnysock, (struct sockaddr *)&sin, &sinlen);
07627       if (as < 0) {
07628          ast_log(LOG_NOTICE, "Accept returned -1: %s\n", strerror(errno));
07629          continue;
07630       }
07631 
07632       if (ast_atomic_fetchadd_int(&unauth_sessions, +1) >= auth_limit) {
07633          close(as);
07634          ast_atomic_fetchadd_int(&unauth_sessions, -1);
07635          continue;
07636       }
07637 
07638       p = getprotobyname("tcp");
07639       if(p) {
07640          if( setsockopt(as, p->p_proto, TCP_NODELAY, (char *)&arg, sizeof(arg) ) < 0 ) {
07641             ast_log(LOG_WARNING, "Failed to set Skinny tcp connection to TCP_NODELAY mode: %s\n", strerror(errno));
07642          }
07643       }
07644       if (!(s = ast_calloc(1, sizeof(struct skinnysession)))) {
07645          close(as);
07646          ast_atomic_fetchadd_int(&unauth_sessions, -1);
07647          continue;
07648       }
07649 
07650       ast_mutex_init(&s->lock);
07651       memcpy(&s->sin, &sin, sizeof(sin));
07652       s->fd = as;
07653 
07654       if (ast_pthread_create(&s->t, NULL, skinny_session, s)) {
07655          destroy_session(s);
07656       }
07657    }
07658    SKINNY_DEBUG(DEBUG_THREAD, 3, "Killing accept thread\n");
07659    close(as);
07660    return 0;
07661 }

static void activatesub ( struct skinny_subchannel sub,
int  state 
) [static]

Definition at line 6023 of file chan_skinny.c.

References skinny_line::activesub, skinny_subchannel::callid, skinny_subchannel::line, setsubstate(), SKINNY_DEBUG, skinny_subchannel::substate, SUBSTATE_CALLWAIT, SUBSTATE_HOLD, SUBSTATE_ONHOOK, and SUBSTATE_RINGIN.

Referenced by dialandactivatesub(), handle_hold_button(), and handle_soft_key_event_message().

06024 {
06025    struct skinny_line *l = sub->line;
06026 
06027    SKINNY_DEBUG(DEBUG_SUB, 3, "Sub %u - Activating, and deactivating sub %u\n",
06028       sub->callid, l->activesub ? l->activesub->callid : 0);
06029 
06030    if (sub == l->activesub) {
06031       setsubstate(sub, state);
06032    } else {
06033       if (l->activesub) {
06034          if (l->activesub->substate == SUBSTATE_RINGIN) {
06035             setsubstate(l->activesub, SUBSTATE_CALLWAIT);
06036          } else if (l->activesub->substate != SUBSTATE_HOLD) {
06037             setsubstate(l->activesub, SUBSTATE_ONHOOK);
06038          }
06039       }
06040       l->activesub = sub;
06041       setsubstate(sub, state);
06042    }
06043 }

static struct ast_variable* add_var ( const char *  buf,
struct ast_variable list 
) [static, read]

implement the setvar config line

Definition at line 1989 of file chan_skinny.c.

References ast_strdupa, ast_variable_new(), ast_variable::next, and NULL.

01990 {
01991    struct ast_variable *tmpvar = NULL;
01992    char *varname = ast_strdupa(buf), *varval = NULL;
01993 
01994    if ((varval = strchr(varname,'='))) {
01995       *varval++ = '\0';
01996       if ((tmpvar = ast_variable_new(varname, varval, ""))) {
01997          tmpvar->next = list;
01998          list = tmpvar;
01999       }
02000    }
02001    return list;
02002 }

static void cleanup_stale_contexts ( char *  new,
char *  old 
) [static]

Definition at line 2183 of file chan_skinny.c.

References ast_context_destroy(), ast_context_find(), ast_copy_string(), NULL, and strsep().

02184 {
02185    char *oldcontext, *newcontext, *stalecontext, *stringp, newlist[AST_MAX_CONTEXT];
02186 
02187    while ((oldcontext = strsep(&old, "&"))) {
02188       stalecontext = NULL;
02189       ast_copy_string(newlist, new, sizeof(newlist));
02190       stringp = newlist;
02191       while ((newcontext = strsep(&stringp, "&"))) {
02192          if (strcmp(newcontext, oldcontext) == 0) {
02193             /* This is not the context you're looking for */
02194             stalecontext = NULL;
02195             break;
02196          } else if (strcmp(newcontext, oldcontext)) {
02197             stalecontext = oldcontext;
02198          }
02199 
02200       }
02201       if (stalecontext)
02202          ast_context_destroy(ast_context_find(stalecontext), "Skinny");
02203    }
02204 }

static int codec_ast2skinny ( const struct ast_format astcodec  )  [static]

static struct ast_format* codec_skinny2ast ( enum skinny_codecs  skinnycodec  )  [static, read]

Definition at line 2101 of file chan_skinny.c.

References ast_format_alaw, ast_format_g722, ast_format_g723, ast_format_g726, ast_format_g729, ast_format_h261, ast_format_h263, ast_format_none, ast_format_ulaw, SKINNY_CODEC_ALAW, SKINNY_CODEC_G722, SKINNY_CODEC_G723_1, SKINNY_CODEC_G726_32, SKINNY_CODEC_G729A, SKINNY_CODEC_H261, SKINNY_CODEC_H263, and SKINNY_CODEC_ULAW.

Referenced by handle_capabilities_res_message().

02102 {
02103    switch (skinnycodec) {
02104    case SKINNY_CODEC_ALAW:
02105       return ast_format_alaw;
02106    case SKINNY_CODEC_ULAW:
02107       return ast_format_ulaw;
02108    case SKINNY_CODEC_G722:
02109       return ast_format_g722;
02110    case SKINNY_CODEC_G723_1:
02111       return ast_format_g723;
02112    case SKINNY_CODEC_G729A:
02113       return ast_format_g729;
02114    case SKINNY_CODEC_G726_32:
02115       return ast_format_g726; /* XXX Is this right? */
02116    case SKINNY_CODEC_H261:
02117       return ast_format_h261;
02118    case SKINNY_CODEC_H263:
02119       return ast_format_h263;
02120    default:
02121       return ast_format_none;
02122    }
02123 }

static char* complete_skinny_devices ( const char *  word,
int  state 
) [static]

Definition at line 3901 of file chan_skinny.c.

References AST_LIST_TRAVERSE, ast_strdup, d, and NULL.

Referenced by complete_skinny_reset(), and complete_skinny_show_device().

03902 {
03903    struct skinny_device *d;
03904    int wordlen = strlen(word), which = 0;
03905 
03906    AST_LIST_TRAVERSE(&devices, d, list) {
03907       if (!strncasecmp(word, d->name, wordlen) && ++which > state) {
03908                        return ast_strdup(d->name);
03909                }
03910    }
03911 
03912    return NULL;
03913 }

static char* complete_skinny_reset ( const char *  line,
const char *  word,
int  pos,
int  state 
) [static]

Definition at line 3920 of file chan_skinny.c.

References complete_skinny_devices(), and NULL.

Referenced by handle_skinny_reset().

03921 {
03922    return (pos == 2 ? complete_skinny_devices(word, state) : NULL);
03923 }

static char* complete_skinny_show_device ( const char *  line,
const char *  word,
int  pos,
int  state 
) [static]

Definition at line 3915 of file chan_skinny.c.

References complete_skinny_devices(), and NULL.

Referenced by handle_skinny_message_clear(), handle_skinny_message_set(), and handle_skinny_show_device().

03916 {
03917    return (pos == 3 ? complete_skinny_devices(word, state) : NULL);
03918 }

static char* complete_skinny_show_line ( const char *  line,
const char *  word,
int  pos,
int  state 
) [static]

Definition at line 3925 of file chan_skinny.c.

References AST_LIST_TRAVERSE, ast_strdup, d, skinny_device::lines, and NULL.

Referenced by handle_skinny_show_line().

03926 {
03927    struct skinny_device *d;
03928    struct skinny_line *l;
03929    int wordlen = strlen(word), which = 0;
03930 
03931    if (pos != 3)
03932       return NULL;
03933 
03934    AST_LIST_TRAVERSE(&devices, d, list) {
03935       AST_LIST_TRAVERSE(&d->lines, l, list) {
03936          if (!strncasecmp(word, l->name, wordlen) && ++which > state) {
03937             return ast_strdup(l->name);
03938          }
03939       }
03940    }
03941 
03942    return NULL;
03943 }

static struct skinny_device* config_device ( const char *  dname,
struct ast_variable v 
) [static, read]

Definition at line 8307 of file chan_skinny.c.

References skinny_device::activeline, skinny_line::activesub, skinny_device::addr, ast_copy_string(), ast_format_cap_append_from_cap(), AST_LIST_EMPTY, AST_LIST_FIRST, AST_LIST_INSERT_TAIL, AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_log, AST_MEDIA_TYPE_UNKNOWN, ast_mutex_init, ast_mutex_lock, ast_mutex_unlock, ast_verb, skinny_device::confcap, config_parse_variables(), d, default_device, DEFAULT_SKINNY_PORT, skinnysession::device, skinny_subchannel::line, skinny_device::lines, skinny_line::lock, skinny_device::lock, LOG_ERROR, LOG_NOTICE, NULL, skinny_device::session, skinny_device_alloc(), skinny_line::sub, sub, TYPE_DEVICE, and update().

Referenced by config_load().

08308 {
08309    struct skinny_device *d, *temp;
08310    struct skinny_line *l, *ltemp;
08311    struct skinny_subchannel *sub;
08312    int update = 0;
08313 
08314    ast_log(LOG_NOTICE, "Configuring skinny device %s.\n", dname);
08315 
08316    AST_LIST_LOCK(&devices);
08317    AST_LIST_TRAVERSE(&devices, temp, list) {
08318       if (!strcasecmp(dname, temp->name) && temp->prune) {
08319          update = 1;
08320          break;
08321       }
08322    }
08323 
08324    if (!(d = skinny_device_alloc(dname))) {
08325       ast_verb(1, "Unable to allocate memory for device %s.\n", dname);
08326       AST_LIST_UNLOCK(&devices);
08327       return NULL;
08328    }
08329    memcpy(d, default_device, sizeof(*default_device));
08330    ast_mutex_init(&d->lock);
08331    ast_copy_string(d->name, dname, sizeof(d->name));
08332    ast_format_cap_append_from_cap(d->confcap, default_cap, AST_MEDIA_TYPE_UNKNOWN);
08333    AST_LIST_INSERT_TAIL(&devices, d, list);
08334 
08335    ast_mutex_lock(&d->lock);
08336    AST_LIST_UNLOCK(&devices);
08337 
08338    config_parse_variables(TYPE_DEVICE, d, v);
08339 
08340    if (!AST_LIST_FIRST(&d->lines)) {
08341       ast_log(LOG_ERROR, "A Skinny device must have at least one line!\n");
08342       ast_mutex_unlock(&d->lock);
08343       return NULL;
08344    }
08345    if (/*d->addr.sin_addr.s_addr && */!ntohs(d->addr.sin_port)) {
08346       d->addr.sin_port = htons(DEFAULT_SKINNY_PORT);
08347    }
08348 
08349    if (skinnyreload){
08350       AST_LIST_LOCK(&devices);
08351       AST_LIST_TRAVERSE(&devices, temp, list) {
08352          if (strcasecmp(d->id, temp->id) || !temp->prune || !temp->session) {
08353             continue;
08354          }
08355          ast_mutex_lock(&d->lock);
08356          d->session = temp->session;
08357          d->session->device = d;
08358          d->hookstate = temp->hookstate;
08359 
08360          AST_LIST_LOCK(&d->lines);
08361          AST_LIST_TRAVERSE(&d->lines, l, list){
08362 
08363             AST_LIST_LOCK(&temp->lines);
08364             AST_LIST_TRAVERSE(&temp->lines, ltemp, list) {
08365                if (strcasecmp(l->name, ltemp->name)) {
08366                   continue;
08367                }
08368                ast_mutex_lock(&ltemp->lock);
08369                l->instance = ltemp->instance;
08370                if (l == temp->activeline) {
08371                   d->activeline = l;
08372                }
08373                if (!AST_LIST_EMPTY(&ltemp->sub)) {
08374                   ast_mutex_lock(&l->lock);
08375                   l->sub = ltemp->sub;
08376                   l->activesub = ltemp->activesub;
08377                   AST_LIST_TRAVERSE(&l->sub, sub, list) {
08378                      sub->line = l;
08379                   }
08380                   ast_mutex_unlock(&l->lock);
08381                }
08382                ast_mutex_unlock(&ltemp->lock);
08383             }
08384             AST_LIST_UNLOCK(&temp->lines);
08385          }
08386          AST_LIST_UNLOCK(&d->lines);
08387          ast_mutex_unlock(&d->lock);
08388       }
08389       AST_LIST_UNLOCK(&devices);
08390    }
08391 
08392    ast_mutex_unlock(&d->lock);
08393 
08394    ast_verb(3, "%s config for device '%s'\n", update ? "Updated" : (skinnyreload ? "Reloaded" : "Created"), d->name);
08395 
08396    return d;
08397 
08398 }

static struct skinny_line* config_line ( const char *  lname,
struct ast_variable v 
) [static, read]

Definition at line 8236 of file chan_skinny.c.

References ast_calloc, ast_copy_string(), ast_format_cap_append_from_cap(), AST_LIST_INSERT_TAIL, AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_log, AST_MEDIA_TYPE_UNKNOWN, ast_mutex_init, ast_mutex_lock, ast_mutex_unlock, ast_mwi_topic(), ast_strlen_zero, ast_verb, skinny_line::confcap, config_parse_variables(), skinny_line::container, skinny_container::data, default_line, skinny_line::lock, LOG_NOTICE, LOG_WARNING, mwi_event_cb(), skinny_line::mwi_event_sub, NULL, skinny_line_alloc(), skinny_line_destroy(), SKINNY_LINECONTAINER, stasis_subscribe_pool(), skinny_container::type, TYPE_LINE, and update().

Referenced by config_load().

08237 {
08238    struct skinny_line *l, *temp;
08239    int update = 0;
08240    struct skinny_container *container;
08241 
08242    ast_log(LOG_NOTICE, "Configuring skinny line %s.\n", lname);
08243 
08244    /* We find the old line and remove it just before the new
08245       line is created */
08246    AST_LIST_LOCK(&lines);
08247    AST_LIST_TRAVERSE(&lines, temp, all) {
08248       if (!strcasecmp(lname, temp->name) && temp->prune) {
08249          update = 1;
08250          break;
08251       }
08252    }
08253 
08254    if (!(l = skinny_line_alloc())) {
08255       ast_verb(1, "Unable to allocate memory for line %s.\n", lname);
08256       AST_LIST_UNLOCK(&lines);
08257       return NULL;
08258    }
08259    if (!(container = ast_calloc(1, sizeof(*container)))) {
08260       ast_log(LOG_WARNING, "Unable to allocate memory for line %s container.\n", lname);
08261       skinny_line_destroy(l);
08262       AST_LIST_UNLOCK(&lines);
08263       return NULL;
08264    }
08265 
08266    container->type = SKINNY_LINECONTAINER;
08267    container->data = l;
08268    l->container = container;
08269 
08270    memcpy(l, default_line, sizeof(*default_line));
08271    ast_mutex_init(&l->lock);
08272    ast_copy_string(l->name, lname, sizeof(l->name));
08273    ast_format_cap_append_from_cap(l->confcap, default_cap, AST_MEDIA_TYPE_UNKNOWN);
08274    AST_LIST_INSERT_TAIL(&lines, l, all);
08275 
08276    ast_mutex_lock(&l->lock);
08277    AST_LIST_UNLOCK(&lines);
08278 
08279    config_parse_variables(TYPE_LINE, l, v);
08280 
08281    if (!ast_strlen_zero(l->mailbox)) {
08282       struct stasis_topic *mailbox_specific_topic;
08283 
08284       ast_verb(3, "Setting mailbox '%s' on line %s\n", l->mailbox, l->name);
08285 
08286       mailbox_specific_topic = ast_mwi_topic(l->mailbox);
08287       if (mailbox_specific_topic) {
08288          l->mwi_event_sub = stasis_subscribe_pool(mailbox_specific_topic, mwi_event_cb, l);
08289       }
08290    }
08291 
08292    if (!ast_strlen_zero(vmexten) && ast_strlen_zero(l->vmexten)) {
08293       ast_copy_string(l->vmexten, vmexten, sizeof(l->vmexten));
08294    }
08295 
08296    ast_mutex_unlock(&l->lock);
08297 
08298    /* We do not want to unlink or free the line yet, it needs
08299       to be available to detect a device reconfig when we load the
08300       devices.  Old lines will be pruned after the reload completes */
08301 
08302    ast_verb(3, "%s config for line '%s'\n", update ? "Updated" : (skinnyreload ? "Reloaded" : "Created"), l->name);
08303 
08304    return l;
08305 }

static int config_load ( void   )  [static]

Definition at line 8400 of file chan_skinny.c.

References __ourip, accept_thread(), ahp, ast_category_browse(), ast_config_destroy(), ast_config_load, ast_gethostbyname(), ast_inet_ntoa(), ast_log, ast_mutex_lock, ast_mutex_unlock, ast_pthread_create_background, ast_set_qos(), ast_variable_browse(), ast_verb, bindaddr, config_device(), config_line(), config_parse_variables(), CONFIG_STATUS_FILEINVALID, default_device, default_line, DEFAULT_SKINNY_BACKLOG, DEFAULT_SKINNY_PORT, errno, global_jbconf, LOG_ERROR, LOG_NOTICE, LOG_WARNING, netlock, NULL, qos, TYPE_DEF_DEVICE, TYPE_DEF_LINE, and TYPE_GENERAL.

Referenced by load_module(), and skinny_reload().

08401 {
08402    int on = 1;
08403    struct ast_config *cfg;
08404    char *cat;
08405    int oldport = ntohs(bindaddr.sin_port);
08406    struct ast_flags config_flags = { 0 };
08407 
08408    ast_log(LOG_NOTICE, "Configuring skinny from %s\n", config);
08409 
08410    if (gethostname(ourhost, sizeof(ourhost))) {
08411       ast_log(LOG_WARNING, "Unable to get hostname, Skinny disabled.\n");
08412       return 0;
08413    }
08414    cfg = ast_config_load(config, config_flags);
08415 
08416    /* We *must* have a config file otherwise stop immediately */
08417    if (!cfg || cfg == CONFIG_STATUS_FILEINVALID) {
08418       ast_log(LOG_NOTICE, "Unable to load config %s, Skinny disabled.\n", config);
08419       return -1;
08420    }
08421 
08422    memset(&bindaddr, 0, sizeof(bindaddr));
08423    immed_dialchar = '\0';
08424    memset(&vmexten, '\0', sizeof(vmexten));
08425 
08426 
08427    /* Copy the default jb config over global_jbconf */
08428    memcpy(&global_jbconf, &default_jbconf, sizeof(struct ast_jb_conf));
08429 
08430    /* load the general section */
08431    cat = ast_category_browse(cfg, "general");
08432    config_parse_variables(TYPE_GENERAL, NULL, ast_variable_browse(cfg, "general"));
08433 
08434    if (ntohl(bindaddr.sin_addr.s_addr)) {
08435       __ourip = bindaddr.sin_addr;
08436    } else {
08437       hp = ast_gethostbyname(ourhost, &ahp);
08438       if (!hp) {
08439          ast_log(LOG_WARNING, "Unable to get our IP address, Skinny disabled\n");
08440          ast_config_destroy(cfg);
08441          return 0;
08442       }
08443       memcpy(&__ourip, hp->h_addr, sizeof(__ourip));
08444    }
08445    if (!ntohs(bindaddr.sin_port)) {
08446       bindaddr.sin_port = htons(DEFAULT_SKINNY_PORT);
08447    }
08448    bindaddr.sin_family = AF_INET;
08449 
08450    /* load the lines sections */
08451    config_parse_variables(TYPE_DEF_LINE, default_line, ast_variable_browse(cfg, "lines"));
08452    cat = ast_category_browse(cfg, "lines");
08453    while (cat && strcasecmp(cat, "general") && strcasecmp(cat, "devices")) {
08454       config_line(cat, ast_variable_browse(cfg, cat));
08455       cat = ast_category_browse(cfg, cat);
08456    }
08457 
08458    /* load the devices sections */
08459    config_parse_variables(TYPE_DEF_DEVICE, default_device, ast_variable_browse(cfg, "devices"));
08460    cat = ast_category_browse(cfg, "devices");
08461    while (cat && strcasecmp(cat, "general") && strcasecmp(cat, "lines")) {
08462       config_device(cat, ast_variable_browse(cfg, cat));
08463       cat = ast_category_browse(cfg, cat);
08464    }
08465 
08466    ast_mutex_lock(&netlock);
08467    if ((skinnysock > -1) && (ntohs(bindaddr.sin_port) != oldport)) {
08468       close(skinnysock);
08469       skinnysock = -1;
08470    }
08471    if (skinnysock < 0) {
08472       skinnysock = socket(AF_INET, SOCK_STREAM, 0);
08473       if(setsockopt(skinnysock, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) == -1) {
08474          ast_log(LOG_ERROR, "Set Socket Options failed: errno %d, %s\n", errno, strerror(errno));
08475          ast_config_destroy(cfg);
08476          ast_mutex_unlock(&netlock);
08477          return 0;
08478       }
08479       if (skinnysock < 0) {
08480          ast_log(LOG_WARNING, "Unable to create Skinny socket: %s\n", strerror(errno));
08481       } else {
08482          if (bind(skinnysock, (struct sockaddr *)&bindaddr, sizeof(bindaddr)) < 0) {
08483             ast_log(LOG_WARNING, "Failed to bind to %s:%d: %s\n",
08484                   ast_inet_ntoa(bindaddr.sin_addr), ntohs(bindaddr.sin_port),
08485                      strerror(errno));
08486             close(skinnysock);
08487             skinnysock = -1;
08488             ast_config_destroy(cfg);
08489             ast_mutex_unlock(&netlock);
08490             return 0;
08491          }
08492          if (listen(skinnysock, DEFAULT_SKINNY_BACKLOG)) {
08493                ast_log(LOG_WARNING, "Failed to start listening to %s:%d: %s\n",
08494                   ast_inet_ntoa(bindaddr.sin_addr), ntohs(bindaddr.sin_port),
08495                      strerror(errno));
08496                close(skinnysock);
08497                skinnysock = -1;
08498                ast_config_destroy(cfg);
08499                ast_mutex_unlock(&netlock);
08500                return 0;
08501          }
08502          ast_verb(2, "Skinny listening on %s:%d\n",
08503                ast_inet_ntoa(bindaddr.sin_addr), ntohs(bindaddr.sin_port));
08504          ast_set_qos(skinnysock, qos.tos, qos.cos, "Skinny");
08505          ast_pthread_create_background(&accept_t, NULL, accept_thread, NULL);
08506       }
08507    }
08508    ast_mutex_unlock(&netlock);
08509    ast_config_destroy(cfg);
08510    return 1;
08511 }

static void config_parse_variables ( int  type,
void *  item,
struct ast_variable vptr 
) [static]

Definition at line 7728 of file chan_skinny.c.

References add_var(), ahp, skinny_line::all, ast_append_ha(), ast_callerid_split(), ast_calloc, ast_channel_string2amaflag(), ast_context_find_or_create(), ast_copy_string(), ast_format_cap_update_by_allow_disallow(), ast_free, ast_get_group(), ast_get_ip(), ast_get_namedgroups(), ast_gethostbyname(), ast_jb_read_conf(), AST_LIST_FIRST, AST_LIST_INSERT_HEAD, AST_LIST_TRAVERSE, ast_log, ast_mutex_init, ast_sockaddr_to_sin, ast_str2cos(), ast_str2tos(), ast_strip(), ast_strlen_zero, ast_true(), bindaddr, CDEV, CDEV_OPTS, cleanup_stale_contexts(), CLINE, CLINE_OPTS, skinny_speeddial::container, skinny_subline::container, skinny_speeddial::context, skinny_subline::context, d, skinny_container::data, DEFAULT_AUTH_LIMIT, DEFAULT_AUTH_TIMEOUT, skinny_serviceurl::device, skinny_line::device, skinny_serviceurl::displayName, skinny_speeddial::exten, skinny_subline::exten, global_jbconf, skinny_serviceurl::instance, skinny_speeddial::instance, skinny_speeddial::isHint, skinny_speeddial::label, skinny_subline::line, ast_variable::lineno, skinny_device::lines, skinny_subline::lnname, skinny_addon::lock, skinny_speeddial::lock, LOG_WARNING, skinny_subline::name, ast_variable::name, ast_variable::next, NULL, skinny_speeddial::parent, qos, S_OR, SKINNY_SDCONTAINER, SKINNY_SUBLINECONTAINER, ast_sockaddr::ss, skinny_subline::stname, strsep(), skinny_subline::sub, timeout, skinny_addon::type, skinny_container::type, TYPE_DEF_DEVICE, TYPE_DEF_LINE, TYPE_DEVICE, TYPE_GENERAL, TYPE_LINE, skinny_serviceurl::url, and ast_variable::value.

Referenced by config_device(), config_line(), and config_load().

07729 {
07730    struct ast_variable *v;
07731    int lineInstance = 1;
07732    int speeddialInstance = 1;
07733    int serviceUrlInstance = 1;
07734 
07735    while(vptr) {
07736       v = vptr;
07737       vptr = vptr->next;
07738 
07739       if (type & (TYPE_GENERAL)) {
07740          char newcontexts[AST_MAX_CONTEXT];
07741          char oldcontexts[AST_MAX_CONTEXT];
07742          char *stringp, *context, *oldregcontext;
07743          if (!ast_jb_read_conf(&global_jbconf, v->name, v->value)) {
07744             v = v->next;
07745             continue;
07746          }
07747          if (!strcasecmp(v->name, "bindaddr")) {
07748             if (!(hp = ast_gethostbyname(v->value, &ahp))) {
07749                ast_log(LOG_WARNING, "Invalid address: %s\n", v->value);
07750             } else {
07751                memcpy(&bindaddr.sin_addr, hp->h_addr, sizeof(bindaddr.sin_addr));
07752             }
07753             continue;
07754          } else if (!strcasecmp(v->name, "keepalive")) {
07755             keep_alive = atoi(v->value);
07756             continue;
07757          } else if (!strcasecmp(v->name, "authtimeout")) {
07758             int timeout = atoi(v->value);
07759 
07760             if (timeout < 1) {
07761                ast_log(LOG_WARNING, "Invalid authtimeout value '%s', using default value\n", v->value);
07762                auth_timeout = DEFAULT_AUTH_TIMEOUT;
07763             } else {
07764                auth_timeout = timeout;
07765             }
07766             continue;
07767          } else if (!strcasecmp(v->name, "authlimit")) {
07768             int limit = atoi(v->value);
07769 
07770             if (limit < 1) {
07771                ast_log(LOG_WARNING, "Invalid authlimit value '%s', using default value\n", v->value);
07772                auth_limit = DEFAULT_AUTH_LIMIT;
07773             } else {
07774                auth_limit = limit;
07775             }
07776             continue;
07777          } else if (!strcasecmp(v->name, "regcontext")) {
07778             ast_copy_string(newcontexts, v->value, sizeof(newcontexts));
07779             stringp = newcontexts;
07780             /* Initialize copy of current global_regcontext for later use in removing stale contexts */
07781             ast_copy_string(oldcontexts, regcontext, sizeof(oldcontexts));
07782             oldregcontext = oldcontexts;
07783             /* Let's remove any contexts that are no longer defined in regcontext */
07784             cleanup_stale_contexts(stringp, oldregcontext);
07785             /* Create contexts if they don't exist already */
07786             while ((context = strsep(&stringp, "&"))) {
07787                ast_copy_string(used_context, context, sizeof(used_context));
07788                ast_context_find_or_create(NULL, NULL, context, "Skinny");
07789             }
07790             ast_copy_string(regcontext, v->value, sizeof(regcontext));
07791             continue;
07792          } else if (!strcasecmp(v->name, "vmexten")) {
07793             ast_copy_string(vmexten, v->value, sizeof(vmexten));
07794             continue;
07795          } else if (!strcasecmp(v->name, "immeddialkey")) {
07796             if (!strcmp(v->value,"#")) {
07797                immed_dialchar = '#';
07798             } else if (!strcmp(v->value,"*")) {
07799                immed_dialchar = '*';
07800             } else {
07801                ast_log(LOG_WARNING, "Invalid immeddialkey '%s' at line %d, only # or * accepted. Immeddial key disabled\n", v->value, v->lineno);
07802             }
07803 
07804             continue;
07805          } else if (!strcasecmp(v->name, "dateformat")) {
07806             memcpy(date_format, v->value, sizeof(date_format));
07807             continue;
07808          } else if (!strcasecmp(v->name, "tos")) {
07809             if (ast_str2tos(v->value, &qos.tos))
07810                ast_log(LOG_WARNING, "Invalid tos value at line %d, refer to QoS documentation\n", v->lineno);
07811             continue;
07812          } else if (!strcasecmp(v->name, "tos_audio")) {
07813             if (ast_str2tos(v->value, &qos.tos_audio))
07814                ast_log(LOG_WARNING, "Invalid tos_audio value at line %d, refer to QoS documentation\n", v->lineno);
07815             continue;
07816          } else if (!strcasecmp(v->name, "tos_video")) {
07817             if (ast_str2tos(v->value, &qos.tos_video))
07818                ast_log(LOG_WARNING, "Invalid tos_video value at line %d, refer to QoS documentation\n", v->lineno);
07819             continue;
07820          } else if (!strcasecmp(v->name, "cos")) {
07821             if (ast_str2cos(v->value, &qos.cos))
07822                ast_log(LOG_WARNING, "Invalid cos value at line %d, refer to QoS documentation\n", v->lineno);
07823             continue;
07824          } else if (!strcasecmp(v->name, "cos_audio")) {
07825             if (ast_str2cos(v->value, &qos.cos_audio))
07826                ast_log(LOG_WARNING, "Invalid cos_audio value at line %d, refer to QoS documentation\n", v->lineno);
07827             continue;
07828          } else if (!strcasecmp(v->name, "cos_video")) {
07829             if (ast_str2cos(v->value, &qos.cos_video))
07830                ast_log(LOG_WARNING, "Invalid cos_video value at line %d, refer to QoS documentation\n", v->lineno);
07831             continue;
07832          } else if (!strcasecmp(v->name, "bindport")) {
07833             if (sscanf(v->value, "%5d", &ourport) == 1) {
07834                bindaddr.sin_port = htons(ourport);
07835             } else {
07836                ast_log(LOG_WARNING, "Invalid bindport '%s' at line %d of %s\n", v->value, v->lineno, config);
07837             }
07838             continue;
07839          } else if (!strcasecmp(v->name, "allow")) {
07840             ast_format_cap_update_by_allow_disallow(default_cap, v->value, 1);
07841             continue;
07842          } else if (!strcasecmp(v->name, "disallow")) {
07843             ast_format_cap_update_by_allow_disallow(default_cap, v->value, 0);
07844             continue;
07845          }
07846       }
07847 
07848       if (!strcasecmp(v->name, "transfer")) {
07849          if (type & (TYPE_DEF_DEVICE | TYPE_DEVICE)) {
07850             CDEV_OPTS->transfer = ast_true(v->value);
07851             continue;
07852          } else if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
07853             CLINE_OPTS->transfer = ast_true(v->value);
07854             continue;
07855          }
07856       } else if (!strcasecmp(v->name, "callwaiting")) {
07857          if (type & (TYPE_DEF_DEVICE | TYPE_DEVICE)) {
07858             CDEV_OPTS->callwaiting = ast_true(v->value);
07859             continue;
07860          } else if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
07861             CLINE_OPTS->callwaiting = ast_true(v->value);
07862             continue;
07863          }
07864       } else if (!strcasecmp(v->name, "directmedia") || !strcasecmp(v->name, "canreinvite")) {
07865          if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
07866             CLINE_OPTS->directmedia = ast_true(v->value);
07867             continue;
07868          }
07869       } else if (!strcasecmp(v->name, "nat")) {
07870          if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
07871             CLINE_OPTS->nat = ast_true(v->value);
07872             continue;
07873          }
07874       } else if (!strcasecmp(v->name, "context")) {
07875          if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
07876             ast_copy_string(CLINE_OPTS->context, v->value, sizeof(CLINE_OPTS->context));
07877             continue;
07878          }
07879       }else if (!strcasecmp(v->name, "vmexten")) {
07880          if (type & (TYPE_DEF_DEVICE | TYPE_DEVICE)) {
07881             ast_copy_string(CDEV_OPTS->vmexten, v->value, sizeof(CDEV_OPTS->vmexten));
07882             continue;
07883          } else if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
07884             ast_copy_string(CLINE_OPTS->vmexten, v->value, sizeof(CLINE_OPTS->vmexten));
07885             continue;
07886          }
07887       } else if (!strcasecmp(v->name, "mwiblink")) {
07888          if (type & (TYPE_DEF_DEVICE | TYPE_DEVICE)) {
07889             CDEV_OPTS->mwiblink = ast_true(v->value);
07890             continue;
07891          } else if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
07892             CLINE_OPTS->mwiblink = ast_true(v->value);
07893             continue;
07894          }
07895       } else if (!strcasecmp(v->name, "linelabel")) {
07896          if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
07897             ast_copy_string(CLINE_OPTS->label, v->value, sizeof(CLINE_OPTS->label));
07898             continue;
07899          }
07900       } else if (!strcasecmp(v->name, "callerid")) {
07901          if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
07902             if (!strcasecmp(v->value, "asreceived")) {
07903                CLINE_OPTS->cid_num[0] = '\0';
07904                CLINE_OPTS->cid_name[0] = '\0';
07905             } else {
07906                ast_callerid_split(v->value, CLINE_OPTS->cid_name, sizeof(CLINE_OPTS->cid_name), CLINE_OPTS->cid_num, sizeof(CLINE_OPTS->cid_num));
07907             }
07908             continue;
07909          }
07910       } else if (!strcasecmp(v->name, "amaflags")) {
07911          if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
07912             int tempamaflags = ast_channel_string2amaflag(v->value);
07913             if (tempamaflags < 0) {
07914                ast_log(LOG_WARNING, "Invalid AMA flags: %s at line %d\n", v->value, v->lineno);
07915             } else {
07916                CLINE_OPTS->amaflags = tempamaflags;
07917             }
07918             continue;
07919          }
07920       } else if (!strcasecmp(v->name, "regexten")) {
07921          if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
07922             ast_copy_string(CLINE_OPTS->regexten, v->value, sizeof(CLINE_OPTS->regexten));
07923             continue;
07924          }
07925       } else if (!strcasecmp(v->name, "language")) {
07926          if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
07927             ast_copy_string(CLINE_OPTS->language, v->value, sizeof(CLINE_OPTS->language));
07928             continue;
07929          }
07930       } else if (!strcasecmp(v->name, "accountcode")) {
07931          if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
07932             ast_copy_string(CLINE_OPTS->accountcode, v->value, sizeof(CLINE_OPTS->accountcode));
07933             continue;
07934          }
07935       } else if (!strcasecmp(v->name, "mohinterpret") || !strcasecmp(v->name, "musiconhold")) {
07936          if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
07937             ast_copy_string(CLINE_OPTS->mohinterpret, v->value, sizeof(CLINE_OPTS->mohinterpret));
07938             continue;
07939          }
07940       } else if (!strcasecmp(v->name, "mohsuggest")) {
07941          if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
07942             ast_copy_string(CLINE_OPTS->mohsuggest, v->value, sizeof(CLINE_OPTS->mohsuggest));
07943             continue;
07944          }
07945       } else if (!strcasecmp(v->name, "callgroup")) {
07946          if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
07947             CLINE_OPTS->callgroup = ast_get_group(v->value);
07948             continue;
07949          }
07950       } else if (!strcasecmp(v->name, "pickupgroup")) {
07951          if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
07952             CLINE_OPTS->pickupgroup = ast_get_group(v->value);
07953             continue;
07954          }
07955       } else if (!strcasecmp(v->name, "namedcallgroup")) {
07956          if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
07957             CLINE_OPTS->named_callgroups = ast_get_namedgroups(v->value);
07958             continue;
07959          }
07960       } else if (!strcasecmp(v->name, "namedpickupgroup")) {
07961          if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
07962             CLINE_OPTS->named_pickupgroups = ast_get_namedgroups(v->value);
07963             continue;
07964          }
07965       } else if (!strcasecmp(v->name, "immediate")) {
07966          if (type & (TYPE_DEF_DEVICE | TYPE_DEVICE | TYPE_DEF_LINE | TYPE_LINE)) {
07967             CLINE_OPTS->immediate = ast_true(v->value);
07968             continue;
07969          }
07970       } else if (!strcasecmp(v->name, "cancallforward")) {
07971          if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
07972             CLINE_OPTS->cancallforward = ast_true(v->value);
07973             continue;
07974          }
07975       } else if (!strcasecmp(v->name, "callfwdtimeout")) {
07976          if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
07977             CLINE_OPTS->callfwdtimeout = atoi(v->value);
07978             continue;
07979          }
07980       } else if (!strcasecmp(v->name, "mailbox")) {
07981          if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
07982             ast_copy_string(CLINE_OPTS->mailbox, v->value, sizeof(CLINE_OPTS->mailbox));
07983             continue;
07984          }
07985       } else if ( !strcasecmp(v->name, "parkinglot")) {
07986          if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
07987             ast_copy_string(CLINE_OPTS->parkinglot, v->value, sizeof(CLINE_OPTS->parkinglot));
07988             continue;
07989          }
07990       } else if (!strcasecmp(v->name, "hasvoicemail")) {
07991          if (type & (TYPE_LINE)) {
07992             if (ast_true(v->value) && ast_strlen_zero(CLINE->mailbox)) {
07993                /*
07994                 * hasvoicemail is a users.conf legacy voicemail enable method.
07995                 * hasvoicemail is only going to work for app_voicemail mailboxes.
07996                 */
07997                if (strchr(CLINE->name, '@')) {
07998                   ast_copy_string(CLINE->mailbox, CLINE->name, sizeof(CLINE->mailbox));
07999                } else {
08000                   snprintf(CLINE->mailbox, sizeof(CLINE->mailbox), "%s@default",
08001                      CLINE->name);
08002                }
08003             }
08004             continue;
08005          }
08006       } else if (!strcasecmp(v->name, "threewaycalling")) {
08007          if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
08008             CLINE_OPTS->threewaycalling = ast_true(v->value);
08009             continue;
08010          }
08011       } else if (!strcasecmp(v->name, "setvar")) {
08012          if (type & (TYPE_LINE)) {
08013             CLINE->chanvars = add_var(v->value, CLINE->chanvars);
08014             continue;
08015          }
08016       } else if (!strcasecmp(v->name, "earlyrtp")) {
08017          if (type & (TYPE_DEF_DEVICE | TYPE_DEVICE)) {
08018             CDEV_OPTS->earlyrtp = ast_true(v->value);
08019             continue;
08020          }
08021       } else if (!strcasecmp(v->name, "host")) {
08022          if (type & (TYPE_DEVICE)) {
08023             struct ast_sockaddr CDEV_addr_tmp;
08024 
08025             CDEV_addr_tmp.ss.ss_family = AF_INET;
08026             if (ast_get_ip(&CDEV_addr_tmp, v->value)) {
08027                ast_log(LOG_WARNING, "Bad IP '%s' at line %d.\n", v->value, v->lineno);
08028             }
08029             ast_sockaddr_to_sin(&CDEV_addr_tmp,
08030                       &CDEV->addr);
08031             continue;
08032          }
08033       } else if (!strcasecmp(v->name, "port")) {
08034          if (type & (TYPE_DEF_DEVICE)) {
08035             CDEV->addr.sin_port = htons(atoi(v->value));
08036             continue;
08037          }
08038       } else if (!strcasecmp(v->name, "device")) {
08039          if (type & (TYPE_DEVICE)) {
08040             ast_copy_string(CDEV_OPTS->id, v->value, sizeof(CDEV_OPTS->id));
08041             continue;
08042          }
08043       } else if (!strcasecmp(v->name, "permit") || !strcasecmp(v->name, "deny")) {
08044          if (type & (TYPE_DEVICE)) {
08045             CDEV->ha = ast_append_ha(v->name, v->value, CDEV->ha, NULL);
08046             continue;
08047          }
08048       } else if (!strcasecmp(v->name, "allow")) {
08049          if (type & (TYPE_DEF_DEVICE | TYPE_DEVICE)) {
08050             ast_format_cap_update_by_allow_disallow(CDEV->confcap, v->value, 1);
08051             continue;
08052          }
08053          if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
08054             ast_format_cap_update_by_allow_disallow(CLINE->confcap, v->value, 1);
08055             continue;
08056          }
08057       } else if (!strcasecmp(v->name, "disallow")) {
08058          if (type & (TYPE_DEF_DEVICE | TYPE_DEVICE)) {
08059             ast_format_cap_update_by_allow_disallow(CDEV->confcap, v->value, 0);
08060             continue;
08061          }
08062          if (type & (TYPE_DEF_LINE | TYPE_LINE)) {
08063             ast_format_cap_update_by_allow_disallow(CLINE->confcap, v->value, 0);
08064             continue;
08065          }
08066       } else if (!strcasecmp(v->name, "version")) {
08067          if (type & (TYPE_DEF_DEVICE | TYPE_DEVICE)) {
08068             ast_copy_string(CDEV_OPTS->version_id, v->value, sizeof(CDEV_OPTS->version_id));
08069             continue;
08070          }
08071       } else if (!strcasecmp(v->name, "line")) {
08072          if (type & (TYPE_DEVICE)) {
08073             struct skinny_line *l;
08074             AST_LIST_TRAVERSE(&lines, l, all) {
08075                if (!strcasecmp(v->value, l->name) && !l->prune) {
08076 
08077                   /* FIXME: temp solution about line conflicts */
08078                   struct skinny_device *d;
08079                   struct skinny_line *l2;
08080                   int lineinuse = 0;
08081                   AST_LIST_TRAVERSE(&devices, d, list) {
08082                      AST_LIST_TRAVERSE(&d->lines, l2, list) {
08083                         if (l2 == l && strcasecmp(d->id, CDEV->id)) {
08084                            ast_log(LOG_WARNING, "Line %s already used by %s. Not connecting to %s.\n", l->name, d->name, CDEV->name);
08085                            lineinuse++;
08086                         }
08087                      }
08088                   }
08089                   if (!lineinuse) {
08090                      if (!AST_LIST_FIRST(&CDEV->lines)) {
08091                         CDEV->activeline = l;
08092                      }
08093                      lineInstance++;
08094                      AST_LIST_INSERT_HEAD(&CDEV->lines, l, list);
08095                      l->device = CDEV;
08096                   }
08097                   break;
08098                }
08099             }
08100             continue;
08101          }
08102       } else if (!strcasecmp(v->name, "subline")) {
08103          if (type & (TYPE_LINE)) {
08104             struct skinny_subline *subline;
08105             struct skinny_container *container;
08106             char buf[256];
08107             char *stringp = buf, *exten, *stname, *context;
08108 
08109             if (!(subline = ast_calloc(1, sizeof(*subline)))) {
08110                ast_log(LOG_WARNING, "Unable to allocate memory for subline %s. Ignoring subline.\n", v->value);
08111                continue;
08112             }
08113             if (!(container = ast_calloc(1, sizeof(*container)))) {
08114                ast_log(LOG_WARNING, "Unable to allocate memory for subline %s container. Ignoring subline.\n", v->value);
08115                ast_free(subline);
08116                continue;
08117             }
08118 
08119             ast_copy_string(buf, v->value, sizeof(buf));
08120             exten = strsep(&stringp, "@");
08121             ast_copy_string(subline->exten, ast_strip(exten), sizeof(subline->exten));
08122             stname = strsep(&exten, "_");
08123             ast_copy_string(subline->stname, ast_strip(stname), sizeof(subline->stname));
08124             ast_copy_string(subline->lnname, ast_strip(exten), sizeof(subline->lnname));
08125             context = strsep(&stringp, ",");
08126             ast_copy_string(subline->name, ast_strip(stringp), sizeof(subline->name));
08127             ast_copy_string(subline->context, ast_strip(context), sizeof(subline->context));
08128 
08129             subline->line = CLINE;
08130             subline->sub = NULL;
08131 
08132             container->type = SKINNY_SUBLINECONTAINER;
08133             container->data = subline;
08134             subline->container = container;
08135             AST_LIST_INSERT_HEAD(&CLINE->sublines, subline, list);
08136             continue;
08137          }
08138       } else if (!strcasecmp(v->name, "dialoutcontext")) {
08139          if (type & (TYPE_LINE)) {
08140             ast_copy_string(CLINE_OPTS->dialoutcontext, v->value, sizeof(CLINE_OPTS->dialoutcontext));
08141             continue;
08142          }
08143       } else if (!strcasecmp(v->name, "dialoutexten")) {
08144          if (type & (TYPE_LINE)) {
08145             ast_copy_string(CLINE_OPTS->dialoutexten, v->value, sizeof(CLINE_OPTS->dialoutexten));
08146             continue;
08147          }
08148       } else if (!strcasecmp(v->name, "speeddial")) {
08149          if (type & (TYPE_DEVICE)) {
08150             struct skinny_speeddial *sd;
08151             struct skinny_container *container;
08152             char buf[256];
08153             char *stringp = buf, *exten, *context, *label;
08154 
08155             if (!(sd = ast_calloc(1, sizeof(*sd)))) {
08156                ast_log(LOG_WARNING, "Unable to allocate memory for speeddial %s. Ignoring speeddial.\n", v->name);
08157                continue;
08158             }
08159             if (!(container = ast_calloc(1, sizeof(*container)))) {
08160                ast_log(LOG_WARNING, "Unable to allocate memory for speeddial %s container. Ignoring speeddial.\n", v->name);
08161                ast_free(sd);
08162                continue;
08163             }
08164 
08165             ast_copy_string(buf, v->value, sizeof(buf));
08166             exten = strsep(&stringp, ",");
08167             if ((context = strchr(exten, '@'))) {
08168                *context++ = '\0';
08169             }
08170             label = stringp;
08171             ast_mutex_init(&sd->lock);
08172             ast_copy_string(sd->exten, exten, sizeof(sd->exten));
08173             if (!ast_strlen_zero(context)) {
08174                sd->isHint = 1;
08175                sd->instance = lineInstance++;
08176                ast_copy_string(sd->context, context, sizeof(sd->context));
08177             } else {
08178                sd->isHint = 0;
08179                sd->instance = speeddialInstance++;
08180                sd->context[0] = '\0';
08181             }
08182             ast_copy_string(sd->label, S_OR(label, exten), sizeof(sd->label));
08183             sd->parent = CDEV;
08184             container->type = SKINNY_SDCONTAINER;
08185             container->data = sd;
08186             sd->container = container;
08187             AST_LIST_INSERT_HEAD(&CDEV->speeddials, sd, list);
08188             continue;
08189          }
08190       } else if (!strcasecmp(v->name, "serviceurl")) {
08191          if (type & (TYPE_DEVICE)) {
08192             struct skinny_serviceurl *surl;
08193             char buf[256];
08194             char *stringp = buf, *serviceUrl, *displayName;
08195             if (!(surl = ast_calloc(1, sizeof(*surl)))) {
08196                ast_log(LOG_WARNING, "Unable to allocate memory for serviceurl %s. Ignoring service URL.\n", v->name);
08197                continue;
08198             }
08199             ast_copy_string(buf, v->value, sizeof(buf));
08200             displayName = strsep(&stringp, ",");
08201             if (stringp) {
08202                serviceUrl = stringp;
08203                ast_copy_string(surl->url, ast_strip(serviceUrl), sizeof(surl->url));
08204                ast_copy_string(surl->displayName, displayName, sizeof(surl->displayName));
08205                surl->instance = serviceUrlInstance++;
08206                surl->device = CDEV;
08207                AST_LIST_INSERT_HEAD(&CDEV->serviceurls, surl, list);
08208             } else {
08209                ast_free(surl);
08210                ast_log(LOG_WARNING, "Badly formed option for service URL in %s. Ignoring service URL.\n", v->name);
08211             }
08212             continue;
08213          }
08214       } else if (!strcasecmp(v->name, "addon")) {
08215          if (type & (TYPE_DEVICE)) {
08216             struct skinny_addon *a;
08217             if (!(a = ast_calloc(1, sizeof(*a)))) {
08218                ast_log(LOG_WARNING, "Unable to allocate memory for addon %s. Ignoring addon.\n", v->name);
08219                continue;
08220             } else {
08221                ast_mutex_init(&a->lock);
08222                ast_copy_string(a->type, v->value, sizeof(a->type));
08223                AST_LIST_INSERT_HEAD(&CDEV->addons, a, list);
08224             }
08225             continue;
08226          }
08227 
08228       } else {
08229          ast_log(LOG_WARNING, "Don't know keyword '%s' at line %d\n", v->name, v->lineno);
08230          continue;
08231       }
08232       ast_log(LOG_WARNING, "Invalid category used: %s at line %d\n", v->name, v->lineno);
08233    }
08234 }

static char* control2str ( int  ind  )  [static]

Definition at line 5158 of file chan_skinny.c.

References AST_CONTROL_ANSWER, AST_CONTROL_BUSY, AST_CONTROL_CC, AST_CONTROL_CONGESTION, AST_CONTROL_CONNECTED_LINE, AST_CONTROL_FLASH, AST_CONTROL_HANGUP, AST_CONTROL_HOLD, AST_CONTROL_INCOMPLETE, AST_CONTROL_OFFHOOK, AST_CONTROL_OPTION, AST_CONTROL_PROCEEDING, AST_CONTROL_PROGRESS, AST_CONTROL_RADIO_KEY, AST_CONTROL_RADIO_UNKEY, AST_CONTROL_REDIRECTING, AST_CONTROL_RING, AST_CONTROL_RINGING, AST_CONTROL_SRCCHANGE, AST_CONTROL_SRCUPDATE, AST_CONTROL_T38_PARAMETERS, AST_CONTROL_TAKEOFFHOOK, AST_CONTROL_TRANSFER, AST_CONTROL_UNHOLD, AST_CONTROL_VIDUPDATE, AST_CONTROL_WINK, ast_threadstorage_get(), CONTROL2STR_BUFSIZE, and control2str_threadbuf.

05158                                   {
05159    char *tmp;
05160 
05161    switch (ind) {
05162    case AST_CONTROL_HANGUP:
05163       return "Other end has hungup";
05164    case AST_CONTROL_RING:
05165       return "Local ring";
05166    case AST_CONTROL_RINGING:
05167       return "Remote end is ringing";
05168    case AST_CONTROL_ANSWER:
05169       return "Remote end has answered";
05170    case AST_CONTROL_BUSY:
05171       return "Remote end is busy";
05172    case AST_CONTROL_TAKEOFFHOOK:
05173       return "Make it go off hook";
05174    case AST_CONTROL_OFFHOOK:
05175       return "Line is off hook";
05176    case AST_CONTROL_CONGESTION:
05177       return "Congestion (circuits busy)";
05178    case AST_CONTROL_FLASH:
05179       return "Flash hook";
05180    case AST_CONTROL_WINK:
05181       return "Wink";
05182    case AST_CONTROL_OPTION:
05183       return "Set a low-level option";
05184    case AST_CONTROL_RADIO_KEY:
05185       return "Key Radio";
05186    case AST_CONTROL_RADIO_UNKEY:
05187       return "Un-Key Radio";
05188    case AST_CONTROL_PROGRESS:
05189       return "Remote end is making Progress";
05190    case AST_CONTROL_PROCEEDING:
05191       return "Remote end is proceeding";
05192    case AST_CONTROL_HOLD:
05193       return "Hold";
05194    case AST_CONTROL_UNHOLD:
05195       return "Unhold";
05196    case AST_CONTROL_VIDUPDATE:
05197       return "VidUpdate";
05198    case AST_CONTROL_SRCUPDATE:
05199       return "Media Source Update";
05200    case AST_CONTROL_TRANSFER:
05201       return "Transfer";
05202    case AST_CONTROL_CONNECTED_LINE:
05203       return "Connected Line";
05204    case AST_CONTROL_REDIRECTING:
05205       return "Redirecting";
05206    case AST_CONTROL_T38_PARAMETERS:
05207       return "T38_Parameters";
05208    case AST_CONTROL_CC:
05209       return "CC Not Possible";
05210    case AST_CONTROL_SRCCHANGE:
05211       return "Media Source Change";
05212    case AST_CONTROL_INCOMPLETE:
05213       return "Incomplete";
05214    case -1:
05215       return "Stop tone";
05216    default:
05217       if (!(tmp = ast_threadstorage_get(&control2str_threadbuf, CONTROL2STR_BUFSIZE)))
05218                         return "Unknown";
05219       snprintf(tmp, CONTROL2STR_BUFSIZE, "UNKNOWN-%d", ind);
05220       return tmp;
05221    }
05222 }

static void delete_devices ( void   )  [static]

Definition at line 8513 of file chan_skinny.c.

References skinny_device::addons, ast_free, AST_LIST_LOCK, AST_LIST_REMOVE, AST_LIST_REMOVE_HEAD, AST_LIST_UNLOCK, skinny_speeddial::container, d, skinny_device::lines, skinny_device::serviceurls, skinny_device_destroy(), skinny_line_destroy(), and skinny_device::speeddials.

Referenced by unload_module().

08514 {
08515    struct skinny_device *d;
08516    struct skinny_line *l;
08517    struct skinny_speeddial *sd;
08518    struct skinny_addon *a;
08519    struct skinny_serviceurl *surl;
08520 
08521    AST_LIST_LOCK(&devices);
08522    AST_LIST_LOCK(&lines);
08523 
08524    /* Delete all devices */
08525    while ((d = AST_LIST_REMOVE_HEAD(&devices, list))) {
08526       /* Delete all lines for this device */
08527       while ((l = AST_LIST_REMOVE_HEAD(&d->lines, list))) {
08528          AST_LIST_REMOVE(&lines, l, all);
08529          AST_LIST_REMOVE(&d->lines, l, list);
08530          l = skinny_line_destroy(l);
08531       }
08532       /* Delete all speeddials for this device */
08533       while ((sd = AST_LIST_REMOVE_HEAD(&d->speeddials, list))) {
08534          ast_free(sd->container);
08535          ast_free(sd);
08536       }
08537       /* Delete all serviceurls for this device */
08538       while ((surl = AST_LIST_REMOVE_HEAD(&d->serviceurls, list))) {
08539          ast_free(surl);
08540       }
08541       /* Delete all addons for this device */
08542       while ((a = AST_LIST_REMOVE_HEAD(&d->addons, list))) {
08543          ast_free(a);
08544       }
08545       d = skinny_device_destroy(d);
08546    }
08547    AST_LIST_UNLOCK(&lines);
08548    AST_LIST_UNLOCK(&devices);
08549 }

static void destroy_rtp ( struct skinny_subchannel sub  )  [static]

Definition at line 4782 of file chan_skinny.c.

References ast_rtp_instance_destroy(), ast_rtp_instance_stop(), skinny_subchannel::callid, NULL, skinny_subchannel::rtp, SKINNY_DEBUG, and skinny_subchannel::vrtp.

Referenced by skinny_hangup().

04783 {
04784    if (sub->rtp) {
04785       SKINNY_DEBUG(DEBUG_AUDIO, 3, "Sub %u - Destroying RTP\n", sub->callid);
04786       ast_rtp_instance_stop(sub->rtp);
04787       ast_rtp_instance_destroy(sub->rtp);
04788       sub->rtp = NULL;
04789    }
04790    if (sub->vrtp) {
04791       SKINNY_DEBUG(DEBUG_AUDIO, 3, "Sub %u - Destroying VRTP\n", sub->callid);
04792       ast_rtp_instance_stop(sub->vrtp);
04793       ast_rtp_instance_destroy(sub->vrtp);
04794       sub->vrtp = NULL;
04795    }
04796 }

static void destroy_session ( struct skinnysession s  )  [static]

Definition at line 7398 of file chan_skinny.c.

References ast_atomic_fetchadd_int(), ast_free, ast_mutex_destroy, ast_mutex_lock, ast_mutex_unlock, skinnysession::device, skinnysession::fd, skinnysession::lock, NULL, and skinny_device::session.

Referenced by accept_thread(), fax_session_new(), fax_session_reserve(), and skinny_session_cleanup().

07399 {
07400    ast_mutex_lock(&s->lock);
07401    if (s->fd > -1) {
07402       close(s->fd);
07403    }
07404 
07405    if (s->device) {
07406       s->device->session = NULL;
07407    } else {
07408       ast_atomic_fetchadd_int(&unauth_sessions, -1);
07409    }
07410    ast_mutex_unlock(&s->lock);
07411    ast_mutex_destroy(&s->lock);
07412    ast_free(s);
07413 }

static char* device2str ( int  type  )  [static]

Definition at line 3980 of file chan_skinny.c.

References ast_threadstorage_get(), DEVICE2STR_BUFSIZE, device2str_threadbuf, SKINNY_DEVICE_12, SKINNY_DEVICE_12SP, SKINNY_DEVICE_12SPPLUS, SKINNY_DEVICE_30SPPLUS, SKINNY_DEVICE_30VIP, SKINNY_DEVICE_7902, SKINNY_DEVICE_7905, SKINNY_DEVICE_7906, SKINNY_DEVICE_7910, SKINNY_DEVICE_7911, SKINNY_DEVICE_7912, SKINNY_DEVICE_7914, SKINNY_DEVICE_7920, SKINNY_DEVICE_7921, SKINNY_DEVICE_7931, SKINNY_DEVICE_7935, SKINNY_DEVICE_7936, SKINNY_DEVICE_7937, SKINNY_DEVICE_7940, SKINNY_DEVICE_7941, SKINNY_DEVICE_7941GE, SKINNY_DEVICE_7942, SKINNY_DEVICE_7945, SKINNY_DEVICE_7960, SKINNY_DEVICE_7961, SKINNY_DEVICE_7961GE, SKINNY_DEVICE_7962, SKINNY_DEVICE_7965, SKINNY_DEVICE_7970, SKINNY_DEVICE_7971, SKINNY_DEVICE_7975, SKINNY_DEVICE_7985, SKINNY_DEVICE_ATA186, SKINNY_DEVICE_CIPC, SKINNY_DEVICE_NONE, SKINNY_DEVICE_SCCPGATEWAY_AN, SKINNY_DEVICE_SCCPGATEWAY_BRI, and SKINNY_DEVICE_UNKNOWN.

Referenced by _skinny_show_device(), and _skinny_show_devices().

03981 {
03982    char *tmp;
03983 
03984    switch (type) {
03985    case SKINNY_DEVICE_NONE:
03986       return "No Device";
03987    case SKINNY_DEVICE_30SPPLUS:
03988       return "30SP Plus";
03989    case SKINNY_DEVICE_12SPPLUS:
03990       return "12SP Plus";
03991    case SKINNY_DEVICE_12SP:
03992       return "12SP";
03993    case SKINNY_DEVICE_12:
03994       return "12";
03995    case SKINNY_DEVICE_30VIP:
03996       return "30VIP";
03997    case SKINNY_DEVICE_7910:
03998       return "7910";
03999    case SKINNY_DEVICE_7960:
04000       return "7960";
04001    case SKINNY_DEVICE_7940:
04002       return "7940";
04003    case SKINNY_DEVICE_7935:
04004       return "7935";
04005    case SKINNY_DEVICE_ATA186:
04006       return "ATA186";
04007    case SKINNY_DEVICE_7941:
04008       return "7941";
04009    case SKINNY_DEVICE_7971:
04010       return "7971";
04011    case SKINNY_DEVICE_7914:
04012       return "7914";
04013    case SKINNY_DEVICE_7985:
04014       return "7985";
04015    case SKINNY_DEVICE_7911:
04016       return "7911";
04017    case SKINNY_DEVICE_7961GE:
04018       return "7961GE";
04019    case SKINNY_DEVICE_7941GE:
04020       return "7941GE";
04021    case SKINNY_DEVICE_7931:
04022       return "7931";
04023    case SKINNY_DEVICE_7921:
04024       return "7921";
04025    case SKINNY_DEVICE_7906:
04026       return "7906";
04027    case SKINNY_DEVICE_7962:
04028       return "7962";
04029    case SKINNY_DEVICE_7937:
04030       return "7937";
04031    case SKINNY_DEVICE_7942:
04032       return "7942";
04033    case SKINNY_DEVICE_7945:
04034       return "7945";
04035    case SKINNY_DEVICE_7965:
04036       return "7965";
04037    case SKINNY_DEVICE_7975:
04038       return "7975";
04039    case SKINNY_DEVICE_7905:
04040       return "7905";
04041    case SKINNY_DEVICE_7920:
04042       return "7920";
04043    case SKINNY_DEVICE_7970:
04044       return "7970";
04045    case SKINNY_DEVICE_7912:
04046       return "7912";
04047    case SKINNY_DEVICE_7902:
04048       return "7902";
04049    case SKINNY_DEVICE_CIPC:
04050       return "IP Communicator";
04051    case SKINNY_DEVICE_7961:
04052       return "7961";
04053    case SKINNY_DEVICE_7936:
04054       return "7936";
04055    case SKINNY_DEVICE_SCCPGATEWAY_AN:
04056       return "SCCPGATEWAY_AN";
04057    case SKINNY_DEVICE_SCCPGATEWAY_BRI:
04058       return "SCCPGATEWAY_BRI";
04059    case SKINNY_DEVICE_UNKNOWN:
04060       return "Unknown";
04061    default:
04062       if (!(tmp = ast_threadstorage_get(&device2str_threadbuf, DEVICE2STR_BUFSIZE)))
04063          return "Unknown";
04064       snprintf(tmp, DEVICE2STR_BUFSIZE, "UNKNOWN-%d", type);
04065       return tmp;
04066    }
04067 }

static void dialandactivatesub ( struct skinny_subchannel sub,
char  exten[AST_MAX_EXTENSION] 
) [static]

Definition at line 6045 of file chan_skinny.c.

References activatesub(), ast_copy_string(), skinny_subchannel::callid, d, skinny_line::device, skinny_subchannel::dialType, DIALTYPE_CFWD, DIALTYPE_NORMAL, DIALTYPE_XFER, dumpsub(), skinny_subchannel::exten, skinny_subchannel::getforward, skinny_subchannel::line, set_callforwards(), SKINNY_DEBUG, skinny_transfer_blind(), SUBSTATE_DIALING, transmit_cfwdstate(), and transmit_displaynotify().

Referenced by handle_enbloc_call_message(), handle_soft_key_event_message(), handle_stimulus_message(), and skinny_dialer().

06046 {
06047    struct skinny_line *l = sub->line;
06048    struct skinny_device *d = l->device;
06049 
06050    if (sub->dialType == DIALTYPE_NORMAL) {
06051       SKINNY_DEBUG(DEBUG_SUB, 3, "Sub %u - Dial %s and Activate\n", sub->callid, exten);
06052       ast_copy_string(sub->exten, exten, sizeof(sub->exten));
06053       activatesub(sub, SUBSTATE_DIALING);
06054    } else if (sub->dialType == DIALTYPE_CFWD) {
06055       SKINNY_DEBUG(DEBUG_SUB, 3, "Sub %u - Set callforward(%d) to %s\n", sub->callid, sub->getforward, exten);
06056       set_callforwards(l, sub->exten, sub->getforward);
06057       dumpsub(sub, 1);
06058       transmit_cfwdstate(d, l);
06059       transmit_displaynotify(d, "CFwd enabled", 10);
06060    } else if (sub->dialType == DIALTYPE_XFER) {
06061       ast_copy_string(sub->exten, exten, sizeof(sub->exten));
06062       skinny_transfer_blind(sub);
06063    }
06064 }

static void dumpsub ( struct skinny_subchannel sub,
int  forcehangup 
) [static]

Definition at line 5971 of file chan_skinny.c.

References skinny_line::activesub, AST_LIST_TRAVERSE, ast_log, skinny_subchannel::callid, d, skinny_line::device, skinny_subchannel::line, LOG_WARNING, NULL, skinny_subchannel::related, setsubstate(), SKINNY_DEBUG, SKINNY_ONHOOK, SKINNY_SPEAKEROFF, skinny_line::sub, skinny_subchannel::substate, SUBSTATE_CALLWAIT, SUBSTATE_HOLD, SUBSTATE_ONHOOK, SUBSTATE_RINGIN, and transmit_speaker_mode().

Referenced by dialandactivatesub(), handle_callforward_button(), handle_onhook_message(), handle_soft_key_event_message(), skinny_dialer(), skinny_hangup(), and skinny_transfer_blind().

05972 {
05973    struct skinny_line *l = sub->line;
05974    struct skinny_device *d = l->device;
05975    struct skinny_subchannel *activate_sub = NULL;
05976    struct skinny_subchannel *tsub;
05977 
05978    SKINNY_DEBUG(DEBUG_SUB, 3, "Sub %u - Dumping\n", sub->callid);
05979 
05980    if (!forcehangup && sub->substate == SUBSTATE_HOLD) {
05981       l->activesub = NULL;
05982       return;
05983    }
05984 
05985    if (sub == l->activesub) {
05986       d->hookstate = SKINNY_ONHOOK;
05987       transmit_speaker_mode(d, SKINNY_SPEAKEROFF);
05988       if (sub->related) {
05989          activate_sub = sub->related;
05990          setsubstate(sub, SUBSTATE_ONHOOK);
05991          l->activesub = activate_sub;
05992          if (l->activesub->substate != SUBSTATE_HOLD) {
05993             ast_log(LOG_WARNING, "Sub-%u was related but not at SUBSTATE_HOLD\n", sub->callid);
05994             return;
05995          }
05996          setsubstate(l->activesub, SUBSTATE_HOLD);
05997       } else {
05998          setsubstate(sub, SUBSTATE_ONHOOK);
05999          AST_LIST_TRAVERSE(&l->sub, tsub, list) {
06000             if (tsub->substate == SUBSTATE_CALLWAIT) {
06001                activate_sub = tsub;
06002             }
06003          }
06004          if (activate_sub) {
06005             setsubstate(activate_sub, SUBSTATE_RINGIN);
06006             return;
06007          }
06008          AST_LIST_TRAVERSE(&l->sub, tsub, list) {
06009             if (tsub->substate == SUBSTATE_HOLD) {
06010                activate_sub = tsub;
06011             }
06012          }
06013          if (activate_sub) {
06014             setsubstate(activate_sub, SUBSTATE_HOLD);
06015             return;
06016          }
06017       }
06018    } else {
06019       setsubstate(sub, SUBSTATE_ONHOOK);
06020    }
06021 }

static void end_session ( struct skinnysession s  )  [static]

Definition at line 2333 of file chan_skinny.c.

References skinnysession::t.

Referenced by handle_message(), skinny_noauth_cb(), skinny_nokeepalive_cb(), and transmit_response_bysession().

02334 {
02335    pthread_cancel(s->t);
02336 }

static struct skinny_line* find_line_by_instance ( struct skinny_device d,
int  instance 
) [static, read]

Definition at line 1878 of file chan_skinny.c.

References AST_LIST_TRAVERSE, ast_log, skinny_device::lines, and LOG_WARNING.

Referenced by find_subchannel_by_instance_reference(), handle_enbloc_call_message(), handle_offhook_message(), handle_soft_key_event_message(), handle_stimulus_message(), and transmit_linestatres().

01879 {
01880    struct skinny_line *l;
01881 
01882    /*Dialing from on hook or on a 7920 uses instance 0 in requests
01883      but we need to start looking at instance 1 */
01884 
01885    if (!instance)
01886       instance = 1;
01887 
01888    AST_LIST_TRAVERSE(&d->lines, l, list){
01889       if (l->instance == instance)
01890          break;
01891    }
01892 
01893    if (!l) {
01894       ast_log(LOG_WARNING, "Could not find line with instance '%d' on device '%s'\n", instance, d->name);
01895    }
01896    return l;
01897 }

static struct skinny_line* find_line_by_name ( const char *  dest  )  [static, read]

Definition at line 1899 of file chan_skinny.c.

References ast_copy_string(), AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_log, ast_strlen_zero, d, skinny_device::lines, LOG_WARNING, and NULL.

Referenced by skinny_devicestate(), and skinny_request().

01900 {
01901    struct skinny_line *l;
01902    struct skinny_line *tmpl = NULL;
01903    struct skinny_device *d;
01904    char line[256];
01905    char *at;
01906    char *device;
01907    int checkdevice = 0;
01908 
01909    ast_copy_string(line, dest, sizeof(line));
01910    at = strchr(line, '@');
01911    if (at)
01912       *at++ = '\0';
01913    device = at;
01914 
01915    if (!ast_strlen_zero(device))
01916       checkdevice = 1;
01917 
01918    AST_LIST_LOCK(&devices);
01919    AST_LIST_TRAVERSE(&devices, d, list){
01920       if (checkdevice && tmpl)
01921          break;
01922       else if (!checkdevice) {
01923          /* This is a match, since we're checking for line on every device. */
01924       } else if (!strcasecmp(d->name, device)) {
01925       } else
01926          continue;
01927 
01928       /* Found the device (or we don't care which device) */
01929       AST_LIST_TRAVERSE(&d->lines, l, list){
01930          /* Search for the right line */
01931          if (!strcasecmp(l->name, line)) {
01932             if (tmpl) {
01933                ast_log(LOG_WARNING, "Ambiguous line name: %s\n", line);
01934                AST_LIST_UNLOCK(&devices);
01935                return NULL;
01936             } else
01937                tmpl = l;
01938          }
01939       }
01940    }
01941    AST_LIST_UNLOCK(&devices);
01942    return tmpl;
01943 }

static struct skinny_speeddial* find_speeddial_by_instance ( struct skinny_device d,
int  instance,
int  isHint 
) [static, read]

Definition at line 2086 of file chan_skinny.c.

References AST_LIST_TRAVERSE, ast_log, skinny_speeddial::instance, skinny_speeddial::isHint, LOG_WARNING, and skinny_device::speeddials.

Referenced by handle_message(), handle_stimulus_message(), and transmit_linestatres().

02087 {
02088    struct skinny_speeddial *sd;
02089 
02090    AST_LIST_TRAVERSE(&d->speeddials, sd, list) {
02091       if (sd->isHint == isHint && sd->instance == instance)
02092          break;
02093    }
02094 
02095    if (!sd) {
02096       ast_log(LOG_WARNING, "Could not find speeddial with instance '%d' on device '%s'\n", instance, d->name);
02097    }
02098    return sd;
02099 }

static struct skinny_subchannel* find_subchannel_by_instance_reference ( struct skinny_device d,
int  instance,
int  reference 
) [static, read]

Definition at line 2035 of file chan_skinny.c.

References AST_LIST_FIRST, AST_LIST_TRAVERSE, ast_log, skinny_subchannel::callid, find_line_by_instance(), LOG_WARNING, NULL, skinny_line::sub, and sub.

Referenced by handle_enbloc_call_message(), handle_keypad_button_message(), handle_offhook_message(), handle_onhook_message(), handle_soft_key_event_message(), and handle_stimulus_message().

02036 {
02037    struct skinny_line *l = find_line_by_instance(d, instance);
02038    struct skinny_subchannel *sub;
02039 
02040    if (!l) {
02041       return NULL;
02042    }
02043 
02044    /* 7920 phones set call reference to 0, so use the first
02045       sub-channel on the list.
02046            This MIGHT need more love to be right */
02047    if (!reference)
02048       sub = AST_LIST_FIRST(&l->sub);
02049    else {
02050       AST_LIST_TRAVERSE(&l->sub, sub, list) {
02051          if (sub->callid == reference)
02052             break;
02053       }
02054    }
02055    if (!sub) {
02056       ast_log(LOG_WARNING, "Could not find subchannel with reference '%d' on '%s'\n", reference, d->name);
02057    }
02058    return sub;
02059 }

static struct skinny_subchannel* find_subchannel_by_reference ( struct skinny_device d,
int  reference 
) [static, read]

Definition at line 2062 of file chan_skinny.c.

References AST_LIST_TRAVERSE, ast_log, skinny_subchannel::callid, skinny_device::lines, LOG_WARNING, NULL, skinny_line::sub, and sub.

Referenced by handle_open_receive_channel_ack_message().

02063 {
02064    struct skinny_line *l;
02065    struct skinny_subchannel *sub = NULL;
02066 
02067    AST_LIST_TRAVERSE(&d->lines, l, list){
02068       AST_LIST_TRAVERSE(&l->sub, sub, list){
02069          if (sub->callid == reference)
02070             break;
02071       }
02072       if (sub)
02073          break;
02074    }
02075 
02076    if (!l) {
02077       ast_log(LOG_WARNING, "Could not find any lines that contained a subchannel with reference '%d' on device '%s'\n", reference, d->name);
02078    } else {
02079       if (!sub) {
02080          ast_log(LOG_WARNING, "Could not find subchannel with reference '%d' on '%s@%s'\n", reference, l->name, d->name);
02081       }
02082    }
02083    return sub;
02084 }

static struct skinny_subline* find_subline_by_callid ( struct skinny_device d,
int  callid 
) [static, read]

Definition at line 1971 of file chan_skinny.c.

References AST_LIST_TRAVERSE, skinny_subline::callid, skinny_device::lines, NULL, and skinny_line::sublines.

Referenced by handle_soft_key_event_message().

01972 {
01973    struct skinny_subline *subline;
01974    struct skinny_line *l;
01975 
01976