Codename Pineapple

Home page | Mailing list | Docs

Last updated: Sat Feb 3 05:01:21 2007

Asterisk developer's documentation :: Codename Pineapple


chan_skinny.c File Reference


Detailed Description

Implementation of the Skinny protocol.

Author:
Jeremy McNamara & Florian Overkamp & North Antara

Definition in file chan_skinny.c.

#include "asterisk.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <errno.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/logger.h"
#include "asterisk/module.h"
#include "asterisk/pbx.h"
#include "asterisk/options.h"
#include "asterisk/sched.h"
#include "asterisk/io.h"
#include "asterisk/rtp.h"
#include "asterisk/acl.h"
#include "asterisk/callerid.h"
#include "asterisk/cli.h"
#include "asterisk/say.h"
#include "asterisk/cdr.h"
#include "asterisk/astdb.h"
#include "asterisk/features.h"
#include "asterisk/app.h"
#include "asterisk/musiconhold.h"
#include "asterisk/utils.h"
#include "asterisk/dsp.h"
#include "asterisk/stringfields.h"
#include "asterisk/astobj.h"
#include "asterisk/abstract_jb.h"
#include "asterisk/threadstorage.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  button_definition
struct  button_definition_template
struct  button_template_res_message
struct  call_info_message
struct  call_state_message
struct  capabilities_res_message
struct  close_receive_channel_message
struct  definetimedate_message
struct  dialed_number_message
struct  display_notify_message
struct  display_prompt_status_message
struct  displaytext_message
struct  keypad_button_message
struct  line_stat_res_message
struct  line_state_req_message
struct  media_qualifier
struct  offhook_message
struct  onhook_message
struct  open_receive_channel_ack_message
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  set_lamp_message
struct  set_microphone_message
struct  set_ringer_message
struct  set_speaker_message
struct  skinny_addon
union  skinny_data
struct  skinny_device
struct  skinny_line
struct  skinny_paging_device
struct  skinny_req
struct  skinny_speeddial
struct  skinny_subchannel
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
struct  start_tone_message
struct  station_capabilities
struct  stimulus_message
struct  stop_media_transmission_message
struct  version_res_message

Defines

#define ACTIVATE_CALL_PLANE_MESSAGE   0x0116
#define ALARM_MESSAGE   0x0020
#define BT_AUTOANSWER   STIMULUS_AUTOANSWER
#define BT_CALLPARK   STIMULUS_CALLPARK
#define BT_CALLPICKUP   STIMULUS_CALLPICKUP
#define BT_CONFERENCE   STIMULUS_CONFERENCE
#define BT_CUST_HINT   0xB1
#define BT_CUST_LINESPEEDDIAL   0xB0
#define BT_DISPLAY   STIMULUS_DISPLAY
#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_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_STATE_MESSAGE   0x0111
#define CAPABILITIES_REQ_MESSAGE   0x009B
#define CAPABILITIES_RES_MESSAGE   0x0010
#define CLEAR_DISPLAY_MESSAGE   0x009A
#define CLEAR_NOTIFY_MESSAGE   0x0115
#define CLEAR_PROMPT_MESSAGE   0x0113
#define CLOSE_RECEIVE_CHANNEL_MESSAGE   0x0106
#define CONTROL2STR_BUFSIZE   100
#define DEFAULT_SKINNY_BACKLOG   2
#define DEFAULT_SKINNY_PORT   2000
#define DEFINETIMEDATE_MESSAGE   0x0094
#define DEVICE2STR_BUFSIZE   15
#define DIALED_NUMBER_MESSAGE   0x011D
#define DISPLAY_NOTIFY_MESSAGE   0x0114
#define DISPLAY_PROMPT_STATUS_MESSAGE   0x0112
#define DISPLAYTEXT_MESSAGE   0x0099
#define HEADSET_STATUS_MESSAGE   0x002B
#define htolel(x)   (x)
#define htoles(x)   (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_UNKNOWN   10
#define KEYPAD_BUTTON_MESSAGE   0x0003
#define letohl(x)   (x)
#define letohs(x)   (x)
#define LINE_STAT_RES_MESSAGE   0x0092
#define LINE_STATE_REQ_MESSAGE   0x000B
#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 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_BUSY   6
#define SKINNY_BUSYTONE   0x23
#define SKINNY_CALLWAIT   9
#define SKINNY_CALLWAITTONE   0x2D
#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_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_7910   6
#define SKINNY_DEVICE_7911   307
#define SKINNY_DEVICE_7912   30007
#define SKINNY_DEVICE_7920   30002
#define SKINNY_DEVICE_7935   9
#define SKINNY_DEVICE_7936   30019
#define SKINNY_DEVICE_7940   8
#define SKINNY_DEVICE_7941   115
#define SKINNY_DEVICE_7941GE   309
#define SKINNY_DEVICE_7960   7
#define SKINNY_DEVICE_7961   30018
#define SKINNY_DEVICE_7961GE   308
#define SKINNY_DEVICE_7970   30006
#define SKINNY_DEVICE_7971   119
#define SKINNY_DEVICE_7985   302
#define SKINNY_DEVICE_ATA186   12
#define SKINNY_DEVICE_CIPC   30016
#define SKINNY_DEVICE_NONE   0
#define SKINNY_DEVICE_SCCPGATEWAY_AN   30027
#define SKINNY_DEVICE_SCCPGATEWAY_BRI   30028
#define SKINNY_DEVICE_UNKNOWN   -1
#define SKINNY_DIALTONE   0x21
#define SKINNY_HOLD   8
#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_MAX_PACKET   1000
#define SKINNY_MICOFF   2
#define SKINNY_MICON   1
#define SKINNY_NOTONE   0x7F
#define SKINNY_OFFHOOK   1
#define SKINNY_ONHOOK   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_SILENCE   0x00
#define SKINNY_SPEAKEROFF   2
#define SKINNY_SPEAKERON   1
#define SKINNY_TRANSFER   10
#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_ENDCALL   0x09
#define SOFTKEY_GPICKUP   0x12
#define SOFTKEY_HOLD   0x03
#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_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_SPEEDDIAL   0x02
#define STIMULUS_TRANSFER   0x04
#define STIMULUS_VOICEMAIL   0x0F
#define STOP_MEDIA_TRANSMISSION_MESSAGE   0x008B
#define STOP_TONE_MESSAGE   0x0083
#define TIME_DATE_REQ_MESSAGE   0x000D
#define TYPE_LINE   2
#define TYPE_TRUNK   1
#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_G723_1 = 9, SKINNY_CODEC_G729A = 12,
  SKINNY_CODEC_G726_32 = 82, SKINNY_CODEC_H261 = 100, SKINNY_CODEC_H263 = 101
}

Functions

static void * accept_thread (void *ignore)
 AST_MODULE_INFO (ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT,"Skinny Client Control Protocol (Skinny)",.load=load_module,.unload=unload_module,)
 AST_MUTEX_DEFINE_STATIC (devicelock)
 AST_MUTEX_DEFINE_STATIC (sessionlock)
 AST_MUTEX_DEFINE_STATIC (netlock)
 AST_MUTEX_DEFINE_STATIC (monlock)
 AST_THREADSTORAGE (control2str_threadbuf)
 AST_THREADSTORAGE (device2str_threadbuf)
static struct skinny_devicebuild_device (const char *cat, struct ast_variable *v)
static int codec_ast2skinny (int astcodec)
static int codec_skinny2ast (enum skinny_codecs skinnycodec)
static char * complete_skinny_reset (const char *line, const char *word, int pos, int state)
static char * control2str (int ind)
static void delete_devices (void)
static void destroy_session (struct skinnysession *s)
static char * device2str (int type)
static void do_housekeeping (struct skinnysession *s)
static void * do_monitor (void *data)
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)
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 void * get_button_template (struct skinnysession *s, struct button_definition_template *btn)
static int get_input (struct skinnysession *s)
static int handle_alarm_message (struct skinny_req *req, struct skinnysession *s)
static int handle_button_template_req_message (struct skinny_req *req, struct skinnysession *s)
static int handle_capabilities_res_message (struct skinny_req *req, struct skinnysession *s)
static int handle_headset_status_message (struct skinny_req *req, struct skinnysession *s)
static int handle_ip_port_message (struct skinny_req *req, struct skinnysession *s)
static int handle_keep_alive_message (struct skinny_req *req, struct skinnysession *s)
static int handle_keypad_button_message (struct skinny_req *req, struct skinnysession *s)
static int handle_line_state_req_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 int handle_register_available_lines_message (struct skinny_req *req, struct skinnysession *s)
static int handle_register_message (struct skinny_req *req, struct skinnysession *s)
static int handle_server_request_message (struct skinny_req *req, struct skinnysession *s)
static int handle_soft_key_event_message (struct skinny_req *req, struct skinnysession *s)
static int handle_soft_key_set_req_message (struct skinny_req *req, struct skinnysession *s)
static int handle_soft_key_template_req_message (struct skinny_req *req, struct skinnysession *s)
static int handle_speed_dial_stat_req_message (struct skinny_req *req, struct skinnysession *s)
static int handle_stimulus_message (struct skinny_req *req, struct skinnysession *s)
static int handle_time_date_req_message (struct skinny_req *req, struct skinnysession *s)
static int handle_unregister_message (struct skinny_req *req, struct skinnysession *s)
static int handle_version_req_message (struct skinny_req *req, struct skinnysession *s)
static int load_module (void)
static int reload_config (void)
static struct skinny_reqreq_alloc (size_t size, int response_message)
static int restart_monitor (void)
static int skinny_answer (struct ast_channel *ast)
static int skinny_call (struct ast_channel *ast, char *dest, int timeout)
static int skinny_do_debug (int fd, int argc, char *argv[])
static int skinny_fixup (struct ast_channel *oldchan, struct ast_channel *newchan)
static enum ast_rtp_get_result skinny_get_rtp_peer (struct ast_channel *c, struct ast_rtp **rtp)
static enum ast_rtp_get_result skinny_get_vrtp_peer (struct ast_channel *c, struct ast_rtp **rtp)
static int skinny_hangup (struct ast_channel *ast)
static int skinny_hold (struct skinny_subchannel *sub)
static int skinny_indicate (struct ast_channel *ast, int ind, const void *data, size_t datalen)
static struct ast_channelskinny_new (struct skinny_line *l, int state)
static void * skinny_newcall (void *data)
static int skinny_no_debug (int fd, int argc, char *argv[])
static struct ast_frameskinny_read (struct ast_channel *ast)
static int skinny_register (struct skinny_req *req, struct skinnysession *s)
static struct skinny_reqskinny_req_parse (struct skinnysession *s)
static struct ast_channelskinny_request (const char *type, int format, void *data, int *cause)
static int skinny_reset_device (int fd, int argc, char *argv[])
static struct ast_frameskinny_rtp_read (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 int skinny_set_rtp_peer (struct ast_channel *c, struct ast_rtp *rtp, struct ast_rtp *vrtp, int codecs, int nat_active)
static int skinny_show_devices (int fd, int argc, char *argv[])
static int skinny_show_lines (int fd, int argc, char *argv[])
static void * skinny_ss (void *data)
static int skinny_unhold (struct skinny_subchannel *sub)
static int skinny_unregister (struct skinny_req *req, struct skinnysession *s)
static int skinny_write (struct ast_channel *ast, struct ast_frame *frame)
static void start_rtp (struct skinny_subchannel *sub)
static void transmit_callinfo (struct skinnysession *s, const char *fromname, const char *fromnum, const char *toname, const char *tonum, int instance, int callid, int calltype)
static void transmit_callstate (struct skinnysession *s, int instance, int state, unsigned callid)
static void transmit_connect (struct skinnysession *s, struct skinny_subchannel *sub)
static void transmit_dialednumber (struct skinnysession *s, const char *text, int instance, int callid)
static void transmit_displaymessage (struct skinnysession *s, const char *text)
static void transmit_displaynotify (struct skinnysession *s, const char *text, int t)
static void transmit_displaypromptstatus (struct skinnysession *s, const char *text, int t, int instance, int callid)
static void transmit_lamp_indication (struct skinnysession *s, int stimulus, int instance, int indication)
static int transmit_response (struct skinnysession *s, struct skinny_req *req)
static void transmit_ringer_mode (struct skinnysession *s, int mode)
static void transmit_selectsoftkeys (struct skinnysession *s, int instance, int callid, int softkey)
static void transmit_speaker_mode (struct skinnysession *s, int mode)
static void transmit_tone (struct skinnysession *s, int tone)
static int unload_module (void)

Variables

static struct in_addr __ourip
static pthread_t accept_t
static char accountcode [AST_MAX_ACCOUNT_CODE] = ""
ast_hostent ahp
static int amaflags = 0
static struct sockaddr_in bindaddr
static int callnums = 1
static int callreturn = 0
static int callwaiting = 0
static int cancallforward = 0
static char cid_name [AST_MAX_EXTENSION] = ""
static char cid_num [AST_MAX_EXTENSION] = ""
static struct ast_cli_entry cli_skinny []
static const char config [] = "skinny.conf"
static char context [AST_MAX_CONTEXT] = "default"
static ast_group_t cur_callergroup = 0
static ast_group_t cur_pickupgroup = 0
static char date_format [6] = "D-M-Y"
static const char debug_usage []
static int default_capability = AST_FORMAT_ULAW | AST_FORMAT_ALAW
static struct ast_jb_conf default_jbconf
static struct ast_codec_pref default_prefs
static struct skinny_devicedevices
static int firstdigittimeout = 16000
static int gendigittimeout = 8000
static struct ast_jb_conf global_jbconf
hostent * hp
static int immediate = 0
static struct io_contextio
static int keep_alive = 120
static char language [MAX_LANGUAGE] = ""
static char linelabel [AST_MAX_EXTENSION] = ""
static char mailbox [AST_MAX_EXTENSION]
static int matchdigittimeout = 3000
static char mohinterpret [MAX_MUSICCLASS] = "default"
static char mohsuggest [MAX_MUSICCLASS] = ""
static pthread_t monitor_thread = AST_PTHREADT_NULL
static int mwiblink = 0
static int nat = 0
static const char no_debug_usage []
static char ourhost [256]
static int ourport
static const char reset_usage []
static struct sched_contextsched
static struct skinnysessionsessions
static const char show_devices_usage []
static const char show_lines_usage []
int skinny_header_size = 12
static struct ast_rtp_protocol skinny_rtp
static const struct ast_channel_tech skinny_tech
static int skinnydebug = 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 const 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_unknown []
soft_key_template_definition soft_key_template_default []
static const char tdesc [] = "Skinny Client Control Protocol (Skinny)"
static int threewaycalling = 0
static int transfer = 0
static char version_id [16] = "P002F202"


Define Documentation

#define ACTIVATE_CALL_PLANE_MESSAGE   0x0116
 

Definition at line 671 of file chan_skinny.c.

Referenced by skinny_hold(), skinny_unhold(), and transmit_callstate().

#define ALARM_MESSAGE   0x0020
 

Definition at line 219 of file chan_skinny.c.

Referenced by handle_message().

#define BT_AUTOANSWER   STIMULUS_AUTOANSWER
 

Definition at line 394 of file chan_skinny.c.

#define BT_CALLPARK   STIMULUS_CALLPARK
 

Definition at line 396 of file chan_skinny.c.

Referenced by get_button_template().

#define BT_CALLPICKUP   STIMULUS_CALLPICKUP
 

Definition at line 397 of file chan_skinny.c.

#define BT_CONFERENCE   STIMULUS_CONFERENCE
 

Definition at line 395 of file chan_skinny.c.

Referenced by get_button_template().

#define BT_CUST_HINT   0xB1
 

Definition at line 404 of file chan_skinny.c.

#define BT_CUST_LINESPEEDDIAL   0xB0
 

Definition at line 403 of file chan_skinny.c.

Referenced by get_button_template(), and handle_button_template_req_message().

#define BT_DISPLAY   STIMULUS_DISPLAY
 

Definition at line 391 of file chan_skinny.c.

Referenced by get_button_template().

#define BT_FORWARDALL   STIMULUS_FORWARDALL
 

Definition at line 388 of file chan_skinny.c.

Referenced by get_button_template().

#define BT_FORWARDBUSY   STIMULUS_FORWARDBUSY
 

Definition at line 389 of file chan_skinny.c.

#define BT_FORWARDNOANSWER   STIMULUS_FORWARDNOANSWER
 

Definition at line 390 of file chan_skinny.c.

#define BT_HOLD   STIMULUS_HOLD
 

Definition at line 386 of file chan_skinny.c.

Referenced by get_button_template().

#define BT_LINE   STIMULUS_LINE
 

Definition at line 392 of file chan_skinny.c.

Referenced by get_button_template(), and handle_button_template_req_message().

#define BT_NONE   0x00
 

Definition at line 398 of file chan_skinny.c.

Referenced by get_button_template(), and handle_button_template_req_message().

#define BT_REDIAL   STIMULUS_REDIAL
 

Definition at line 384 of file chan_skinny.c.

Referenced by get_button_template().

#define BT_SPEEDDIAL   STIMULUS_SPEEDDIAL
 

Definition at line 385 of file chan_skinny.c.

Referenced by get_button_template().

#define BT_TRANSFER   STIMULUS_TRANSFER
 

Definition at line 387 of file chan_skinny.c.

Referenced by get_button_template().

#define BT_VOICEMAIL   STIMULUS_VOICEMAIL
 

Definition at line 393 of file chan_skinny.c.

Referenced by get_button_template().

#define BUTTON_TEMPLATE_REQ_MESSAGE   0x000E
 

Definition at line 215 of file chan_skinny.c.

Referenced by handle_message().

#define BUTTON_TEMPLATE_RES_MESSAGE   0x0097
 

Definition at line 355 of file chan_skinny.c.

Referenced by handle_button_template_req_message().

#define CALL_INFO_MESSAGE   0x008F
 

Definition at line 314 of file chan_skinny.c.

Referenced by transmit_callinfo().

#define CALL_STATE_MESSAGE   0x0111
 

Definition at line 650 of file chan_skinny.c.

Referenced by transmit_callstate().

#define CAPABILITIES_REQ_MESSAGE   0x009B
 

Definition at line 427 of file chan_skinny.c.

Referenced by handle_register_message().

#define CAPABILITIES_RES_MESSAGE   0x0010
 

Definition at line 189 of file chan_skinny.c.

Referenced by handle_message().

#define CLEAR_DISPLAY_MESSAGE   0x009A
 

Definition at line 425 of file chan_skinny.c.

Referenced by transmit_displaymessage().

#define CLEAR_NOTIFY_MESSAGE   0x0115
 

Definition at line 423 of file chan_skinny.c.

#define CLEAR_PROMPT_MESSAGE   0x0113
 

Definition at line 424 of file chan_skinny.c.

#define CLOSE_RECEIVE_CHANNEL_MESSAGE   0x0106
 

Definition at line 462 of file chan_skinny.c.

Referenced by skinny_hold(), and transmit_callstate().

#define CONTROL2STR_BUFSIZE   100
 

Definition at line 142 of file chan_skinny.c.

Referenced by control2str().

#define DEFAULT_SKINNY_BACKLOG   2
 

Definition at line 97 of file chan_skinny.c.

Referenced by reload_config().

#define DEFAULT_SKINNY_PORT   2000
 

Definition at line 96 of file chan_skinny.c.

Referenced by build_device(), and reload_config().

#define DEFINETIMEDATE_MESSAGE   0x0094
 

Definition at line 342 of file chan_skinny.c.

Referenced by handle_time_date_req_message().

#define DEVICE2STR_BUFSIZE   15
 

Definition at line 139 of file chan_skinny.c.

Referenced by device2str().

#define DIALED_NUMBER_MESSAGE   0x011D
 

Definition at line 676 of file chan_skinny.c.

Referenced by transmit_dialednumber().

#define DISPLAY_NOTIFY_MESSAGE   0x0114
 

Definition at line 665 of file chan_skinny.c.

Referenced by transmit_displaynotify().

#define DISPLAY_PROMPT_STATUS_MESSAGE   0x0112
 

Definition at line 657 of file chan_skinny.c.

Referenced by transmit_displaypromptstatus().

#define DISPLAYTEXT_MESSAGE   0x0099
 

Definition at line 418 of file chan_skinny.c.

Referenced by transmit_displaymessage().

#define HEADSET_STATUS_MESSAGE   0x002B
 

Definition at line 246 of file chan_skinny.c.

Referenced by handle_message().

#define htolel  )     (x)
 

Definition at line 107 of file chan_skinny.c.

Referenced by get_input(), handle_button_template_req_message(), handle_open_receive_channel_ack_message(), handle_register_message(), handle_server_request_message(), handle_soft_key_set_req_message(), handle_soft_key_template_req_message(), handle_speed_dial_stat_req_message(), handle_time_date_req_message(), load_module(), req_alloc(), skinny_hold(), skinny_unhold(), transmit_callinfo(), transmit_callstate(), transmit_connect(), transmit_dialednumber(), transmit_displaynotify(), transmit_displaypromptstatus(), transmit_lamp_indication(), transmit_ringer_mode(), transmit_selectsoftkeys(), transmit_speaker_mode(), and transmit_tone().

#define htoles  )     (x)
 

Definition at line 108 of file chan_skinny.c.

#define IP_PORT_MESSAGE   0x0002
 

Definition at line 161 of file chan_skinny.c.

Referenced by handle_message().

#define KEEP_ALIVE_ACK_MESSAGE   0x0100
 

Definition at line 450 of file chan_skinny.c.

Referenced by handle_keep_alive_message().

#define KEEP_ALIVE_MESSAGE   0x0000
 

Definition at line 148 of file chan_skinny.c.

Referenced by handle_message().

#define KEYDEF_CONNECTED   1
 

Definition at line 476 of file chan_skinny.c.

Referenced by handle_offhook_message(), handle_soft_key_event_message(), and handle_stimulus_message().

#define KEYDEF_CONNWITHCONF   7
 

Definition at line 482 of file chan_skinny.c.

#define KEYDEF_CONNWITHTRANS   5
 

Definition at line 480 of file chan_skinny.c.

#define KEYDEF_DADFD   6
 

Definition at line 481 of file chan_skinny.c.

#define KEYDEF_OFFHOOK   4
 

Definition at line 479 of file chan_skinny.c.

Referenced by handle_offhook_message(), handle_soft_key_event_message(), and handle_stimulus_message().

#define KEYDEF_OFFHOOKWITHFEAT   9
 

Definition at line 484 of file chan_skinny.c.

#define KEYDEF_ONHOLD   2
 

Definition at line 477 of file chan_skinny.c.

#define KEYDEF_ONHOOK   0
 

Definition at line 475 of file chan_skinny.c.

#define KEYDEF_RINGIN   3
 

Definition at line 478 of file chan_skinny.c.

Referenced by skinny_call().

#define KEYDEF_RINGOUT   8
 

Definition at line 483 of file chan_skinny.c.

#define KEYDEF_UNKNOWN   10
 

Definition at line 485 of file chan_skinny.c.

#define KEYPAD_BUTTON_MESSAGE   0x0003
 

Definition at line 163 of file chan_skinny.c.

Referenced by handle_message().

#define letohl  )     (x)
 

Definition at line 105 of file chan_skinny.c.

Referenced by get_input(), handle_capabilities_res_message(), handle_keypad_button_message(), handle_line_state_req_message(), handle_message(), handle_offhook_message(), handle_onhook_message(), handle_open_receive_channel_ack_message(), handle_soft_key_event_message(), handle_speed_dial_stat_req_message(), handle_stimulus_message(), skinny_register(), skinny_req_parse(), and transmit_response().

#define letohs  )     (x)
 

Definition at line 106 of file chan_skinny.c.

#define LINE_STAT_RES_MESSAGE   0x0092
 

Definition at line 334 of file chan_skinny.c.

Referenced by handle_line_state_req_message().

#define LINE_STATE_REQ_MESSAGE   0x000B
 

Definition at line 209 of file chan_skinny.c.

Referenced by handle_message().

#define OFFHOOK_MESSAGE   0x0006
 

Definition at line 177 of file chan_skinny.c.

Referenced by handle_message().

#define ONHOOK_MESSAGE   0x0007
 

Definition at line 183 of file chan_skinny.c.

Referenced by handle_message().

#define OPEN_RECEIVE_CHANNEL_ACK_MESSAGE   0x0022
 

Definition at line 227 of file chan_skinny.c.

Referenced by handle_message().

#define OPEN_RECEIVE_CHANNEL_MESSAGE   0x0105
 

Definition at line 452 of file chan_skinny.c.

Referenced by transmit_connect().

#define REGISTER_ACK_MESSAGE   0x0081
 

Definition at line 249 of file chan_skinny.c.

Referenced by handle_register_message().

#define REGISTER_AVAILABLE_LINES_MESSAGE   0x002D
 

Definition at line 247 of file chan_skinny.c.

Referenced by handle_message().

#define REGISTER_MESSAGE   0x0001
 

Definition at line 151 of file chan_skinny.c.

Referenced by handle_message().

#define REGISTER_REJ_MESSAGE   0x009D
 

Definition at line 429 of file chan_skinny.c.

Referenced by handle_register_message().

#define RESET_MESSAGE   0x009F
 

Definition at line 445 of file chan_skinny.c.

Referenced by skinny_reset_device().

#define SELECT_SOFT_KEYS_MESSAGE   0x0110
 

Definition at line 642 of file chan_skinny.c.

Referenced by transmit_selectsoftkeys().

#define SERVER_REQUEST_MESSAGE   0x0012
 

Definition at line 217 of file chan_skinny.c.

Referenced by handle_message().

#define SERVER_RES_MESSAGE   0x009E
 

Definition at line 434 of file chan_skinny.c.

Referenced by handle_server_request_message().

#define SET_LAMP_MESSAGE   0x0086
 

Definition at line 272 of file chan_skinny.c.

Referenced by transmit_lamp_indication().

#define SET_MICROPHONE_MESSAGE   0x0089
 

Definition at line 285 of file chan_skinny.c.

#define SET_RINGER_MESSAGE   0x0085
 

Definition at line 265 of file chan_skinny.c.

Referenced by transmit_ringer_mode().

#define SET_SPEAKER_MESSAGE   0x0088
 

Definition at line 279 of file chan_skinny.c.

Referenced by transmit_speaker_mode().

#define SKINNY_ALERT   0x24
 

Definition at line 829 of file chan_skinny.c.

Referenced by skinny_call(), and skinny_indicate().

#define SKINNY_BUSY   6
 

Definition at line 817 of file chan_skinny.c.

Referenced by skinny_indicate().

#define SKINNY_BUSYTONE   0x23
 

Definition at line 828 of file chan_skinny.c.

Referenced by skinny_indicate().

#define SKINNY_CALLWAIT   9
 

Definition at line 820 of file chan_skinny.c.

#define SKINNY_CALLWAITTONE   0x2D
 

Definition at line 831 of file chan_skinny.c.

Referenced by skinny_call().

#define SKINNY_CONGESTION   7
 

Definition at line 818 of file chan_skinny.c.

Referenced by skinny_indicate().

#define SKINNY_CONNECTED   5
 

Definition at line 816 of file chan_skinny.c.

Referenced by handle_offhook_message(), handle_soft_key_event_message(), handle_stimulus_message(), and skinny_answer().

#define SKINNY_CX_CONF   3
 

Definition at line 852 of file chan_skinny.c.

#define SKINNY_CX_CONFERENCE   3
 

Definition at line 853 of file chan_skinny.c.

#define SKINNY_CX_INACTIVE   4
 

Definition at line 855 of file chan_skinny.c.

Referenced by skinny_new().

#define SKINNY_CX_MUTE   4
 

Definition at line 854 of file chan_skinny.c.

#define SKINNY_CX_RECVONLY   1
 

Definition at line 850 of file chan_skinny.c.

Referenced by handle_onhook_message(), and handle_soft_key_event_message().

#define SKINNY_CX_SENDONLY   0
 

Definition at line 849 of file chan_skinny.c.

#define SKINNY_CX_SENDRECV   2
 

Definition at line 851 of file chan_skinny.c.

Referenced by skinny_answer().

#define SKINNY_DEVICE_12   4
 

Definition at line 782 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_12SP   3
 

Definition at line 781 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_12SPPLUS   2
 

Definition at line 780 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_30SPPLUS   1
 

Definition at line 779 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_30VIP   5
 

Definition at line 783 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_7902   30008
 

Definition at line 799 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_7905   20000
 

Definition at line 795 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_7910   6
 

Definition at line 784 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_7911   307
 

Definition at line 792 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_7912   30007
 

Definition at line 798 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_7920   30002
 

Definition at line 796 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_7935   9
 

Definition at line 787 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_7936   30019
 

Definition at line 802 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_7940   8
 

Definition at line 786 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_7941   115
 

Definition at line 789 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_7941GE   309
 

Definition at line 794 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_7960   7
 

Definition at line 785 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_7961   30018
 

Definition at line 801 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_7961GE   308
 

Definition at line 793 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_7970   30006
 

Definition at line 797 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_7971   119
 

Definition at line 790 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_7985   302
 

Definition at line 791 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_ATA186   12
 

Definition at line 788 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_CIPC   30016
 

Definition at line 800 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_NONE   0
 

Definition at line 778 of file chan_skinny.c.

Referenced by device2str().

#define SKINNY_DEVICE_SCCPGATEWAY_AN   30027
 

Definition at line 803 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_SCCPGATEWAY_BRI   30028
 

Definition at line 804 of file chan_skinny.c.

Referenced by device2str(), and get_button_template().

#define SKINNY_DEVICE_UNKNOWN   -1
 

Definition at line 777 of file chan_skinny.c.

Referenced by device2str().

#define SKINNY_DIALTONE   0x21
 

Definition at line 827 of file chan_skinny.c.

Referenced by handle_offhook_message(), handle_soft_key_event_message(), handle_stimulus_message(), and skinny_ss().

#define SKINNY_HOLD   8
 

Definition at line 819 of file chan_skinny.c.

#define SKINNY_INVALID   14
 

Definition at line 824 of file chan_skinny.c.

#define SKINNY_LAMP_BLINK   5
 

Definition at line 838 of file chan_skinny.c.

Referenced by skinny_call(), and skinny_hold().

#define SKINNY_LAMP_FLASH   4
 

Definition at line 837 of file chan_skinny.c.

#define SKINNY_LAMP_OFF   1
 

Definition at line 834 of file chan_skinny.c.

Referenced by handle_soft_key_event_message(), handle_stimulus_message(), and skinny_hangup().

#define SKINNY_LAMP_ON   2
 

Definition at line 835 of file chan_skinny.c.

Referenced by handle_offhook_message(), handle_soft_key_event_message(), handle_stimulus_message(), and skinny_unhold().

#define SKINNY_LAMP_WINK   3
 

Definition at line 836 of file chan_skinny.c.

#define SKINNY_MAX_PACKET   1000
 

Definition at line 98 of file chan_skinny.c.

Referenced by skinny_req_parse(), and transmit_response().

#define SKINNY_MICOFF   2
 

Definition at line 810 of file chan_skinny.c.

#define SKINNY_MICON   1
 

Definition at line 809 of file chan_skinny.c.

#define SKINNY_NOTONE   0x7F
 

Definition at line 832 of file chan_skinny.c.

Referenced by transmit_tone().

#define SKINNY_OFFHOOK   1
 

Definition at line 812 of file chan_skinny.c.

Referenced by handle_offhook_message(), handle_soft_key_event_message(), handle_stimulus_message(), skinny_call(), skinny_hangup(), and transmit_callstate().

#define SKINNY_ONHOOK   2
 

Definition at line 813 of file chan_skinny.c.

Referenced by build_device(), handle_onhook_message(), handle_soft_key_event_message(), skinny_call(), skinny_hangup(), and transmit_callstate().

#define SKINNY_PARK   11
 

Definition at line 822 of file chan_skinny.c.

#define SKINNY_PROGRESS   12
 

Definition at line 823 of file chan_skinny.c.

Referenced by skinny_indicate().

#define SKINNY_REORDER   0x25
 

Definition at line 830 of file chan_skinny.c.

Referenced by skinny_indicate(), skinny_newcall(), and skinny_ss().

#define SKINNY_RING_FEATURE   4
 

Definition at line 843 of file chan_skinny.c.

#define SKINNY_RING_INSIDE   2
 

Definition at line 841 of file chan_skinny.c.

Referenced by skinny_call().

#define SKINNY_RING_OFF   1
 

Definition at line 840 of file chan_skinny.c.

Referenced by handle_offhook_message(), handle_soft_key_event_message(), handle_stimulus_message(), and skinny_hangup().

#define SKINNY_RING_OUTSIDE   3
 

Definition at line 842 of file chan_skinny.c.

#define SKINNY_RINGIN   4
 

Definition at line 815 of file chan_skinny.c.

Referenced by skinny_call().

#define SKINNY_RINGOUT   3
 

Definition at line 814 of file chan_skinny.c.

Referenced by skinny_indicate().

#define SKINNY_SILENCE   0x00
 

Definition at line 826 of file chan_skinny.c.

Referenced by handle_offhook_message(), handle_soft_key_event_message(), handle_stimulus_message(), skinny_answer(), skinny_hangup(), skinny_indicate(), and skinny_ss().

#define SKINNY_SPEAKEROFF   2
 

Definition at line 807 of file chan_skinny.c.

Referenced by skinny_hangup(), and transmit_callstate().

#define SKINNY_SPEAKERON   1
 

Definition at line 806 of file chan_skinny.c.

Referenced by handle_stimulus_message().

#define SKINNY_TRANSFER   10
 

Definition at line 821 of file chan_skinny.c.

#define SOFT_KEY_EVENT_MESSAGE   0x0026
 

Definition at line 237 of file chan_skinny.c.

Referenced by handle_message().

#define SOFT_KEY_SET_REQ_MESSAGE   0x0025
 

Definition at line 235 of file chan_skinny.c.

Referenced by handle_message().

#define SOFT_KEY_SET_RES_MESSAGE   0x0109
 

Definition at line 627 of file chan_skinny.c.

Referenced by handle_soft_key_set_req_message().

#define SOFT_KEY_TEMPLATE_REQ_MESSAGE   0x0028
 

Definition at line 245 of file chan_skinny.c.

Referenced by handle_message().

#define SOFT_KEY_TEMPLATE_RES_MESSAGE   0x0108
 

Definition at line 468 of file chan_skinny.c.

Referenced by handle_soft_key_template_req_message().

#define SOFTKEY_ANSWER   0x0B
 

Definition at line 498 of file chan_skinny.c.

Referenced by handle_soft_key_event_message().

#define SOFTKEY_BKSPC   0x08
 

Definition at line 495 of file chan_skinny.c.

Referenced by handle_soft_key_event_message().

#define SOFTKEY_CFWDALL   0x05
 

Definition at line 492 of file chan_skinny.c.

Referenced by handle_soft_key_event_message().

#define SOFTKEY_CFWDBUSY   0x06
 

Definition at line 493 of file chan_skinny.c.

Referenced by handle_soft_key_event_message().

#define SOFTKEY_CFWDNOANSWER   0x07
 

Definition at line 494 of file chan_skinny.c.

Referenced by handle_soft_key_event_message().

#define SOFTKEY_CONFRN   0x0D
 

Definition at line 500 of file chan_skinny.c.

Referenced by handle_soft_key_event_message().

#define SOFTKEY_ENDCALL   0x09
 

Definition at line 496 of file chan_skinny.c.

Referenced by handle_soft_key_event_message().

#define SOFTKEY_GPICKUP   0x12
 

Definition at line 505 of file chan_skinny.c.

Referenced by handle_soft_key_event_message().

#define SOFTKEY_HOLD   0x03
 

Definition at line 490 of file chan_skinny.c.

Referenced by handle_soft_key_event_message().

#define SOFTKEY_INFO   0x0C
 

Definition at line 499 of file chan_skinny.c.

Referenced by handle_soft_key_event_message().

#define SOFTKEY_JOIN   0x0F
 

Definition at line 502 of file chan_skinny.c.

Referenced by handle_soft_key_event_message().

#define SOFTKEY_MEETME   0x10
 

Definition at line 503 of file chan_skinny.c.

Referenced by handle_soft_key_event_message().

#define SOFTKEY_NEWCALL   0x02
 

Definition at line 489 of file chan_skinny.c.

Referenced by handle_soft_key_event_message().

#define SOFTKEY_NONE   0x00
 

Definition at line 487 of file chan_skinny.c.

Referenced by handle_soft_key_event_message().

#define SOFTKEY_PARK   0x0E
 

Definition at line 501 of file chan_skinny.c.

Referenced by handle_soft_key_event_message().

#define SOFTKEY_PICKUP   0x11
 

Definition at line 504 of file chan_skinny.c.

Referenced by handle_soft_key_event_message().

#define SOFTKEY_REDIAL   0x01
 

Definition at line 488 of file chan_skinny.c.

Referenced by handle_soft_key_event_message().

#define SOFTKEY_RESUME   0x0A
 

Definition at line 497 of file chan_skinny.c.

Referenced by handle_soft_key_event_message().

#define SOFTKEY_TRNSFER   0x04
 

Definition at line 491 of file chan_skinny.c.

Referenced by handle_soft_key_event_message().

#define SPEED_DIAL_STAT_REQ_MESSAGE   0x000A
 

Definition at line 204 of file chan_skinny.c.

Referenced by handle_message().

#define SPEED_DIAL_STAT_RES_MESSAGE   0x0091
 

Definition at line 327 of file chan_skinny.c.

Referenced by handle_speed_dial_stat_req_message().

#define START_MEDIA_TRANSMISSION_MESSAGE   0x008A
 

Definition at line 290 of file chan_skinny.c.

Referenced by handle_open_receive_channel_ack_message().

#define START_TONE_MESSAGE   0x0082
 

Definition at line 258 of file chan_skinny.c.

Referenced by transmit_tone().

#define STIMULUS_AUTOANSWER   0x11
 

Definition at line 377 of file chan_skinny.c.

#define STIMULUS_CALLPARK   0x7E
 

Definition at line 379 of file chan_skinny.c.

Referenced by handle_stimulus_message().

#define STIMULUS_CALLPICKUP   0x7F
 

Definition at line 380 of file chan_skinny.c.

#define STIMULUS_CONFERENCE   0x7D
 

Definition at line 378 of file chan_skinny.c.

Referenced by handle_stimulus_message().

#define STIMULUS_DISPLAY   0x08
 

Definition at line 374 of file chan_skinny.c.

Referenced by handle_stimulus_message().

#define STIMULUS_FORWARDALL   0x05
 

Definition at line 371 of file chan_skinny.c.

Referenced by handle_soft_key_event_message(), and handle_stimulus_message().

#define STIMULUS_FORWARDBUSY   0x06
 

Definition at line 372 of file chan_skinny.c.

Referenced by handle_stimulus_message().

#define STIMULUS_FORWARDNOANSWER   0x07
 

Definition at line 373 of file chan_skinny.c.

Referenced by handle_stimulus_message().

#define STIMULUS_HOLD   0x03
 

Definition at line 369 of file chan_skinny.c.

Referenced by handle_stimulus_message().

#define STIMULUS_LINE   0x09
 

Definition at line 375 of file chan_skinny.c.

Referenced by handle_offhook_message(), handle_soft_key_event_message(), handle_stimulus_message(), skinny_call(), skinny_hangup(), skinny_hold(), and skinny_unhold().

#define STIMULUS_MESSAGE   0x0005
 

Definition at line 170 of file chan_skinny.c.

Referenced by handle_message().

#define STIMULUS_NONE   0xFF
 

Definition at line 381 of file chan_skinny.c.

#define STIMULUS_REDIAL   0x01
 

Definition at line 367 of file chan_skinny.c.

Referenced by handle_stimulus_message().

#define STIMULUS_SPEEDDIAL   0x02
 

Definition at line 368 of file chan_skinny.c.

Referenced by handle_stimulus_message().

#define STIMULUS_TRANSFER   0x04
 

Definition at line 370 of file chan_skinny.c.

Referenced by handle_stimulus_message().

#define STIMULUS_VOICEMAIL   0x0F
 

Definition at line 376 of file chan_skinny.c.

Referenced by handle_stimulus_message().

#define STOP_MEDIA_TRANSMISSION_MESSAGE   0x008B
 

Definition at line 308 of file chan_skinny.c.

Referenced by skinny_hold(), and transmit_callstate().

#define STOP_TONE_MESSAGE   0x0083
 

Definition at line 263 of file chan_skinny.c.

Referenced by transmit_tone().

#define TIME_DATE_REQ_MESSAGE   0x000D
 

Definition at line 214 of file chan_skinny.c.

Referenced by handle_message().

#define TYPE_LINE   2
 

Definition at line 846 of file chan_skinny.c.

#define TYPE_TRUNK   1
 

Definition at line 845 of file chan_skinny.c.

#define UNREGISTER_MESSAGE   0x0027
 

Definition at line 244 of file chan_skinny.c.

Referenced by handle_message().

#define VERSION_REQ_MESSAGE   0x000F
 

Definition at line 216 of file chan_skinny.c.

Referenced by handle_message().

#define VERSION_RES_MESSAGE   0x0098
 

Definition at line 413 of file chan_skinny.c.

Referenced by handle_version_req_message().


Enumeration Type Documentation

enum skinny_codecs
 

Enumerator:
SKINNY_CODEC_ALAW 
SKINNY_CODEC_ULAW 
SKINNY_CODEC_G723_1 
SKINNY_CODEC_G729A 
SKINNY_CODEC_G726_32 
SKINNY_CODEC_H261 
SKINNY_CODEC_H263 

Definition at line 86 of file chan_skinny.c.

00086                    {
00087    SKINNY_CODEC_ALAW = 2,
00088    SKINNY_CODEC_ULAW = 4,
00089    SKINNY_CODEC_G723_1 = 9,
00090    SKINNY_CODEC_G729A = 12,
00091    SKINNY_CODEC_G726_32 = 82, /* XXX Which packing order does this translate to? */
00092    SKINNY_CODEC_H261 = 100,
00093    SKINNY_CODEC_H263 = 101
00094 };


Function Documentation

static void* accept_thread void *  ignore  )  [static]
 

Definition at line 4265 of file chan_skinny.c.

References ast_calloc, ast_log(), ast_mutex_init(), ast_mutex_lock(), ast_mutex_unlock(), ast_pthread_create, destroy_session(), LOG_NOTICE, LOG_WARNING, s, sessions, skinny_session(), and skinnysock.

Referenced by reload_config().

04266 {
04267    int as;
04268    struct sockaddr_in sin;
04269    socklen_t sinlen;
04270    struct skinnysession *s;
04271    struct protoent *p;
04272    int arg = 1;
04273    pthread_attr_t attr;
04274    pthread_t tcp_thread;
04275 
04276    pthread_attr_init(&attr);
04277    pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
04278 
04279    for (;;) {
04280       sinlen = sizeof(sin);
04281       as = accept(skinnysock, (struct sockaddr *)&sin, &sinlen);
04282       if (as < 0) {
04283          ast_log(LOG_NOTICE, "Accept returned -1: %s\n", strerror(errno));
04284          continue;
04285       }
04286       p = getprotobyname("tcp");
04287       if(p) {
04288          if( setsockopt(as, p->p_proto, TCP_NODELAY, (char *)&arg, sizeof(arg) ) < 0 ) {
04289             ast_log(LOG_WARNING, "Failed to set Skinny tcp connection to TCP_NODELAY mode: %s\n", strerror(errno));
04290          }
04291       }
04292       if (!(s = ast_calloc(1, sizeof(struct skinnysession))))
04293          continue;
04294 
04295       memcpy(&s->sin, &sin, sizeof(sin));
04296       ast_mutex_init(&s->lock);
04297       s->fd = as;
04298       ast_mutex_lock(&sessionlock);
04299       s->next = sessions;
04300       sessions = s;
04301       ast_mutex_unlock(&sessionlock);
04302 
04303       if (ast_pthread_create(&tcp_thread, &attr, skinny_session, s)) {
04304          destroy_session(s);
04305       }
04306    }
04307    if (skinnydebug)
04308       ast_verbose("killing accept thread\n");
04309    close(as);
04310    return 0;
04311 }

AST_MODULE_INFO ASTERISK_GPL_KEY  ,
AST_MODFLAG_DEFAULT  ,
"Skinny Client Control Protocol (Skinny)"  ,
load = load_module,
unload = unload_module
 

AST_MUTEX_DEFINE_STATIC devicelock   ) 
 

AST_MUTEX_DEFINE_STATIC sessionlock   ) 
 

AST_MUTEX_DEFINE_STATIC netlock   ) 
 

AST_MUTEX_DEFINE_STATIC monlock   ) 
 

AST_THREADSTORAGE control2str_threadbuf   ) 
 

AST_THREADSTORAGE device2str_threadbuf   ) 
 

static struct skinny_device* build_device const char *  cat,
struct ast_variable v
[static]
 

Definition at line 2001 of file chan_skinny.c.

References __ourip, accountcode, skinny_device::addons, skinny_device::addr, amaflags, ast_append_ha(), ast_callerid_split(), ast_calloc, ast_cdr_amaflags2int(), ast_get_group(), ast_get_ip(), ast_log(), ast_mutex_init(), ast_ouraddrfor(), ast_parse_allow_disallow(), ast_strlen_zero(), ast_true(), ast_verbose(), skinny_line::callgroup, skinny_line::callreturn, callreturn, skinny_line::callwaiting, callwaiting, skinny_line::cancallforward, cancallforward, skinny_line::capability, skinny_device::capability, skinny_line::cid_name, cid_name, skinny_line::cid_num, cid_num, skinny_line::context, context, cur_callergroup, cur_pickupgroup, default_capability, default_prefs, DEFAULT_SKINNY_PORT, skinny_speeddial::exten, exten, free, skinny_device::ha, skinny_line::hookstate, skinny_device::id, skinny_line::immediate, immediate, skinny_line::instance, skinny_speeddial::instance, skinny_line::label, skinny_speeddial::label, skinny_line::language, language, skinny_device::lastlineinstance, linelabel, ast_variable::lineno, skinny_device::lines, skinny_line::lock, skinny_addon::lock, skinny_speeddial::lock, LOG_ERROR, LOG_WARNING, skinny_line::mailbox, mailbox, skinny_line::mohinterpret, mohinterpret, skinny_line::mohsuggest, mohsuggest, skinny_line::msgstate, skinny_line::mwiblink, mwiblink, skinny_line::name, ast_variable::name, skinny_device::name, skinny_line::nat, nat, ast_variable::next, skinny_line::next, skinny_addon::next, skinny_speeddial::next, skinny_line::onhooktime, option_verbose, skinny_device::ourip, skinny_line::parent, skinny_line::pickupgroup, skinny_line::prefs, skinny_device::prefs, SKINNY_ONHOOK, skinny_device::speeddials, strsep(), skinny_line::threewaycalling, threewaycalling, skinny_line::transfer, transfer, skinny_line::type, skinny_addon::type, TYPE_LINE, TYPE_TRUNK, ast_variable::value, VERBOSE_PREFIX_3, and skinny_device::version_id.

Referenced by reload_config().

02002 {
02003    struct skinny_device *d;
02004    struct skinny_line *l;
02005    struct skinny_speeddial *sd;
02006    struct skinny_addon *a;
02007    int lineInstance = 1;
02008    int speeddialInstance = 1;
02009    int y = 0;
02010 
02011    if (!(d = ast_calloc(1, sizeof(struct skinny_device)))) {
02012       return NULL;
02013    } else {
02014       ast_copy_string(d->name, cat, sizeof(d->name));
02015       d->lastlineinstance = 1;
02016       d->capability = default_capability;
02017       d->prefs = default_prefs;
02018       while(v) {
02019          if (!strcasecmp(v->name, "host")) {
02020             if (ast_get_ip(&d->addr, v->value)) {
02021                free(d);
02022                return NULL;
02023             }
02024          } else if (!strcasecmp(v->name, "port")) {
02025             d->addr.sin_port = htons(atoi(v->value));
02026          } else if (!strcasecmp(v->name, "device")) {
02027             ast_copy_string(d->id, v->value, sizeof(d->id));
02028          } else if (!strcasecmp(v->name, "permit") || !strcasecmp(v->name, "deny")) {
02029             d->ha = ast_append_ha(v->name, v->value, d->ha, NULL);
02030          } else if (!strcasecmp(v->name, "context")) {
02031             ast_copy_string(context, v->value, sizeof(context));
02032          } else if (!strcasecmp(v->name, "allow")) {
02033             ast_parse_allow_disallow(&d->prefs, &d->capability, v->value, 1);
02034          } else if (!strcasecmp(v->name, "disallow")) {
02035             ast_parse_allow_disallow(&d->prefs, &d->capability, v->value, 0);
02036          } else if (!strcasecmp(v->name, "version")) {
02037             ast_copy_string(d->version_id, v->value, sizeof(d->version_id));
02038          } else if (!strcasecmp(v->name, "nat")) {
02039             nat = ast_true(v->value);
02040          } else if (!strcasecmp(v->name, "callerid")) {
02041             if (!strcasecmp(v->value, "asreceived")) {
02042                cid_num[0] = '\0';
02043                cid_name[0] = '\0';
02044             } else {
02045                ast_callerid_split(v->value, cid_name, sizeof(cid_name), cid_num, sizeof(cid_num));
02046             }
02047          } else if (!strcasecmp(v->name, "language")) {
02048             ast_copy_string(language, v->value, sizeof(language));
02049          } else if (!strcasecmp(v->name, "accountcode")) {
02050             ast_copy_string(accountcode, v->value, sizeof(accountcode));
02051          } else if (!strcasecmp(v->name, "amaflags")) {
02052             y = ast_cdr_amaflags2int(v->value);
02053             if (y < 0) {
02054                ast_log(LOG_WARNING, "Invalid AMA flags: %s at line %d\n", v->value, v->lineno);
02055             } else {
02056                amaflags = y;
02057             }
02058          } else if (!strcasecmp(v->name, "mohinterpret") || !strcasecmp(v->name, "musiconhold")) {
02059             ast_copy_string(mohinterpret, v->value, sizeof(mohinterpret));
02060          } else if (!strcasecmp(v->name, "mohsuggest")) {
02061             ast_copy_string(mohsuggest, v->value, sizeof(mohsuggest));
02062          } else if (!strcasecmp(v->name, "callgroup")) {
02063             cur_callergroup = ast_get_group(v->value);
02064          } else if (!strcasecmp(v->name, "pickupgroup")) {
02065             cur_pickupgroup = ast_get_group(v->value);
02066          } else if (!strcasecmp(v->name, "immediate")) {
02067             immediate = ast_true(v->value);
02068          } else if (!strcasecmp(v->name, "cancallforward")) {
02069             cancallforward = ast_true(v->value);
02070          } else if (!strcasecmp(v->name, "mailbox")) {
02071             ast_copy_string(mailbox, v->value, sizeof(mailbox));
02072          } else if (!strcasecmp(v->name, "callreturn")) {
02073             callreturn = ast_true(v->value);
02074          } else if (!strcasecmp(v->name, "callwaiting")) {
02075             callwaiting = ast_true(v->value);
02076          } else if (!strcasecmp(v->name, "transfer")) {
02077             transfer = ast_true(v->value);
02078          } else if (!strcasecmp(v->name, "threewaycalling")) {
02079             threewaycalling = ast_true(v->value);
02080          } else if (!strcasecmp(v->name, "mwiblink")) {
02081             mwiblink = ast_true(v->value);
02082          } else if (!strcasecmp(v->name, "linelabel")) {
02083             ast_copy_string(linelabel, v->value, sizeof(linelabel));
02084          } else if (!strcasecmp(v->name, "speeddial")) {
02085             if (!(sd = ast_calloc(1, sizeof(struct skinny_speeddial)))) {
02086                return NULL;
02087             } else {
02088                char *stringp, *exten, *label;
02089                stringp = v->value;
02090                exten = strsep(&stringp, ",");
02091                label = strsep(&stringp, ",");
02092                ast_mutex_init(&sd->lock);
02093                ast_copy_string(sd->exten, exten, sizeof(sd->exten));
02094                if (label)
02095                   ast_copy_string(sd->label, label, sizeof(sd->label));
02096                else
02097                   ast_copy_string(sd->label, exten, sizeof(sd->label));
02098                sd->instance = speeddialInstance++;
02099 
02100                sd->next = d->speeddials;
02101                d->speeddials = sd;
02102             }
02103          } else if (!strcasecmp(v->name, "addon")) {
02104             if (!(a = ast_calloc(1, sizeof(struct skinny_addon)))) {
02105                return NULL;
02106             } else {
02107                ast_mutex_init(&a->lock);
02108                ast_copy_string(a->type, v->value, sizeof(a->type));
02109 
02110                a->next = d->addons;
02111                d->addons = a;
02112             }
02113          } else if (!strcasecmp(v->name, "trunk") || !strcasecmp(v->name, "line")) {
02114             if (!(l = ast_calloc(1, sizeof(struct skinny_line)))) {
02115                return NULL;
02116             } else {
02117                ast_mutex_init(&l->lock);
02118                ast_copy_string(l->name, v->value, sizeof(l->name));
02119 
02120                /* XXX Should we check for uniqueness?? XXX */
02121                ast_copy_string(l->context, context, sizeof(l->context));
02122                ast_copy_string(l->cid_num, cid_num, sizeof(l->cid_num));
02123                ast_copy_string(l->cid_name, cid_name, sizeof(l->cid_name));
02124                ast_copy_string(l->label, linelabel, sizeof(l->label));
02125                ast_copy_string(l->language, language, sizeof(l->language));
02126                ast_copy_string(l->mohinterpret, mohinterpret, sizeof(l->mohinterpret));
02127                ast_copy_string(l->mohsuggest, mohsuggest, sizeof(l->mohsuggest));
02128                ast_copy_string(l->mailbox, mailbox, sizeof(l->mailbox));
02129                ast_copy_string(l->mailbox, mailbox, sizeof(l->mailbox));
02130                if (!ast_strlen_zero(mailbox)) {
02131                   if (option_verbose > 2)
02132                      ast_verbose(VERBOSE_PREFIX_3 "Setting mailbox '%s' on %s@%s\n", mailbox, d->name, l->name);
02133                }
02134                l->msgstate = -1;
02135                l->capability = d->capability;
02136                l->prefs = d->prefs;
02137                l->parent = d;
02138                if (!strcasecmp(v->name, "trunk")) {
02139                   l->type = TYPE_TRUNK;
02140                } else {
02141                   l->type = TYPE_LINE;
02142                }
02143                l->immediate = immediate;
02144                l->callgroup = cur_callergroup;
02145                l->pickupgroup = cur_pickupgroup;
02146                l->callreturn = callreturn;
02147                l->cancallforward = cancallforward;
02148                l->callwaiting = callwaiting;
02149                l->transfer = transfer;
02150                l->threewaycalling = threewaycalling;
02151                l->mwiblink = mwiblink;
02152                l->onhooktime = time(NULL);
02153                l->instance = lineInstance++;
02154                /* ASSUME we're onhook at this point */
02155                l->hookstate = SKINNY_ONHOOK;
02156                l->nat = nat;
02157 
02158                l->next = d->lines;
02159                d->lines = l;
02160             }
02161          } else {
02162             ast_log(LOG_WARNING, "Don't know keyword '%s' at line %d\n", v->name, v->lineno);
02163          }
02164          v = v->next;
02165       }
02166 
02167       if (!d->lines) {
02168          ast_log(LOG_ERROR, "A Skinny device must have at least one line!\n");
02169          return NULL;
02170       }
02171       if (/*d->addr.sin_addr.s_addr && */!ntohs(d->addr.sin_port)) {
02172          d->addr.sin_port = htons(DEFAULT_SKINNY_PORT);
02173       }
02174 #if 0
02175       /* I don't think we need this anymore at all, since d->ourip is set in skinny_register now */
02176       if (d->addr.sin_addr.s_addr) {
02177          /* XXX See note above, in 'host' option. */
02178          if (ast_ouraddrfor(&d->addr.sin_addr, &d->ourip)) {
02179             d->ourip = __ourip;
02180          }
02181       } else {
02182          d->ourip = __ourip;
02183       }
02184 #endif
02185    }
02186    return d;
02187 }

static int codec_ast2skinny int  astcodec  )  [static]
 

Definition at line 1314 of file chan_skinny.c.

References AST_FORMAT_ALAW, AST_FORMAT_G723_1, AST_FORMAT_G726_AAL2, AST_FORMAT_G729A, AST_FORMAT_H261, AST_FORMAT_H263, AST_FORMAT_ULAW, SKINNY_CODEC_ALAW, SKINNY_CODEC_G723_1, SKINNY_CODEC_G726_32, SKINNY_CODEC_G729A, SKINNY_CODEC_H261, SKINNY_CODEC_H263, and SKINNY_CODEC_ULAW.

Referenced by handle_open_receive_channel_ack_message(), and transmit_connect().

01315 {
01316    switch (astcodec) {
01317    case AST_FORMAT_ALAW:
01318       return SKINNY_CODEC_ALAW;
01319    case AST_FORMAT_ULAW:
01320       return SKINNY_CODEC_ULAW;
01321    case AST_FORMAT_G723_1:
01322       return SKINNY_CODEC_G723_1;
01323    case AST_FORMAT_G729A:
01324       return SKINNY_CODEC_G729A;
01325    case AST_FORMAT_G726_AAL2: /* XXX Is this right? */
01326       return SKINNY_CODEC_G726_32;
01327    case AST_FORMAT_H261:
01328       return SKINNY_CODEC_H261;
01329    case AST_FORMAT_H263:
01330       return SKINNY_CODEC_H263;
01331    default:
01332       return 0;
01333    }
01334 }

static int codec_skinny2ast enum skinny_codecs  skinnycodec  )  [static]
 

Definition at line 1292 of file chan_skinny.c.

References AST_FORMAT_ALAW, AST_FORMAT_G723_1, AST_FORMAT_G726_AAL2, AST_FORMAT_G729A, AST_FORMAT_H261, AST_FORMAT_H263, AST_FORMAT_ULAW, SKINNY_CODEC_ALAW, 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().

01293 {
01294    switch (skinnycodec) {
01295    case SKINNY_CODEC_ALAW:
01296       return AST_FORMAT_ALAW;
01297    case SKINNY_CODEC_ULAW:
01298       return AST_FORMAT_ULAW;
01299    case SKINNY_CODEC_G723_1:
01300       return AST_FORMAT_G723_1;
01301    case SKINNY_CODEC_G729A:
01302       return AST_FORMAT_G729A;
01303    case SKINNY_CODEC_G726_32:
01304       return AST_FORMAT_G726_AAL2; /* XXX Is this right? */
01305    case SKINNY_CODEC_H261:
01306       return AST_FORMAT_H261;
01307    case SKINNY_CODEC_H263:
01308       return AST_FORMAT_H263;
01309    default:
01310       return 0;
01311    }
01312 }

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

Definition at line 1772 of file chan_skinny.c.

References ast_strdup, devices, skinny_device::id, and skinny_device::next.

01773 {
01774    struct skinny_device *d;
01775 
01776    char *result = NULL;
01777    int wordlen = strlen(word);
01778    int which = 0;
01779 
01780    if (pos == 2) {
01781       for (d = devices; d && !result; d = d->next) {
01782          if (!strncasecmp(word, d->id, wordlen) && ++which > state)
01783             result = ast_strdup(d->id);
01784       }
01785    }
01786 
01787    return result;
01788 }

static char* control2str int  ind  )  [static]
 

Definition at line 2582 of file chan_skinny.c.

References AST_CONTROL_ANSWER, AST_CONTROL_BUSY, AST_CONTROL_CONGESTION, AST_CONTROL_FLASH, AST_CONTROL_HANGUP, AST_CONTROL_HOLD, AST_CONTROL_OFFHOOK, AST_CONTROL_OPTION, AST_CONTROL_PROCEEDING, AST_CONTROL_PROGRESS, AST_CONTROL_RADIO_KEY, AST_CONTROL_RADIO_UNKEY, AST_CONTROL_RING, AST_CONTROL_RINGING, AST_CONTROL_TAKEOFFHOOK, AST_CONTROL_UNHOLD, AST_CONTROL_WINK, and CONTROL2STR_BUFSIZE.

02582                                   {
02583    char *tmp;
02584 
02585    switch (ind) {
02586    case AST_CONTROL_HANGUP:
02587       return "Other end has hungup";
02588    case AST_CONTROL_RING:
02589       return "Local ring";
02590    case AST_CONTROL_RINGING:
02591       return "Remote end is ringing";
02592    case AST_CONTROL_ANSWER:
02593       return "Remote end has answered";
02594    case AST_CONTROL_BUSY:
02595       return "Remote end is busy";
02596    case AST_CONTROL_TAKEOFFHOOK:
02597       return "Make it go off hook";
02598    case AST_CONTROL_OFFHOOK:
02599       return "Line is off hook";
02600    case AST_CONTROL_CONGESTION:
02601       return "Congestion (circuits busy)";
02602    case AST_CONTROL_FLASH:
02603       return "Flash hook";
02604    case AST_CONTROL_WINK:
02605       return "Wink";
02606    case AST_CONTROL_OPTION:
02607       return "Set a low-level option";
02608    case AST_CONTROL_RADIO_KEY:
02609       return "Key Radio";
02610    case AST_CONTROL_RADIO_UNKEY:
02611       return "Un-Key Radio";
02612    case AST_CONTROL_PROGRESS:
02613       return "Remote end is making Progress";
02614    case AST_CONTROL_PROCEEDING:
02615       return "Remote end is proceeding";
02616    case AST_CONTROL_HOLD:
02617       return "Hold";
02618    case AST_CONTROL_UNHOLD:
02619       return "Unhold";
02620    case -1:
02621       return "Stop tone";
02622    default:
02623       if (!(tmp = ast_threadstorage_get(&control2str_threadbuf, CONTROL2STR_BUFSIZE)))
02624                         return "Unknown";
02625       snprintf(tmp, CONTROL2STR_BUFSIZE, "UNKNOWN-%d", ind);
02626       return tmp;
02627    }
02628 }

static void delete_devices void   )  [static]
 

Definition at line 4547 of file chan_skinny.c.

References ast_mutex_destroy(), ast_mutex_lock(), devices, free, skinny_device::lines, skinny_line::lock, and skinny_line::next.

Referenced by unload_module().

04548 {
04549    struct skinny_device *d, *dlast;
04550    struct skinny_line *l, *llast;
04551    struct skinny_speeddial *sd, *sdlast;
04552    struct skinny_addon *a, *alast;
04553 
04554    ast_mutex_lock(&devicelock);
04555 
04556    /* Delete all devices */
04557    for (d=devices;d;) {
04558       /* Delete all lines for this device */
04559       for (l=d->lines;l;) {
04560          llast = l;
04561          l = l->next;
04562          ast_mutex_destroy(&llast->lock);
04563          free(llast);
04564       }
04565       /* Delete all speeddials for this device */
04566       for (sd=d->speeddials;sd;) {
04567          sdlast = sd;
04568          sd = sd->next;
04569          ast_mutex_destroy(&sdlast->lock);
04570          free(sdlast);
04571       }
04572       /* Delete all addons for this device */
04573       for (a=d->addons;a;) {
04574          alast = a;
04575          a = a->next;
04576          ast_mutex_destroy(&alast->lock);
04577          free(alast);
04578       }
04579       dlast = d;
04580       d = d->next;
04581       free(dlast);
04582    }
04583    devices=NULL;
04584    ast_mutex_unlock(&devicelock);
04585 }

static void destroy_session struct skinnysession s  )  [static]
 

Definition at line 4108 of file chan_skinny.c.

References ast_log(), ast_mutex_destroy(), ast_mutex_lock(), ast_mutex_unlock(), free, LOG_WARNING, skinnysession::next, s, and sessions.

04109 {
04110    struct skinnysession *cur, *prev = NULL;
04111    ast_mutex_lock(&sessionlock);
04112    cur = sessions;
04113    while(cur) {
04114       if (cur == s) {
04115          break;
04116       }
04117       prev = cur;
04118       cur = cur->next;
04119    }
04120    if (cur) {
04121       if (prev) {
04122          prev->next = cur->next;
04123       } else {
04124          sessions = cur->next;
04125       }
04126       if (s->fd > -1) {
04127          close(s->fd);
04128       }
04129       ast_mutex_destroy(&s->lock);
04130       free(s);
04131    } else {
04132       ast_log(LOG_WARNING, "Trying to delete nonexistent session %p?\n", s);
04133    }
04134    ast_mutex_unlock(&sessionlock);
04135 }

static char* device2str int  type  )  [static]
 

Definition at line 1826 of file chan_skinny.c.

References DEVICE2STR_BUFSIZE, SKINNY_DEVICE_12, SKINNY_DEVICE_12SP, SKINNY_DEVICE_12SPPLUS, SKINNY_DEVICE_30SPPLUS, SKINNY_DEVICE_30VIP, SKINNY_DEVICE_7902, SKINNY_DEVICE_7905, SKINNY_DEVICE_7910, SKINNY_DEVICE_7911, SKINNY_DEVICE_7912, SKINNY_DEVICE_7920, SKINNY_DEVICE_7935, SKINNY_DEVICE_7936, SKINNY_DEVICE_7940, SKINNY_DEVICE_7941, SKINNY_DEVICE_7941GE, SKINNY_DEVICE_7960, SKINNY_DEVICE_7961, SKINNY_DEVICE_7961GE, SKINNY_DEVICE_7970, SKINNY_DEVICE_7971, SKINNY_DEVICE_7985, SKINNY_DEVICE_ATA186, SKINNY_DEVICE_CIPC, SKINNY_DEVICE_NONE, SKINNY_DEVICE_SCCPGATEWAY_AN, SKINNY_DEVICE_SCCPGATEWAY_BRI, and SKINNY_DEVICE_UNKNOWN.

01827 {
01828    char *tmp;
01829 
01830    switch (type) {
01831    case SKINNY_DEVICE_NONE:
01832       return "No Device";
01833    case SKINNY_DEVICE_30SPPLUS:
01834       return "30SP Plus";
01835    case SKINNY_DEVICE_12SPPLUS:
01836       return "12SP Plus";
01837    case SKINNY_DEVICE_12SP:
01838       return "12SP";
01839    case SKINNY_DEVICE_12:
01840       return "12";
01841    case SKINNY_DEVICE_30VIP:
01842       return "30VIP";
01843    case SKINNY_DEVICE_7910:
01844       return "7910";
01845    case SKINNY_DEVICE_7960:
01846       return "7960";
01847    case SKINNY_DEVICE_7940:
01848       return "7940";
01849    case SKINNY_DEVICE_7935:
01850       return "7935";
01851    case SKINNY_DEVICE_ATA186:
01852       return "ATA186";
01853    case SKINNY_DEVICE_7941:
01854       return "7941";
01855    case SKINNY_DEVICE_7971:
01856       return "7971";
01857    case SKINNY_DEVICE_7985:
01858       return "7985";
01859    case SKINNY_DEVICE_7911:
01860       return "7911";
01861    case SKINNY_DEVICE_7961GE:
01862       return "7961GE";
01863    case SKINNY_DEVICE_7941GE:
01864       return "7941GE";
01865    case SKINNY_DEVICE_7905:
01866       return "7905";
01867    case SKINNY_DEVICE_7920:
01868       return "7920";
01869    case SKINNY_DEVICE_7970:
01870       return "7970";
01871    case SKINNY_DEVICE_7912:
01872       return "7912";
01873    case SKINNY_DEVICE_7902:
01874       return "7902";
01875    case SKINNY_DEVICE_CIPC:
01876       return "IP Communicator";
01877    case SKINNY_DEVICE_7961:
01878       return "7961";
01879    case SKINNY_DEVICE_7936:
01880       return "7936";
01881    case SKINNY_DEVICE_SCCPGATEWAY_AN:
01882       return "SCCPGATEWAY_AN";
01883    case SKINNY_DEVICE_SCCPGATEWAY_BRI:
01884       return "SCCPGATEWAY_BRI";
01885    case SKINNY_DEVICE_UNKNOWN:
01886       return "Unknown";
01887    default:
01888       if (!(tmp = ast_threadstorage_get(&device2str_threadbuf, DEVICE2STR_BUFSIZE)))
01889          return "Unknown";
01890       snprintf(tmp, DEVICE2STR_BUFSIZE, "UNKNOWN-%d", type);
01891       return tmp;
01892    }
01893 }

static void do_housekeeping struct skinnysession s  )  [static]
 

Definition at line 1680 of file chan_skinny.c.

References s, and transmit_displaymessage().

Referenced by handle_keep_alive_message(), handle_onhook_message(), handle_soft_key_event_message(), and skinny_hangup().

01681 {
01682 /*
01683    int new;
01684    int old;
01685    struct skinny_device *d = s->device;
01686    struct skinny_line *l;
01687 */
01688 
01689    transmit_displaymessage(s, NULL);
01690 
01691 /*
01692    for (l = d->lines; l; l = l->next) {
01693       if (has_voicemail(l)) {
01694          if (skinnydebug)
01695             ast_verbose("Checking for voicemail Skinny %s@%s\n", l->name, d->name);
01696          ast_app_inboxcount(l->mailbox, &new, &old);
01697          if (skinnydebug)
01698             ast_verbose("Skinny %s@%s has voicemail!\n", l->name, d->name);
01699          transmit_lamp_indication(s, STIMULUS_VOICEMAIL, l->instance, l->mwiblink?SKINNY_LAMP_BLINK:SKINNY_LAMP_ON);
01700       } else {
01701          transmit_lamp_indication(s, STIMULUS_VOICEMAIL, l->instance, SKINNY_LAMP_OFF);
01702       }
01703    }
01704 */
01705 }

static void* do_monitor void *  data  )  [static]
 

Definition at line 4313 of file chan_skinny.c.

References ast_io_wait(), ast_mutex_lock(), ast_mutex_unlock(), ast_sched_runq(), ast_sched_wait(), and io.

04314 {
04315    int res;
04316 
04317    /* This thread monitors all the interfaces which are not yet in use
04318       (and thus do not have a separate thread) indefinitely */
04319    /* From here on out, we die whenever asked */
04320    for(;;) {
04321       pthread_testcancel();
04322       /* Wait for sched or io */
04323       res = ast_sched_wait(sched);
04324       if ((res < 0) || (res > 1000)) {
04325          res = 1000;
04326       }
04327       res = ast_io_wait(io, res);
04328       ast_mutex_lock(&monlock);
04329       if (res >= 0) {
04330          ast_sched_runq(sched);
04331       }
04332       ast_mutex_unlock(&monlock);
04333    }
04334    /* Never reached */
04335    return NULL;
04336 
04337 }

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

Definition at line 1180 of file chan_skinny.c.

References ast_log(), skinny_line::instance, skinny_device::lines, LOG_WARNING, skinny_device::name, and skinny_line::next.

Referenced by find_subchannel_by_instance_reference(), handle_line_state_req_message(), handle_offhook_message(), handle_soft_key_event_message(), and handle_stimulus_message().

01181 {
01182    struct skinny_line *l;
01183 
01184    for (l = d->lines; l; l = l->next) {
01185       if (l->instance == instance)
01186          break;
01187    }
01188 
01189    if (!l) {
01190       ast_log(LOG_WARNING, "Could not find line with instance '%d' on device '%s'\n", instance, d->name);
01191    }
01192    return l;
01193 }

static struct skinny_line* find_line_by_name const char *  dest  )  [static]
 

Definition at line 1195 of file chan_skinny.c.

References ast_log(), ast_mutex_lock(), ast_mutex_unlock(), ast_verbose(), devices, line, skinny_device::lines, LOG_NOTICE, skinny_line::name, skinny_device::name, skinny_line::next, and skinny_device::next.

Referenced by skinny_request().

01196 {
01197    struct skinny_line *l;
01198    struct skinny_device *d;
01199    char line[256];
01200    char *at;
01201    char *device;
01202 
01203    ast_copy_string(line, dest, sizeof(line));
01204    at = strchr(line, '@');
01205    if (!at) {
01206       ast_log(LOG_NOTICE, "Device '%s' has no @ (at) sign!\n", dest);
01207       return NULL;
01208    }
01209    *at++ = '\0';
01210    device = at;
01211    ast_mutex_lock(&devicelock);
01212    for (d = devices; d; d = d->next) {
01213       if (!strcasecmp(d->name, device)) {
01214          if (skinnydebug)
01215             ast_verbose("Found device: %s\n", d->name);
01216          /* Found the device */
01217          for (l = d->lines; l; l = l->next) {
01218             /* Search for the right line */
01219             if (!strcasecmp(l->name, line)) {
01220                ast_mutex_unlock(&devicelock);
01221                return l;
01222             }
01223          }
01224       }
01225    }
01226    /* Device not found */
01227    ast_mutex_unlock(&devicelock);
01228    return NULL;
01229 }

static struct skinny_speeddial* find_speeddial_by_instance struct skinny_device d,
int  instance
[static]
 

Definition at line 1277 of file chan_skinny.c.

References ast_log(), skinny_speeddial::instance, LOG_WARNING, skinny_device::name, skinny_speeddial::next, and skinny_device::speeddials.

Referenced by handle_speed_dial_stat_req_message(), and handle_stimulus_message().

01278 {
01279    struct skinny_speeddial *sd;
01280 
01281    for (sd = d->speeddials; sd; sd = sd->next) {
01282       if (sd->instance == instance)
01283          break;
01284    }
01285 
01286    if (!sd) {
01287       ast_log(LOG_WARNING, "Could not find speeddial with instance '%d' on device '%s'\n", instance, d->name);
01288    }
01289    return sd;
01290 }

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

Definition at line 1232 of file chan_skinny.c.

References ast_log(), skinny_subchannel::callid, find_line_by_instance(), LOG_WARNING, skinny_device::name, skinny_subchannel::next, and skinny_line::sub.

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

01233 {
01234    struct skinny_line *l = find_line_by_instance(d, instance);
01235    struct skinny_subchannel *sub;
01236 
01237    if (!l) {
01238       return NULL;
01239    }
01240 
01241    for (sub = l->sub; sub; sub = sub->next) {
01242       if (sub->callid == reference)
01243          break;
01244    }
01245 
01246    if (!sub) {
01247       ast_log(LOG_WARNING, "Could not find subchannel with reference '%d' on '%s'\n", reference, d->name);
01248    }
01249    return sub;
01250 }

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

Definition at line 1253 of file chan_skinny.c.

References ast_log(), skinny_subchannel::callid, skinny_device::lines, LOG_WARNING, skinny_line::name, skinny_device::name, skinny_subchannel::next, skinny_line::next, and skinny_line::sub.

Referenced by handle_open_receive_channel_ack_message().

01254 {
01255    struct skinny_line *l;
01256    struct skinny_subchannel *sub = NULL;
01257 
01258    for (l = d->lines; l; l = l->next) {
01259       for (sub = l->sub; sub; sub = sub->next) {
01260          if (sub->callid == reference)
01261             break;
01262       }
01263       if (sub)
01264          break;
01265    }
01266 
01267    if (!l) {
01268       ast_log(LOG_WARNING, "Could not find any lines that contained a subchannel with reference '%d' on device '%s'\n", reference, d->name);
01269    } else {
01270       if (!sub) {
01271          ast_log(LOG_WARNING, "Could not find subchannel with reference '%d' on '%s@%s'\n", reference, l->name, d->name);
01272       }
01273    }
01274    return sub;
01275 }

static void* get_button_template struct skinnysession s,
struct button_definition_template btn
[static]
 

Definition at line 1051 of file chan_skinny.c.

References skinny_device::addons, ast_log(), BT_CALLPARK, BT_CONFERENCE, BT_CUST_LINESPEEDDIAL, BT_DISPLAY, BT_FORWARDALL, BT_HOLD, BT_LINE, BT_NONE, BT_REDIAL, BT_SPEEDDIAL, BT_TRANSFER, BT_VOICEMAIL, LOG_WARNING, skinny_addon::next, s, SKINNY_DEVICE_12, SKINNY_DEVICE_12SP, SKINNY_DEVICE_12SPPLUS, SKINNY_DEVICE_30SPPLUS, SKINNY_DEVICE_30VIP, SKINNY_DEVICE_7902, SKINNY_DEVICE_7905, SKINNY_DEVICE_7910, SKINNY_DEVICE_7911, SKINNY_DEVICE_7912, SKINNY_DEVICE_7920, SKINNY_DEVICE_7935, SKINNY_DEVICE_7936, SKINNY_DEVICE_7940, SKINNY_DEVICE_7941, SKINNY_DEVICE_7941GE, SKINNY_DEVICE_7960, SKINNY_DEVICE_7961, SKINNY_DEVICE_7961GE, SKINNY_DEVICE_7970, SKINNY_DEVICE_7971, SKINNY_DEVICE_7985, SKINNY_DEVICE_ATA186, SKINNY_DEVICE_CIPC, SKINNY_DEVICE_SCCPGATEWAY_AN, SKINNY_DEVICE_SCCPGATEWAY_BRI, skinny_addon::type, and skinny_device::type.

Referenced by handle_button_template_req_message().

01052 {
01053    struct skinny_device *d = s->device;
01054    struct skinny_addon *a = d->addons;
01055    int i;
01056 
01057    switch (d->type) {
01058       case SKINNY_DEVICE_30SPPLUS:
01059       case SKINNY_DEVICE_30VIP:
01060          /* 13 rows, 2 columns */
01061          for (i = 0; i < 4; i++)
01062             (btn++)->buttonDefinition = BT_LINE;
01063          (btn++)->buttonDefinition = BT_REDIAL;
01064          (btn++)->buttonDefinition = BT_VOICEMAIL;
01065          (btn++)->buttonDefinition = BT_CALLPARK;
01066          (btn++)->buttonDefinition = BT_FORWARDALL;
01067          (btn++)->buttonDefinition = BT_CONFERENCE;
01068          for (i = 0; i < 4; i++)
01069             (btn++)->buttonDefinition = BT_NONE;
01070          for (i = 0; i < 13; i++)
01071             (btn++)->buttonDefinition = BT_SPEEDDIAL;
01072          
01073          break;
01074       case SKINNY_DEVICE_12SPPLUS:
01075       case SKINNY_DEVICE_12SP:
01076       case SKINNY_DEVICE_12:
01077          /* 6 rows, 2 columns */
01078          for (i = 0; i < 2; i++)
01079             (btn++)->buttonDefinition = BT_LINE;
01080          (btn++)->buttonDefinition = BT_REDIAL;
01081          for (i = 0; i < 3; i++)
01082             (btn++)->buttonDefinition = BT_SPEEDDIAL;
01083          (btn++)->buttonDefinition = BT_HOLD;
01084          (btn++)->buttonDefinition = BT_TRANSFER;
01085          (btn++)->buttonDefinition = BT_FORWARDALL;
01086          (btn++)->buttonDefinition = BT_CALLPARK;
01087          (btn++)->buttonDefinition = BT_VOICEMAIL;
01088          (btn++)->buttonDefinition = BT_CONFERENCE;
01089          break;
01090       case SKINNY_DEVICE_7910:
01091          (btn++)->buttonDefinition = BT_LINE;
01092          (btn++)->buttonDefinition = BT_HOLD;
01093          (btn++)->buttonDefinition = BT_TRANSFER;
01094          (btn++)->buttonDefinition = BT_DISPLAY;
01095          (btn++)->buttonDefinition = BT_VOICEMAIL;
01096          (btn++)->buttonDefinition = BT_CONFERENCE;
01097          (btn++)->buttonDefinition = BT_FORWARDALL;
01098          for (i = 0; i < 2; i++)
01099             (btn++)->buttonDefinition = BT_SPEEDDIAL;
01100          (btn++)->buttonDefinition = BT_REDIAL;
01101          break;
01102       case SKINNY_DEVICE_7960:
01103       case SKINNY_DEVICE_7961:
01104       case SKINNY_DEVICE_7961GE:
01105          for (i = 0; i < 6; i++)
01106             (btn++)->buttonDefinition = BT_CUST_LINESPEEDDIAL;
01107          break;
01108       case SKINNY_DEVICE_7940:
01109       case SKINNY_DEVICE_7941:
01110       case SKINNY_DEVICE_7941GE:
01111          for (i = 0; i < 2; i++)
01112             (btn++)->buttonDefinition = BT_CUST_LINESPEEDDIAL;
01113          break;
01114       case SKINNY_DEVICE_7935:
01115       case SKINNY_DEVICE_7936:
01116          for (i = 0; i < 2; i++)
01117             (btn++)->buttonDefinition = BT_LINE;
01118          break;
01119       case SKINNY_DEVICE_ATA186:
01120          (btn++)->buttonDefinition = BT_LINE;
01121          break;
01122       case SKINNY_DEVICE_7970:
01123       case SKINNY_DEVICE_7971:
01124       case SKINNY_DEVICE_CIPC:
01125          for (i = 0; i < 8; i++)
01126             (btn++)->buttonDefinition = BT_CUST_LINESPEEDDIAL;
01127          break;
01128       case SKINNY_DEVICE_7985:
01129          /* XXX I have no idea what the buttons look like on these. */
01130          ast_log(LOG_WARNING, "Unsupported device type '%d (7985)' found.\n", d->type);
01131          break;
01132       case SKINNY_DEVICE_7912:
01133       case SKINNY_DEVICE_7911:
01134       case SKINNY_DEVICE_7905:
01135          (btn++)->buttonDefinition = BT_LINE;
01136          (btn++)->buttonDefinition = BT_HOLD;
01137          break;
01138       case SKINNY_DEVICE_7920:
01139          /* XXX I don't know if this is right. */
01140          for (i = 0; i < 4; i++)
01141             (btn++)->buttonDefinition = BT_CUST_LINESPEEDDIAL;
01142          break;
01143       case SKINNY_DEVICE_7902:
01144          ast_log(LOG_WARNING, "Unsupported device type '%d (7902)' found.\n", d->type);
01145          break;
01146       case SKINNY_DEVICE_SCCPGATEWAY_AN:
01147       case SKINNY_DEVICE_SCCPGATEWAY_BRI:
01148          ast_log(LOG_WARNING, "Unsupported device type '%d (SCCP gateway)' found.\n", d->type);
01149          break;
01150       default:
01151          ast_log(LOG_WARNING, "Unknown device type '%d' found.\n", d->type);
01152          break;
01153    }
01154 
01155    for (a = d->addons; a; a = a->next) {
01156       if (!strcasecmp(a->type, "7914")) {
01157          for (i = 0; i < 14; i++)
01158             (btn++)->buttonDefinition = BT_CUST_LINESPEEDDIAL;
01159       } else {
01160          ast_log(LOG_WARNING, "Unknown addon type '%s' found.  Skipping.\n", a->type);
01161       }
01162    }
01163 
01164    return btn;
01165 }

static int get_input struct skinnysession s  )  [static]
 

Definition at line 4137 of file chan_skinny.c.

References ast_log(), ast_mutex_lock(), ast_mutex_unlock(), ast_verbose(), pollfd::events, pollfd::fd, htolel, letohl, LOG_WARNING, poll(), POLLIN, pollfd::revents, s, skinny_unregister(), and skinnydebug.

04138 {
04139    int res;
04140    int dlen = 0;
04141    struct pollfd fds[1];
04142 
04143    fds[0].fd = s->fd;
04144    fds[0].events = POLLIN;
04145    fds[0].revents = 0;
04146    res = poll(fds, 1, -1);
04147 
04148    if (res < 0) {
04149       if (errno != EINTR)
04150       {
04151          ast_log(LOG_WARNING, "Select returned error: %s\n", strerror(errno));
04152          return res;
04153       }
04154    }
04155    if (fds[0].revents) {
04156       ast_mutex_lock(&s->lock);
04157       memset(s->inbuf,0,sizeof(s->inbuf));
04158       res = read(s->fd, s->inbuf, 4);
04159       if (res < 0) {
04160          ast_log(LOG_WARNING, "read() returned error: %s\n", strerror(errno));
04161 
04162          if (skinnydebug)
04163             ast_verbose("Skinny Client was lost, unregistering\n");
04164          
04165          skinny_unregister(NULL,s);
04166          ast_mutex_unlock(&s->lock);
04167          return res;
04168       } else if (res != 4) {
04169          ast_log(LOG_WARNING, "Skinny Client sent less data than expected.  Expected 4 but got %d.\n", res);
04170          ast_mutex_unlock(&s->lock);
04171          
04172          if (res == 0) {
04173             if (skinnydebug)
04174                ast_verbose("Skinny Client was lost, unregistering\n");
04175             skinny_unregister(NULL, s);
04176          }
04177            
04178          return -1;
04179       }
04180       
04181       dlen = letohl(*(int *)s->inbuf);
04182       if (dlen < 0) {
04183          ast_log(LOG_WARNING, "Skinny Client sent invalid data.\n");
04184          ast_mutex_unlock(&s->lock);
04185          return -1;
04186       }
04187       if (dlen+8 > sizeof(s->inbuf)) {
04188          dlen = sizeof(s->inbuf) - 8;
04189       }
04190       *(int *)s->inbuf = htolel(dlen);
04191 
04192       res = read(s->fd, s->inbuf+4, dlen+4);
04193       ast_mutex_unlock(&s->lock);
04194       if (res < 0) {
04195          ast_log(LOG_WARNING, "read() returned error: %s\n", strerror(errno));
04196          return res;
04197       } else if (res != (dlen+4)) {
04198          ast_log(LOG_WARNING, "Skinny Client sent less data than expected.\n");
04199          return -1;
04200       }
04201       return res;
04202    }
04203    return 0;
04204 }

static int handle_alarm_message struct skinny_req req,
struct skinnysession s
[static]
 

Definition at line 3582 of file chan_skinny.c.

References skinny_data::alarm, ast_verbose(), skinny_req::data, alarm_message::displayMessage, and skinnydebug.

Referenced by handle_message().

03583 {
03584    /* no response necessary */
03585    if (skinnydebug)
03586       ast_verbose("Received Alarm Message: %s\n", req->data.alarm.displayMessage);
03587 
03588    return 1;
03589 }

static int handle_button_template_req_message struct skinny_req req,
struct skinnysession s
[static]
 

Definition at line 3446 of file chan_skinny.c.

References ast_verbose(), BT_CUST_LINESPEEDDIAL, BT_LINE, BT_NONE, BUTTON_TEMPLATE_RES_MESSAGE, button_definition::buttonDefinition, button_definition_template::buttonDefinition, skinny_data::buttontemplate, skinny_req::data, button_template_res_message::definition, get_button_template(), htolel, skinny_line::instance, button_definition::instanceNumber, skinny_device::lines, skinny_line::next, req_alloc(), and s.

Referenced by handle_message().

03447 {
03448    struct skinny_device *d = s->device;
03449    struct skinny_line *l;
03450    int i;
03451 
03452    struct skinny_speeddial *sd;
03453    struct button_definition_template btn[42];
03454    int lineInstance = 1;
03455    int speeddialInstance = 1;
03456    int buttonCount = 0;
03457 
03458    if (!(req = req_alloc(sizeof(struct button_template_res_message), BUTTON_TEMPLATE_RES_MESSAGE)))
03459       return -1;
03460 
03461    memset(&btn, 0, sizeof(btn));
03462 
03463    get_button_template(s, btn);
03464 
03465    for (i=0; i<42; i++) {
03466       int btnSet = 0;
03467       switch (btn[i].buttonDefinition) {
03468          case BT_CUST_LINESPEEDDIAL:
03469             /* assume failure */
03470             req->data.buttontemplate.definition[i].buttonDefinition = BT_NONE;
03471             req->data.buttontemplate.definition[i].instanceNumber = htolel(0);
03472 
03473             for (l = d->lines; l; l = l->next) {
03474                if (l->instance == lineInstance) {
03475                   ast_verbose("Adding button: %d, %d\n", BT_LINE, lineInstance);
03476                   req->data.buttontemplate.definition[i].buttonDefinition = BT_LINE;
03477                   req->data.buttontemplate.definition[i].instanceNumber = htolel(lineInstance);
03478                   lineInstance++;
03479                   buttonCount++;
03480                   btnSet = 1;
03481                   break;
03482                }
03483             }
03484 
03485             if (!btnSet) {
03486                for (sd = d->speeddials; sd; sd = sd->next) {
03487                   if (sd->instance == speeddialInstance) {
03488                      ast_verbose("Adding button: %d, %d\n", BT_SPEEDDIAL, speeddialInstance);
03489                      req->data.buttontemplate.definition[i].buttonDefinition = BT_SPEEDDIAL;
03490                      req->data.buttontemplate.definition[i].instanceNumber = htolel(speeddialInstance);
03491                      speeddialInstance++;
03492                      buttonCount++;
03493                      btnSet = 1;
03494                      break;
03495                   }
03496                }
03497             }
03498             break;
03499          case BT_LINE:
03500             req->data.buttontemplate.definition[i].buttonDefinition = htolel(BT_NONE);
03501             req->data.buttontemplate.definition[i].instanceNumber = htolel(0);
03502 
03503             for (l = d->lines; l; l = l->next) {
03504                if (l->instance == lineInstance) {
03505                   ast_verbose("Adding button: %d, %d\n", BT_LINE, lineInstance);
03506                   req->data.buttontemplate.definition[i].buttonDefinition = BT_LINE;
03507                   req->data.buttontemplate.definition[i].instanceNumber = htolel(lineInstance);
03508                   lineInstance++;
03509                   buttonCount++;
03510                   btnSet = 1;
03511                   break;
03512                }
03513             }
03514             break;
03515          case BT_SPEEDDIAL:
03516             req->data.buttontemplate.definition[i].buttonDefinition = BT_NONE;
03517             req->data.buttontemplate.definition[i].instanceNumber = 0;
03518 
03519             for (sd = d->speeddials; sd; sd = sd->next) {
03520                if (sd->instance == speeddialInstance) {
03521                   ast_verbose("Adding button: %d, %d\n", BT_SPEEDDIAL, speeddialInstance);
03522                   req->data.buttontemplate.definition[i].buttonDefinition = BT_SPEEDDIAL;
03523                   req->data.buttontemplate.definition[i].instanceNumber = htolel(speeddialInstance);
03524                   speeddialInstance++;
03525                   buttonCount++;
03526                   btnSet = 1;
03527                   break;
03528                }
03529             }
03530             break;
03531          case BT_CUST_HINT:
03532             break;
03533          case BT_NONE:
03534             break;
03535          default:
03536             ast_verbose("Adding button: %d, %d\n", btn[i].buttonDefinition, 0);
03537             req->data.buttontemplate.definition[i].buttonDefinition = htolel(btn[i].buttonDefinition);
03538             req->data.buttontemplate.definition[i].instanceNumber = htolel(0);
03539             buttonCount++;
03540             btnSet = 1;
03541             break;
03542       }
03543    }
03544 
03545    req->data.buttontemplate.buttonOffset = htolel(0);
03546    req->data.buttontemplate.buttonCount = htolel(buttonCount);
03547    req->data.buttontemplate.totalButtonCount = htolel(buttonCount);
03548 
03549    if (skinnydebug)
03550       ast_verbose("Sending %d template to %s\n",
03551                d->type,
03552                d->name);
03553    transmit_response(s, req);
03554    return 1;
03555 }

static int handle_capabilities_res_message struct skinny_req req,
struct skinnysession s
[static]
 

Definition at line 3339 of file chan_skinny.c.

References ast_verbose(), capabilities_res_message::caps, skinny_data::caps, station_capabilities::codec, codec_skinny2ast(), capabilities_res_message::count, skinny_req::data, letohl, s, and skinnydebug.

Referenced by handle_message().

03340 {
03341    struct skinny_device *d = s->device;
03342    struct skinny_line *l;
03343    int count = 0;
03344    int codecs = 0;
03345    int i;
03346 
03347    count = letohl(req->data.caps.count);
03348 
03349    for (i = 0; i < count; i++) {
03350       int acodec = 0;
03351       int scodec = 0;
03352       scodec = letohl(req->data.caps.caps[i].codec);
03353       acodec = codec_skinny2ast(scodec);
03354       if (skinnydebug)
03355          ast_verbose("Adding codec capability '%d (%d)'\n", acodec, scodec);
03356       codecs |= acodec;
03357    }
03358 
03359    d->capability &= codecs;
03360    ast_verbose("Device capability set to '%d'\n", d->capability);
03361    for (l = d->lines; l; l = l->next) {
03362       ast_mutex_lock(&l->lock);
03363       l->capability = d->capability;
03364       ast_mutex_unlock(&l->lock);
03365    }
03366 
03367    return 1;
03368 }

static int handle_headset_status_message struct skinny_req req,
struct skinnysession s
[static]
 

Definition at line 3973 of file chan_skinny.c.

Referenced by handle_message().

03974 {
03975    /* XXX umm...okay?  Why do I care? */
03976    return 1;
03977 }

static int handle_ip_port_message struct skinny_req req,
struct skinnysession s
[static]
 

Definition at line 2903 of file chan_skinny.c.

Referenced by handle_message().

02904 {
02905    /* no response necessary */
02906    return 1;
02907 }