Asterisk - The Open Source Telephony Project  21.4.1
Data Structures | Macros | Enumerations | Functions | Variables
chan_unistim.c File Reference

chan_unistim channel driver for Asterisk More...

#include "asterisk.h"
#include <sys/stat.h>
#include <signal.h>
#include "asterisk/paths.h"
#include "asterisk/network.h"
#include "asterisk/channel.h"
#include "asterisk/config.h"
#include "asterisk/module.h"
#include "asterisk/pbx.h"
#include "asterisk/rtp_engine.h"
#include "asterisk/unaligned.h"
#include "asterisk/netsock2.h"
#include "asterisk/acl.h"
#include "asterisk/callerid.h"
#include "asterisk/cli.h"
#include "asterisk/app.h"
#include "asterisk/mwi.h"
#include "asterisk/musiconhold.h"
#include "asterisk/causes.h"
#include "asterisk/indications.h"
#include "asterisk/pickup.h"
#include "asterisk/astobj2.h"
#include "asterisk/astdb.h"
#include "asterisk/features_config.h"
#include "asterisk/bridge.h"
#include "asterisk/stasis_channels.h"
#include "asterisk/format_cache.h"

Go to the source code of this file.

Data Structures

struct  unistim_device
 A device containing one or more lines. More...
 
struct  unistim_languages
 
struct  unistim_line
 
struct  unistim_menu_item
 
struct  unistim_subchannel
 
struct  unistimsession
 
struct  ustm_lang_entry
 
struct  wsabuf
 

Macros

#define AST_CONFIG_MAX_PATH   255
 
#define BUFFSEND   unsigned char buffsend[64] = { 0x00, 0x00, 0xaa, 0xbb, 0x02, 0x01 }
 
#define DEBUG_TIMER   dummy
 
#define DEFAULT_CODEC   0x00
 
#define DEFAULT_INTERDIGIT_TIMER   4000
 
#define DEFAULTCALLERID   "Unknown"
 
#define DEFAULTCALLERNAME   " "
 
#define DEFAULTCONTEXT   "default"
 
#define DEFAULTHEIGHT   3
 
#define DEVICE_NAME_LEN   16
 
#define EXPNUM   24
 
#define FAV_BLINK_FAST   0x20
 
#define FAV_BLINK_SLOW   0x40
 
#define FAV_ICON_BOX   0x3F
 
#define FAV_ICON_CALL_CENTER   0x34
 
#define FAV_ICON_CITY   0x31
 
#define FAV_ICON_COMPUTER   0x38
 
#define FAV_ICON_FAX   0x35
 
#define FAV_ICON_FORWARD   0x39
 
#define FAV_ICON_HEADPHONES   0x2E
 
#define FAV_ICON_HEADPHONES_ONHOLD   0x2F
 
#define FAV_ICON_HOME   0x30
 
#define FAV_ICON_INBOX   0x3C
 
#define FAV_ICON_LOCKED   0x3A
 
#define FAV_ICON_MAILBOX   0x36
 
#define FAV_ICON_MEETING   0x3E
 
#define FAV_ICON_NONE   0x00
 
#define FAV_ICON_OFFHOOK_BLACK   0x24
 
#define FAV_ICON_OFFHOOK_WHITE   0x25
 
#define FAV_ICON_ONHOLD_BLACK   0x26
 
#define FAV_ICON_ONHOLD_WHITE   0x27
 
#define FAV_ICON_ONHOOK_BLACK   0x20
 
#define FAV_ICON_ONHOOK_WHITE   0x21
 
#define FAV_ICON_OUTBOX   0x3D
 
#define FAV_ICON_PAGER   0x33
 
#define FAV_ICON_PHONE_BLACK   0x2A
 
#define FAV_ICON_PHONE_WHITE   0x2B
 
#define FAV_ICON_REFLECT   0x37
 
#define FAV_ICON_SHARP   0x32
 
#define FAV_ICON_SPEAKER_OFFHOOK_BLACK   0x28
 
#define FAV_ICON_SPEAKER_OFFHOOK_WHITE   0x29
 
#define FAV_ICON_SPEAKER_ONHOLD_BLACK   0x2C
 
#define FAV_ICON_SPEAKER_ONHOLD_WHITE   0x2D
 
#define FAV_ICON_SPEAKER_ONHOOK_BLACK   0x22
 
#define FAV_ICON_SPEAKER_ONHOOK_WHITE   0x23
 
#define FAV_ICON_TRASH   0x3B
 
#define FAV_LINE_ICON   FAV_ICON_ONHOOK_BLACK
 
#define FAV_MAX_LENGTH   0x0A
 
#define FAVNUM   6
 
#define IDLE_WAIT   1000
 
#define LED_BAR_OFF   0x00 /* bar off */
 
#define LED_BAR_ON   0x01 /* bar on */
 
#define LED_BAR_P2   0x02 /* bar 1s on/1s */
 
#define LED_BAR_P3   0x03 /* bar 2.5s on/0.5s off */
 
#define LED_BAR_P4   0x04 /* bar 0.6s on/0.3s off */
 
#define LED_BAR_P5   0x05 /* bar 0.5s on/0.5s off */
 
#define LED_BAR_P6   0x06 /* bar 2s on/0.5s off */
 
#define LED_BAR_P7   0x07 /* bar off */
 
#define LED_HEADPHONE_OFF   0x010
 
#define LED_HEADPHONE_ON   0x011
 
#define LED_MUTE_BLINK   0x1A
 
#define LED_MUTE_OFF   0x018
 
#define LED_MUTE_ON   0x019
 
#define LED_SPEAKER_OFF   0x08
 
#define LED_SPEAKER_ON   0x09
 
#define MAX_BUF_NUMBER   150
 
#define MAX_BUF_SIZE   64
 
#define MAX_ENTRY_LOG   30
 
#define MAX_SCREEN_NUMBER   15
 
#define MONTH_LABEL_SIZE   3
 
#define MUTE_OFF   0x00
 
#define MUTE_ON   0xFF
 
#define MUTE_ON_DISCRET   0xCE
 
#define NB_MAX_RETRANSMIT   8
 
#define OUTPUT_HANDSET   0xC0
 
#define OUTPUT_HEADPHONE   0xC1
 
#define OUTPUT_SPEAKER   0xC2
 
#define RETRANSMIT_TIMER   2000
 
#define SELECTCODEC_MAX_LENGTH   2
 
#define SELECTCODEC_MSG   "Codec number : .."
 
#define SELECTCODEC_START_ENTRY_POS   15
 
#define SELECTEXTENSION_MAX_LENGTH   10
 
#define SELECTEXTENSION_MSG   ".........."
 
#define SELECTEXTENSION_START_ENTRY_POS   0
 
#define SIZE_HEADER   6
 
#define SIZE_MAC_ADDR   17
 
#define SIZE_PAGE   4096
 
#define STATUS_LENGTH_MAX   28
 
#define SUB_REAL   0
 
#define SUB_RING   1
 
#define SUB_THREEWAY   2
 
#define TEXT_INVERSE   0x25
 
#define TEXT_LENGTH_MAX   24
 
#define TEXT_LINE0   0x00
 
#define TEXT_LINE1   0x20
 
#define TEXT_LINE2   0x40
 
#define TEXT_NORMAL   0x05
 
#define TIMER_MWI   5000
 
#define USTM_LANG_DIR   "unistimLang"
 
#define USTM_LOG_DIR   "unistimHistory"
 
#define VOLUME_INSANELY_LOUD   0x07
 
#define VOLUME_LOW   0x01
 
#define VOLUME_LOW_SPEAKER   0x03
 
#define VOLUME_NORMAL   0x02
 

Enumerations

enum  autoprov_extn { EXTENSION_NONE = 0, EXTENSION_ASK, EXTENSION_LINE, EXTENSION_TN }
 
enum  autoprovision { AUTOPROVISIONING_NO = 0, AUTOPROVISIONING_YES, AUTOPROVISIONING_TN }
 
enum  charset {
  LANG_DEFAULT, ISO_8859_1, ISO_8859_2, ISO_8859_4,
  ISO_8859_5, ISO_2022_JP
}
 
enum  handset_state { STATE_ONHOOK, STATE_OFFHOOK }
 
enum  phone_key {
  KEY_0 = 0x40, KEY_1 = 0x41, KEY_2 = 0x42, KEY_3 = 0x43,
  KEY_4 = 0x44, KEY_5 = 0x45, KEY_6 = 0x46, KEY_7 = 0x47,
  KEY_8 = 0x48, KEY_9 = 0x49, KEY_STAR = 0x4a, KEY_SHARP = 0x4b,
  KEY_UP = 0x4c, KEY_DOWN = 0x4d, KEY_RIGHT = 0x4e, KEY_LEFT = 0x4f,
  KEY_QUIT = 0x50, KEY_COPY = 0x51, KEY_FUNC1 = 0x54, KEY_FUNC2 = 0x55,
  KEY_FUNC3 = 0x56, KEY_FUNC4 = 0x57, KEY_ONHOLD = 0x5b, KEY_HANGUP = 0x5c,
  KEY_MUTE = 0x5d, KEY_HEADPHN = 0x5e, KEY_LOUDSPK = 0x5f, KEY_FAV0 = 0x60,
  KEY_FAV1 = 0x61, KEY_FAV2 = 0x62, KEY_FAV3 = 0x63, KEY_FAV4 = 0x64,
  KEY_FAV5 = 0x65, KEY_COMPUTR = 0x7b, KEY_CONF = 0x7c, KEY_SNDHIST = 0x7d,
  KEY_RCVHIST = 0x7e, KEY_INDEX = 0x7f
}
 
enum  phone_state {
  STATE_INIT, STATE_AUTHDENY, STATE_MAINPAGE, STATE_EXTENSION,
  STATE_DIALPAGE, STATE_RINGING, STATE_CALL, STATE_SELECTOPTION,
  STATE_SELECTCODEC, STATE_SELECTLANGUAGE, STATE_CLEANING, STATE_HISTORY
}
 

Functions

static void __reg_module (void)
 
static void __unreg_module (void)
 
struct ast_moduleAST_MODULE_SELF_SYM (void)
 
static int attempt_transfer (struct unistim_subchannel *p1, struct unistim_subchannel *p2)
 
static struct unistim_devicebuild_device (const char *cat, const struct ast_variable *v)
 
static void change_callerid (struct unistimsession *pte, int type, char *callerid)
 
static void change_favorite_icon (struct unistimsession *pte, unsigned char status)
 
static struct unistimsessionchannel_to_session (struct ast_channel *ast)
 
static void check_send_queue (struct unistimsession *pte)
 
static void close_call (struct unistimsession *pte)
 
static void close_client (struct unistimsession *s)
 
static char * control2str (int ind)
 
static struct unistimsessioncreate_client (const struct sockaddr_in *addr_from)
 
static void delete_device (struct unistim_device *d)
 
static void discard_call (struct unistimsession *pte)
 
static void display_last_error (const char *sz_msg)
 
static void * do_monitor (void *data)
 
static void dummy (char *unused,...)
 
static int find_language (const char *)
 
static struct unistim_linefind_line_by_number (struct unistim_device *d, const char *val)
 
static int find_rtp_port (struct unistim_subchannel *s)
 
static struct unistim_subchannelfind_subchannel_by_name (const char *dest)
 
static void finish_bookmark (void)
 
static int get_active_softkey (struct unistimsession *pte)
 
static int get_avail_softkey (struct unistimsession *pte, const char *name)
 
static struct unistim_subchannelget_sub (struct unistim_device *device, int type)
 
static struct unistim_subchannelget_sub_holding (struct unistim_device *device, int type, int holding)
 
static unsigned int get_tick_count (void)
 
static int get_to_address (int fd, struct sockaddr_in *toAddr)
 
static void handle_call_incoming (struct unistimsession *s)
 
static void handle_call_outgoing (struct unistimsession *s)
 
static void handle_dial_page (struct unistimsession *pte)
 
static void handle_key_fav (struct unistimsession *pte, char keycode)
 
static void handle_select_codec (struct unistimsession *)
 
static void handle_select_language (struct unistimsession *)
 
static void handle_select_option (struct unistimsession *pte)
 
static void ignore_call (struct unistimsession *pte)
 
static void in_band_indication (struct ast_channel *ast, const struct ast_tone_zone *tz, const char *indication)
 
static void init_phone_step2 (struct unistimsession *pte)
 
static int is_key_favorite (struct unistim_device *d, int fav)
 
static int is_key_line (struct unistim_device *d, int fav)
 
static void key_call (struct unistimsession *pte, char keycode)
 
static void key_dial_page (struct unistimsession *pte, char keycode)
 
static void key_favorite (struct unistimsession *, char)
 
static void key_history (struct unistimsession *pte, char keycode)
 
static void key_main_page (struct unistimsession *pte, char keycode)
 
static void key_ringing (struct unistimsession *pte, char keycode)
 
static void key_select_codec (struct unistimsession *pte, char keycode)
 
static void key_select_extension (struct unistimsession *pte, char keycode)
 
static void key_select_language (struct unistimsession *pte, char keycode)
 
static void key_select_option (struct unistimsession *pte, char keycode)
 
static int lang_cmp_fn (void *obj, void *arg, int flags)
 
static int lang_hash_fn (const void *obj, const int flags)
 
static int load_module (void)
 
static void microphone_mute_toggle (struct unistimsession *pte)
 
static char open_history (struct unistimsession *pte, char way, FILE **f)
 
static int parse_bookmark (const char *text, struct unistim_device *d)
 
static void parsing (int size, unsigned char *buf, struct unistimsession *pte, struct sockaddr_in *addr_from)
 
static void process_request (int size, unsigned char *buf, struct unistimsession *pte)
 
static const char * ptestate_tostr (const int type)
 
static void rcv_mac_addr (struct unistimsession *pte, const unsigned char *buf)
 
static void rcv_resume_connection_with_server (struct unistimsession *pte)
 
static void refresh_all_favorite (struct unistimsession *pte)
 
static int register_extension (const struct unistimsession *pte)
 
static int reload (void)
 
static int reload_config (void)
 
static int restart_monitor (void)
 
static void send_blink_cursor (struct unistimsession *pte)
 
static void send_callerid_screen (struct unistimsession *, struct unistim_subchannel *)
 
static void send_charset_update (struct unistimsession *pte, int charset)
 
static void send_client (int size, const unsigned char *data, struct unistimsession *pte)
 
static void send_cursor_pos (struct unistimsession *pte, unsigned char pos)
 
static void send_date_time (struct unistimsession *pte)
 
static void send_date_time2 (struct unistimsession *pte)
 
static void send_date_time3 (struct unistimsession *pte)
 
static void send_dial_tone (struct unistimsession *pte)
 
static int send_dtmf_tone (struct unistimsession *pte, char digit)
 
static void send_end_call (struct unistimsession *pte)
 
static void send_expansion_icon (unsigned char pos, unsigned char status, struct unistimsession *pte)
 
static void send_expansion_next (struct unistimsession *pte)
 
static void send_expansion_short (unsigned char pos, unsigned char status, struct unistimsession *pte)
 
static void send_expansion_text (unsigned char pos, struct unistimsession *pte, const char *text)
 
static void send_favorite (unsigned char pos, unsigned char status, struct unistimsession *pte, const char *text)
 
static void send_favorite_selected (unsigned char status, struct unistimsession *pte)
 
static void send_favorite_short (unsigned char pos, unsigned char status, struct unistimsession *pte)
 
static void send_icon (unsigned char pos, unsigned char status, struct unistimsession *pte)
 
static void send_idle_clock (struct unistimsession *pte)
 
static void send_led_update (struct unistimsession *pte, unsigned char led)
 
static void send_month_labels (struct unistimsession *pte, int month)
 
static void send_mute (struct unistimsession *pte, unsigned char mute)
 
static void send_no_ring (struct unistimsession *pte)
 
static void send_ping (struct unistimsession *pte)
 
static void send_raw_client (int size, const unsigned char *data, struct sockaddr_in *addr_to, const struct sockaddr_in *addr_ourip)
 
static int send_retransmit (struct unistimsession *pte)
 
static void send_ring (struct unistimsession *pte, signed char volume, signed char style)
 
static void send_select_output (struct unistimsession *pte, unsigned char output, unsigned char volume, unsigned char mute)
 
static void send_start_rtp (struct unistim_subchannel *)
 
static void send_start_timer (struct unistimsession *pte)
 
static void send_stop_timer (struct unistimsession *pte)
 
static void send_text (unsigned char pos, unsigned char inverse, struct unistimsession *pte, const char *text)
 
static void send_text_status (struct unistimsession *pte, const char *text)
 
static void send_texttitle (struct unistimsession *pte, const char *text)
 
static void send_tone (struct unistimsession *pte, uint16_t tone1, uint16_t tone2)
 
static void set_ping_timer (struct unistimsession *pte)
 
static void show_entry_history (struct unistimsession *pte, FILE **f)
 
static void show_extension_page (struct unistimsession *pte)
 
static void show_history (struct unistimsession *pte, char way)
 
static void show_main_page (struct unistimsession *pte)
 
static void show_phone_number (struct unistimsession *pte)
 
static int soft_key_visible (struct unistim_device *d, unsigned char num)
 
static void start_rtp (struct unistim_subchannel *sub)
 
static void sub_hold (struct unistimsession *pte, struct unistim_subchannel *sub)
 
static void sub_start_silence (struct unistimsession *pte, struct unistim_subchannel *sub)
 
static void sub_stop_silence (struct unistimsession *pte, struct unistim_subchannel *sub)
 
static void sub_unhold (struct unistimsession *pte, struct unistim_subchannel *sub)
 
static const char * subtype_tostr (const int type)
 
static void swap_subs (struct unistim_subchannel *a, struct unistim_subchannel *b)
 
static void transfer_call_step1 (struct unistimsession *pte)
 
static void transfer_cancel_step2 (struct unistimsession *pte)
 
static struct unistim_subchannelunistim_alloc_sub (struct unistim_device *d, int x)
 
static int unistim_answer (struct ast_channel *ast)
 
static int unistim_call (struct ast_channel *ast, const char *dest, int timeout)
 
static char * unistim_do_debug (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 
static int unistim_do_senddigit (struct unistimsession *pte, char digit)
 
static int unistim_fixup (struct ast_channel *oldchan, struct ast_channel *newchan)
 
static int unistim_free_sub (struct unistim_subchannel *)
 
static enum ast_rtp_glue_result unistim_get_rtp_peer (struct ast_channel *chan, struct ast_rtp_instance **instance)
 
static int unistim_hangup (struct ast_channel *ast)
 
static int unistim_hangup_clean (struct ast_channel *ast, struct unistim_subchannel *sub)
 
static int unistim_indicate (struct ast_channel *ast, int ind, const void *data, size_t datalen)
 
static struct unistim_lineunistim_line_alloc (void)
 
static void unistim_line_copy (struct unistim_line *dst, struct unistim_line *src)
 
static struct unistim_lineunistim_line_destroy (struct unistim_line *l)
 
static struct ast_channelunistim_new (struct unistim_subchannel *sub, int state, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor)
 
static struct ast_frameunistim_read (struct ast_channel *ast)
 
static int unistim_register (struct unistimsession *s)
 
static char * unistim_reload (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 — unistim_reload: Force reload of module from cli — Runs in the asterisk main thread, so don't do anything useful but setting a flag and waiting for do_monitor to do the job in our thread
 
static struct ast_channelunistim_request (const char *type, struct ast_format_cap *cap, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *dest, int *cause)
 
static struct ast_frameunistim_rtp_read (const struct ast_channel *ast, const struct unistim_subchannel *sub)
 
static int unistim_send_mwi_to_peer (struct unistim_line *peer, unsigned int tick)
 
static int unistim_senddigit_begin (struct ast_channel *ast, char digit)
 
static int unistim_senddigit_end (struct ast_channel *ast, char digit, unsigned int duration)
 
static int unistim_sendtext (struct ast_channel *ast, const char *text)
 
static void unistim_set_owner (struct unistim_subchannel *sub, struct ast_channel *chan)
 
static int unistim_set_rtp_peer (struct ast_channel *chan, struct ast_rtp_instance *rtp, struct ast_rtp_instance *vrtp, struct ast_rtp_instance *trtp, const struct ast_format_cap *codecs, int nat_active)
 
static char * unistim_show_devices (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 
static char * unistim_show_info (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 
static char * unistim_sp (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 
static void * unistim_ss (void *data)
 
static int unistim_unalloc_sub (struct unistim_device *d, struct unistim_subchannel *sub)
 
static int unistim_write (struct ast_channel *ast, struct ast_frame *frame)
 
static int unistimsock_read (int *id, int fd, short events, void *ignore)
 
static int unload_module (void)
 
static void unquote (char *out, const char *src, int maxlen)
 
static int unregister_extension (const struct unistimsession *pte)
 
static const char * ustmtext (const char *str, struct unistimsession *pte)
 
static int write_entry_history (struct unistimsession *pte, FILE *f, char c, char *line1)
 
static int write_history (struct unistimsession *pte, char way, char ismissed)
 

Variables

static struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .description = "UNISTIM Protocol (USTM)" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = "da6642af068ee5e6490c5b1d2cc1d238" , .support_level = AST_MODULE_SUPPORT_EXTENDED, .load = load_module, .unload = unload_module, .reload = reload, }
 
static const struct ast_module_infoast_module_info = &__mod_info
 
static enum autoprovision autoprovisioning = AUTOPROVISIONING_NO
 
static unsigned char * buff
 
static const char channel_type [] = "USTM"
 
static struct ast_jb_conf default_jbconf
 Global jitterbuffer configuration - by default, jb is disabled. More...
 
static ast_mutex_t devicelock = { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP , NULL, {1, 0} }
 
static struct unistim_devicedevices = NULL
 
static const float dtmf_col [] = { 1209, 1336, 1477, 1633 }
 
static const int dtmf_row [] = { 697, 770, 852, 941 }
 
struct ast_format_capglobal_cap
 
static struct ast_jb_conf global_jbconf
 
static struct io_contextio
 
static pthread_t monitor_thread = AST_PTHREADT_NULL
 
static ast_mutex_t monlock = { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP , NULL, {1, 0} }
 
static unsigned char monthlabels []
 
static struct unistim_languages options_languages []
 
static struct unistim_menu_item options_menu []
 
static const unsigned char packet_rcv_discovery []
 
static const unsigned char packet_recv_expansion_pressed_key []
 
static const unsigned char packet_recv_firm_version []
 
static const unsigned char packet_recv_hangup []
 
static const unsigned char packet_recv_it_type []
 
static const unsigned char packet_recv_mac_addr []
 
static const unsigned char packet_recv_pick_up []
 
static const unsigned char packet_recv_pressed_key []
 
static const unsigned char packet_recv_r2 [] = { 0x00, 0x00, 0x00, 0x13, 0x96, 0x03, 0x03 }
 
static const unsigned char packet_recv_resume_connection_with_server []
 
static const unsigned char packet_send_arrow [] = { 0x17, 0x04, 0x04, 0x00 }
 
static const unsigned char packet_send_blink_cursor [] = { 0x17, 0x04, 0x10, 0x86 }
 
static const unsigned char packet_send_call []
 
static const unsigned char packet_send_charset_iso_2022_jp []
 
static const unsigned char packet_send_charset_iso_8859_1 []
 
static const unsigned char packet_send_charset_iso_8859_2 []
 
static const unsigned char packet_send_charset_iso_8859_4 []
 
static const unsigned char packet_send_charset_iso_8859_5 []
 
static const unsigned char packet_send_Contrast []
 
static const unsigned char packet_send_date_time []
 
static const unsigned char packet_send_date_time2 []
 
static const unsigned char packet_send_date_time3 []
 
static const unsigned char packet_send_discovery_ack []
 
static const unsigned char packet_send_end_call []
 
static const unsigned char packet_send_expansion_icon [] = { 0x09, 0x06, 0x59, 0x05, 0x47, 0x20 }
 
static const unsigned char packet_send_expansion_next [] = { 0x09, 0x03, 0x17 }
 
static const unsigned char packet_send_expansion_text []
 
static const unsigned char packet_send_favorite []
 
static const unsigned char packet_send_icon [] = { 0x17, 0x05, 0x14, 0x00, 0x25 }
 
static const unsigned char packet_send_jitter_buffer_conf []
 
static const unsigned char packet_send_led_update [] = { 0x19, 0x04, 0x00, 0x00 }
 
static unsigned char packet_send_monthlabels_download []
 
static const unsigned char packet_send_mute [] = { 0x16, 0x05, 0x04, 0x00, 0x00 }
 
static const unsigned char packet_send_no_ring []
 
static const unsigned char packet_send_open_audio_stream_rx []
 
static const unsigned char packet_send_open_audio_stream_rx3 []
 
static const unsigned char packet_send_open_audio_stream_tx []
 
static const unsigned char packet_send_open_audio_stream_tx3 []
 
static unsigned char packet_send_ping []
 
static const unsigned char packet_send_query_basic_manager_04 [] = { 0x1a, 0x04, 0x01, 0x04 }
 
static const unsigned char packet_send_query_basic_manager_10 [] = { 0x1a, 0x04, 0x01, 0x10 }
 
static const unsigned char packet_send_query_mac_address [] = { 0x1a, 0x04, 0x01, 0x08 }
 
static const unsigned char packet_send_ring []
 
static const unsigned char packet_send_rtp_packet_size []
 
static const unsigned char packet_send_S1 [] = { 0x1a, 0x07, 0x07, 0x00, 0x00, 0x00, 0x13 }
 
static const unsigned char packet_send_s4 []
 
static const unsigned char packet_send_S7 [] = { 0x17, 0x06, 0x0f, 0x30, 0x07, 0x07 }
 
static const unsigned char packet_send_s9 []
 
static const unsigned char packet_send_select_output []
 
static const unsigned char packet_send_set_pos_cursor []
 
static const unsigned char packet_send_start_timer []
 
static const unsigned char packet_send_status []
 
static const unsigned char packet_send_status2 []
 
static const unsigned char packet_send_stop_timer [] = { 0x17, 0x05, 0x0b, 0x02, 0x00 }
 
static const unsigned char packet_send_stream_based_tone_dual_freq []
 
static const unsigned char packet_send_stream_based_tone_off []
 
static const unsigned char packet_send_stream_based_tone_on []
 
static const unsigned char packet_send_stream_based_tone_single_freq []
 
static const unsigned char packet_send_text []
 
static const unsigned char packet_send_title []
 
static struct sockaddr_in public_ip = { 0, }
 
struct {
   unsigned int   cos
 
   unsigned int   cos_audio
 
   unsigned int   tos
 
   unsigned int   tos_audio
 
qos = { 0, 0, 0, 0 }
 
static struct ast_sched_contextsched
 
static ast_mutex_t sessionlock = { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP , NULL, {1, 0} }
 
static struct unistimsessionsessions = NULL
 
static const char tdesc [] = "UNISTIM Channel Driver"
 
static struct ast_cli_entry unistim_cli []
 
static int unistim_keepalive
 
static int unistim_port
 
static ast_mutex_t unistim_reload_lock = { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP , NULL, {1, 0} }
 
static int unistim_reloading = 0
 
static struct ast_rtp_glue unistim_rtp_glue
 
static struct ast_channel_tech unistim_tech
 
static int unistimdebug = 0
 
static int unistimsock = -1
 
static char ustm_strcopy [1024]
 

Detailed Description

chan_unistim channel driver for Asterisk

Author
Cedric Hans cedri.nosp@m.c.ha.nosp@m.ns@ml.nosp@m.kj.n.nosp@m.et

Unistim (Unified Networks IP Stimulus) channel driver for Nortel i2002, i2004 and i2050

Definition in file chan_unistim.c.

Macro Definition Documentation

#define DEFAULT_CODEC   0x00

Not used

Definition at line 110 of file chan_unistim.c.

#define DEFAULT_INTERDIGIT_TIMER   4000

Timeout value for entered number being dialed

Definition at line 107 of file chan_unistim.c.

#define IDLE_WAIT   1000

Nb of milliseconds waited when no events are scheduled

Definition at line 101 of file chan_unistim.c.

#define MAX_BUF_NUMBER   150

Number of slots for the transmit queue

Definition at line 93 of file chan_unistim.c.

#define MAX_BUF_SIZE   64

Size of the transmit buffer

Definition at line 91 of file chan_unistim.c.

#define MAX_SCREEN_NUMBER   15

Number of digits displayed on screen

Definition at line 95 of file chan_unistim.c.

#define MONTH_LABEL_SIZE   3

Length of month label size

Definition at line 97 of file chan_unistim.c.

#define NB_MAX_RETRANSMIT   8

Try x times before removing the phone

Definition at line 99 of file chan_unistim.c.

#define RETRANSMIT_TIMER   2000

Wait x milliseconds before resending a packet

Definition at line 103 of file chan_unistim.c.

#define TIMER_MWI   5000

How often the mailbox is checked for new messages

Definition at line 105 of file chan_unistim.c.

Enumeration Type Documentation

Enumerator
EXTENSION_NONE 

Do not create an extension into the default dialplan

EXTENSION_ASK 

Prompt user for an extension number and register it

EXTENSION_LINE 

Register an extension with the line=> value

EXTENSION_TN 

Used with AUTOPROVISIONING_TN

Definition at line 128 of file chan_unistim.c.

128  {
129  /*! Do not create an extension into the default dialplan */
130  EXTENSION_NONE = 0,
131  /*! Prompt user for an extension number and register it */
133  /*! Register an extension with the line=> value */
135  /*! Used with AUTOPROVISIONING_TN */
137 };

Function Documentation

int load_module ( void  )
static

XXX

Todo:
Leaking anything allocated by reload_config() ...

Definition at line 7080 of file chan_unistim.c.

References ao2_ref, ast_channel_register(), ast_cli_register_multiple, ast_format_alaw, ast_format_cap_alloc, ast_format_cap_append, ast_format_cap_append_from_cap(), AST_FORMAT_CAP_FLAG_DEFAULT, ast_format_ulaw, ast_malloc, AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, ast_sched_context_create(), ast_sched_context_destroy(), ast_channel_tech::capabilities, io_context_create(), and io_context_destroy().

7081 {
7082  int res;
7083 
7084  if (!(global_cap = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT))) {
7085  goto buff_failed;
7086  }
7088  goto buff_failed;
7089  }
7090 
7091  ast_format_cap_append(global_cap, ast_format_ulaw, 0);
7092  ast_format_cap_append(global_cap, ast_format_alaw, 0);
7093  ast_format_cap_append_from_cap(unistim_tech.capabilities, global_cap, AST_MEDIA_TYPE_AUDIO);
7094 
7095  if (!(buff = ast_malloc(SIZE_PAGE))) {
7096  goto buff_failed;
7097  }
7098 
7099  io = io_context_create();
7100  if (!io) {
7101  ast_log(LOG_ERROR, "Failed to allocate IO context\n");
7102  goto io_failed;
7103  }
7104 
7106  if (!sched) {
7107  ast_log(LOG_ERROR, "Failed to allocate scheduler context\n");
7108  goto sched_failed;
7109  }
7110 
7111  res = reload_config();
7112  if (res) {
7113  ao2_ref(unistim_tech.capabilities, -1);
7114  ao2_ref(global_cap, -1);
7116  io_context_destroy(io);
7117  return AST_MODULE_LOAD_DECLINE;
7118  }
7119  /* Make sure we can register our unistim channel type */
7120  if (ast_channel_register(&unistim_tech)) {
7121  ast_log(LOG_ERROR, "Unable to register channel type '%s'\n", channel_type);
7122  goto chanreg_failed;
7123  }
7124 
7125  ast_rtp_glue_register(&unistim_rtp_glue);
7126 
7127  ast_cli_register_multiple(unistim_cli, ARRAY_LEN(unistim_cli));
7128 
7129  restart_monitor();
7130 
7131  return AST_MODULE_LOAD_SUCCESS;
7132 
7133 chanreg_failed:
7134  /*! XXX \todo Leaking anything allocated by reload_config() ... */
7136  sched = NULL;
7137 sched_failed:
7138  io_context_destroy(io);
7139  io = NULL;
7140 io_failed:
7141  ast_free(buff);
7142  buff = NULL;
7143 buff_failed:
7144  ao2_cleanup(global_cap);
7145  global_cap = NULL;
7146  ao2_cleanup(unistim_tech.capabilities);
7147  unistim_tech.capabilities = NULL;
7148  return AST_MODULE_LOAD_DECLINE;
7149 }
struct ast_format * ast_format_ulaw
Built-in cached ulaw format.
Definition: format_cache.c:86
Definition: sched.c:76
#define ast_cli_register_multiple(e, len)
Register multiple commands.
Definition: cli.h:265
int ast_channel_register(const struct ast_channel_tech *tech)
Register a channel technology (a new channel driver) Called by a channel module to register the kind ...
Definition: channel.c:539
void io_context_destroy(struct io_context *ioc)
Destroys a context.
Definition: io.c:107
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
Definition: astobj2.h:459
#define ast_format_cap_append(cap, format, framing)
Add format capability to capabilities structure.
Definition: format_cap.h:99
#define ast_malloc(len)
A wrapper for malloc()
Definition: astmm.h:191
#define ast_format_cap_alloc(flags)
Allocate a new ast_format_cap structure.
Definition: format_cap.h:49
struct ast_sched_context * ast_sched_context_create(void)
Create a scheduler context.
Definition: sched.c:238
struct ast_format_cap * capabilities
Definition: channel.h:632
Module has failed to load, may be in an inconsistent state.
Definition: module.h:78
struct ast_format * ast_format_alaw
Built-in cached alaw format.
Definition: format_cache.c:91
int ast_format_cap_append_from_cap(struct ast_format_cap *dst, const struct ast_format_cap *src, enum ast_media_type type)
Append the formats of provided type in src to dst.
Definition: format_cap.c:269
void ast_sched_context_destroy(struct ast_sched_context *c)
destroys a schedule context
Definition: sched.c:271
struct io_context * io_context_create(void)
Creates a context Create a context for I/O operations Basically mallocs an IO structure and sets up s...
Definition: io.c:81
int reload ( void  )
static

reload: Part of Asterisk module interface —

Definition at line 7185 of file chan_unistim.c.

References unistim_reloading, and unistimdebug.

Referenced by unistim_reload().

7186 {
7187  if (unistimdebug) {
7188  ast_verb(0, "reload unistim\n");
7189  }
7190  ast_mutex_lock(&unistim_reload_lock);
7191  if (!unistim_reloading) {
7192  unistim_reloading = 1;
7193  }
7194  ast_mutex_unlock(&unistim_reload_lock);
7195 
7196  restart_monitor();
7197 
7198  return 0;
7199 }
static int unistimdebug
Definition: chan_unistim.c:243
static int unistim_reloading
Definition: chan_unistim.c:260
static struct ast_channel * unistim_new ( struct unistim_subchannel sub,
int  state,
const struct ast_assigned_ids assignedids,
const struct ast_channel requestor 
)
static

Protos

Definition at line 5704 of file chan_unistim.c.

References unistim_line::accountcode, unistim_line::amaflags, ao2_ref, ast_callerid_parse(), ast_channel_alloc, ast_channel_callgroup_set(), ast_channel_pickupgroup_set(), ast_channel_stage_snapshot(), ast_channel_stage_snapshot_done(), ast_format_cap_alloc, ast_format_cap_append_from_cap(), ast_format_cap_count(), AST_FORMAT_CAP_FLAG_DEFAULT, ast_format_cap_get_format(), ast_format_cap_get_names(), AST_FORMAT_CAP_NAMES_LEN, ast_format_get_name(), ast_hangup(), ast_jb_configure(), ast_pbx_start(), ast_rtp_instance_fd(), ast_setstate(), AST_STATE_DOWN, AST_STATE_RING, ast_strdup, ast_update_use_count(), unistim_device::call_forward, unistim_line::callgroup, unistim_line::cap, unistim_line::cid_num, unistim_device::context, unistim_line::exten, ast_party_caller::id, unistim_device::language, ast_party_id::name, unistim_device::name, ast_party_id::number, unistim_subchannel::parent, unistim_line::pickupgroup, unistim_subchannel::rtp, ast_party_name::str, ast_party_number::str, unistimdebug, ast_party_name::valid, and ast_party_number::valid.

5705 {
5706  struct ast_format_cap *caps;
5707  struct ast_channel *tmp;
5708  struct unistim_line *l;
5709  struct ast_format *tmpfmt;
5710 
5711  if (!sub) {
5712  ast_log(LOG_WARNING, "subchannel null in unistim_new\n");
5713  return NULL;
5714  }
5715  if (!sub->parent) {
5716  ast_log(LOG_WARNING, "no line for subchannel %p\n", sub);
5717  return NULL;
5718  }
5719 
5721  if (!caps) {
5722  return NULL;
5723  }
5724 
5725  l = sub->parent;
5726  tmp = ast_channel_alloc(1, state, l->cid_num, NULL, l->accountcode, l->exten,
5727  l->parent->context, assignedids, requestor, l->amaflags, "USTM/%s@%s-%p", l->name, l->parent->name, sub);
5728  if (unistimdebug) {
5729  ast_verb(0, "unistim_new sub=%u (%p) chan=%p line=%s\n", sub->subtype, sub, tmp, l->name);
5730  }
5731  if (!tmp) {
5732  ast_log(LOG_WARNING, "Unable to allocate channel structure\n");
5733  ao2_ref(caps, -1);
5734  return NULL;
5735  }
5736 
5738 
5739  if (ast_format_cap_count(l->cap)) {
5740  ast_format_cap_append_from_cap(caps, l->cap, AST_MEDIA_TYPE_UNKNOWN);
5741  } else {
5742  ast_format_cap_append_from_cap(caps, global_cap, AST_MEDIA_TYPE_UNKNOWN);
5743  }
5744  ast_channel_nativeformats_set(tmp, caps);
5745  ao2_ref(caps, -1);
5746 
5747  tmpfmt = ast_format_cap_get_format(ast_channel_nativeformats(tmp), 0);
5748 
5749  if (unistimdebug) {
5750  struct ast_str *native_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
5751  struct ast_str *cap_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
5752  struct ast_str *global_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
5753 
5754  ast_verb(0, "Best codec = %s from nativeformats %s (line cap=%s global=%s)\n",
5755  ast_format_get_name(tmpfmt),
5756  ast_format_cap_get_names(ast_channel_nativeformats(tmp), &native_buf),
5757  ast_format_cap_get_names(l->cap, &cap_buf),
5758  ast_format_cap_get_names(global_cap, &global_buf));
5759  }
5760  if ((sub->rtp) && (sub->subtype == 0)) {
5761  if (unistimdebug) {
5762  ast_verb(0, "New unistim channel with a previous rtp handle ?\n");
5763  }
5764  ast_channel_internal_fd_set(tmp, 0, ast_rtp_instance_fd(sub->rtp, 0));
5765  ast_channel_internal_fd_set(tmp, 1, ast_rtp_instance_fd(sub->rtp, 1));
5766  }
5767  if (sub->rtp) {
5768  ast_jb_configure(tmp, &global_jbconf);
5769  }
5770 /* tmp->type = type; */
5771  ast_setstate(tmp, state);
5772  if (state == AST_STATE_RING) {
5773  ast_channel_rings_set(tmp, 1);
5774  }
5775  ast_channel_adsicpe_set(tmp, AST_ADSI_UNAVAILABLE);
5776 
5777  ast_channel_set_writeformat(tmp, tmpfmt);
5778  ast_channel_set_rawwriteformat(tmp, tmpfmt);
5779  ast_channel_set_readformat(tmp, tmpfmt);
5780  ast_channel_set_rawreadformat(tmp, tmpfmt);
5781  ao2_ref(tmpfmt, -1);
5782 
5783  ast_channel_tech_pvt_set(tmp, sub);
5784  ast_channel_tech_set(tmp, &unistim_tech);
5785 
5786  if (!ast_strlen_zero(l->parent->language)) {
5787  ast_channel_language_set(tmp, l->parent->language);
5788  }
5789  unistim_set_owner(sub, tmp);
5793  ast_channel_call_forward_set(tmp, l->parent->call_forward);
5794  if (!ast_strlen_zero(l->cid_num)) {
5795  char *name, *loc, *instr;
5796  instr = ast_strdup(l->cid_num);
5797  if (instr) {
5798  ast_callerid_parse(instr, &name, &loc);
5799  ast_channel_caller(tmp)->id.number.valid = 1;
5800  ast_free(ast_channel_caller(tmp)->id.number.str);
5801  ast_channel_caller(tmp)->id.number.str = ast_strdup(loc);
5802  ast_channel_caller(tmp)->id.name.valid = 1;
5803  ast_free(ast_channel_caller(tmp)->id.name.str);
5804  ast_channel_caller(tmp)->id.name.str = ast_strdup(name);
5805  ast_free(instr);
5806  }
5807  }
5808  ast_channel_priority_set(tmp, 1);
5809 
5811  ast_channel_unlock(tmp);
5812 
5813  if (state != AST_STATE_DOWN) {
5814  if (unistimdebug) {
5815  ast_verb(0, "Starting pbx in unistim_new\n");
5816  }
5817  if (ast_pbx_start(tmp)) {
5818  ast_log(LOG_WARNING, "Unable to start PBX on %s\n", ast_channel_name(tmp));
5819  ast_hangup(tmp);
5820  tmp = NULL;
5821  }
5822  }
5823 
5824  return tmp;
5825 }
char call_forward[AST_MAX_EXTENSION]
Definition: chan_unistim.c:438
void ast_channel_pickupgroup_set(struct ast_channel *chan, ast_group_t value)
Main Channel structure associated with a channel.
char * str
Subscriber phone number (Malloced)
Definition: channel.h:291
char name[DEVICE_NAME_LEN]
Definition: chan_unistim.c:402
struct ast_rtp_instance * rtp
Definition: chan_unistim.c:358
struct ast_party_name name
Subscriber name.
Definition: channel.h:340
enum ast_pbx_result ast_pbx_start(struct ast_channel *c)
Create a new thread and start the PBX.
Definition: pbx.c:4708
#define AST_FORMAT_CAP_NAMES_LEN
Definition: format_cap.h:324
void ast_channel_callgroup_set(struct ast_channel *chan, ast_group_t value)
char * str
Subscriber name (Malloced)
Definition: channel.h:264
Definition of a media format.
Definition: format.c:43
size_t ast_format_cap_count(const struct ast_format_cap *cap)
Get the number of formats present within the capabilities structure.
Definition: format_cap.c:395
const char * ast_format_get_name(const struct ast_format *format)
Get the name associated with a format.
Definition: format.c:334
#define ast_strdup(str)
A wrapper for strdup()
Definition: astmm.h:241
void ast_update_use_count(void)
Notify when usecount has been changed.
Definition: loader.c:2698
static int unistimdebug
Definition: chan_unistim.c:243
Number structure.
Definition: app_followme.c:154
struct ast_party_id id
Caller party ID.
Definition: channel.h:420
ast_group_t callgroup
Definition: chan_unistim.c:380
void ast_channel_stage_snapshot_done(struct ast_channel *chan)
Clear flag to indicate channel snapshot is being staged, and publish snapshot.
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
Definition: astobj2.h:459
#define ast_format_cap_alloc(flags)
Allocate a new ast_format_cap structure.
Definition: format_cap.h:49
char cid_num[AST_MAX_EXTENSION]
Definition: chan_unistim.c:377
void ast_channel_stage_snapshot(struct ast_channel *chan)
Set flag to indicate channel snapshot is being staged.
Support for dynamic strings.
Definition: strings.h:623
Format capabilities structure, holds formats + preference order + etc.
Definition: format_cap.c:54
const char * ast_format_cap_get_names(const struct ast_format_cap *cap, struct ast_str **buf)
Get the names of codecs of a set of formats.
Definition: format_cap.c:734
void ast_hangup(struct ast_channel *chan)
Hang up a channel.
Definition: channel.c:2541
int ast_rtp_instance_fd(struct ast_rtp_instance *instance, int rtcp)
Get the file descriptor for an RTP session (or RTCP)
Definition: rtp_engine.c:2316
char exten[AST_MAX_EXTENSION]
Definition: chan_unistim.c:376
void ast_jb_configure(struct ast_channel *chan, const struct ast_jb_conf *conf)
Configures a jitterbuffer on a channel.
Definition: abstract_jb.c:593
char context[AST_MAX_EXTENSION]
Definition: chan_unistim.c:398
ast_group_t pickupgroup
Definition: chan_unistim.c:381
char accountcode[AST_MAX_ACCOUNT_CODE]
Definition: chan_unistim.c:382
struct unistim_line * parent
Definition: chan_unistim.c:357
int ast_setstate(struct ast_channel *chan, enum ast_channel_state)
Change the state of a channel.
Definition: channel.c:7386
char language[MAX_LANGUAGE]
Definition: chan_unistim.c:412
int ast_format_cap_append_from_cap(struct ast_format_cap *dst, const struct ast_format_cap *src, enum ast_media_type type)
Append the formats of provided type in src to dst.
Definition: format_cap.c:269
unsigned char valid
TRUE if the name information is valid/present.
Definition: channel.h:279
struct ast_format * ast_format_cap_get_format(const struct ast_format_cap *cap, int position)
Get the format at a specific index.
Definition: format_cap.c:400
struct ast_format_cap * cap
Definition: chan_unistim.c:384
#define ast_channel_alloc(needqueue, state, cid_num, cid_name, acctcode, exten, context, assignedids, requestor, amaflag,...)
Create a channel structure.
Definition: channel.h:1258
unsigned char valid
TRUE if the number information is valid/present.
Definition: channel.h:297
int ast_callerid_parse(char *instr, char **name, char **location)
Destructively parse inbuf into name and location (or number)
Definition: callerid.c:1162
struct ast_party_number number
Subscriber phone number.
Definition: channel.h:342

Variable Documentation

struct ast_jb_conf default_jbconf
static

Global jitterbuffer configuration - by default, jb is disabled.

Note
Values shown here match the defaults shown in unistim.conf.sample

Definition at line 227 of file chan_unistim.c.

ast_mutex_t devicelock = { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP , NULL, {1, 0} }
static

Protect the device list

Definition at line 273 of file chan_unistim.c.

pthread_t monitor_thread = AST_PTHREADT_NULL
static

This is the thread for the monitor which checks for input on the channels which are not currently in use.

Definition at line 265 of file chan_unistim.c.

ast_mutex_t monlock = { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP , NULL, {1, 0} }
static

Protect the monitoring thread, so only one process can kill or start it, and not when it's doing something critical.

Definition at line 269 of file chan_unistim.c.

unsigned char monthlabels[]
static
Initial value:
=
{ 'J', 'a', 'n', 'F', 'e', 'b', 'M', 'a', 'r', 'A', 'p', 'r', 'M', 'a', 'y', 'J', 'u', 'n',
'J', 'u', 'l', 'A', 'u', 'g', 'S', 'e', 'p', 'O', 'c', 't', 'N', 'o', 'v', 'D', 'e', 'c' }

Definition at line 649 of file chan_unistim.c.

const unsigned char packet_rcv_discovery[]
static
Initial value:
=
{ 0xff, 0xff, 0xff, 0xff, 0x02, 0x02, 0xff, 0xff, 0xff, 0xff, 0x9e, 0x03, 0x08 }

Definition at line 506 of file chan_unistim.c.

const unsigned char packet_recv_expansion_pressed_key[]
static
Initial value:
=
{ 0x00, 0x00, 0x00, 0x13, 0x89, 0x04, 0x59 }

Expansion module (i2004 KEM)

Definition at line 524 of file chan_unistim.c.

const unsigned char packet_recv_firm_version[]
static
Initial value:
=
{ 0x00, 0x00, 0x00, 0x13, 0x9a, 0x0a, 0x02 }

Definition at line 511 of file chan_unistim.c.

const unsigned char packet_recv_hangup[]
static
Initial value:
=
{ 0x00, 0x00, 0x00, 0x13, 0x99, 0x03, 0x03 }

Definition at line 519 of file chan_unistim.c.

const unsigned char packet_recv_it_type[]
static
Initial value:
=
{ 0x00, 0x00, 0x00, 0x13, 0x9a, 0x04, 0x03 }

Definition at line 513 of file chan_unistim.c.

const unsigned char packet_recv_mac_addr[]
static
Initial value:
=
{ 0xff, 0xff, 0xff, 0xff, 0x9a, 0x0d, 0x07 }

Definition at line 535 of file chan_unistim.c.

const unsigned char packet_recv_pick_up[]
static
Initial value:
=
{ 0x00, 0x00, 0x00, 0x13, 0x99, 0x03, 0x04 }

Definition at line 517 of file chan_unistim.c.

const unsigned char packet_recv_pressed_key[]
static
Initial value:
=
{ 0x00, 0x00, 0x00, 0x13, 0x99, 0x04, 0x00 }

Definition at line 515 of file chan_unistim.c.

const unsigned char packet_recv_resume_connection_with_server[]
static
Initial value:
=
{ 0xff, 0xff, 0xff, 0xff, 0x9e, 0x03, 0x08 }

TransportAdapter

Definition at line 533 of file chan_unistim.c.

const unsigned char packet_send_charset_iso_2022_jp[]
static
Initial value:
=
{ 0x17, 0x08, 0x21, 0x1b, 0x29, 0x49, 0x1b, 0x7e }

Definition at line 691 of file chan_unistim.c.

const unsigned char packet_send_charset_iso_8859_1[]
static
Initial value:
=
{ 0x17, 0x08, 0x21, 0x1b, 0x2d, 0x41, 0x1b, 0x00 }

Definition at line 679 of file chan_unistim.c.

const unsigned char packet_send_charset_iso_8859_2[]
static
Initial value:
=
{ 0x17, 0x08, 0x21, 0x1b, 0x2d, 0x42, 0x1b, 0x00 }

Definition at line 682 of file chan_unistim.c.

const unsigned char packet_send_charset_iso_8859_4[]
static
Initial value:
=
{ 0x17, 0x08, 0x21, 0x1b, 0x2d, 0x44, 0x1b, 0x00 }

Definition at line 685 of file chan_unistim.c.

const unsigned char packet_send_charset_iso_8859_5[]
static
Initial value:
=
{ 0x17, 0x08, 0x21, 0x1b, 0x2d, 0x4c, 0x1b, 0x00 }

Definition at line 688 of file chan_unistim.c.

const unsigned char packet_send_Contrast[]
static
Initial value:
=
{ 0x17, 0x04, 0x24, 0x08 }

Definition at line 638 of file chan_unistim.c.

const unsigned char packet_send_date_time2[]
static
Initial value:
= { 0x17, 0x04, 0x17, 0x3d, 0x11, 0x09, 0x02, 0x0a, 0x05,
0x06, 0x07, 0x08, 0x32
}

Definition at line 635 of file chan_unistim.c.

const unsigned char packet_send_date_time3[]
static
Initial value:
=
{ 0x11, 0x09, 0x02, 0x02, 0x05, 0x06, 0x07,
0x08, 0x32
}

Definition at line 538 of file chan_unistim.c.

const unsigned char packet_send_discovery_ack[]
static
Initial value:
=
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }

Definition at line 508 of file chan_unistim.c.

const unsigned char packet_send_end_call[]
static
Initial value:
=
{ 0x16, 0x06, 0x32, 0xdf, 0x00, 0xff, 0x16, 0x05, 0x31, 0x00, 0x00, 0x16, 0x04, 0x37, 0x10 }

Definition at line 592 of file chan_unistim.c.

const unsigned char packet_send_expansion_text[]
static
Initial value:
= { 0x09, 0x0f, 0x57, 0x19, 0x47, 0x20,
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 }

Definition at line 528 of file chan_unistim.c.

const unsigned char packet_send_favorite[]
static
Initial value:
=
{ 0x17, 0x0f, 0x19, 0x10, 0x01, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x20, 0x20, 0x20, 0x20, 0x19,
0x05, 0x0f, 0x01, 0x00
}

Definition at line 654 of file chan_unistim.c.

const unsigned char packet_send_jitter_buffer_conf[]
static
Initial value:
=
{ 0x16, 0x0e, 0x3a, 0x00, 0x02, 0x04, 0x00, 0x00,
0x3e, 0x80,
0x00, 0x00, 0x3e, 0x80
}

Definition at line 599 of file chan_unistim.c.

unsigned char packet_send_monthlabels_download[]
static
Initial value:
=
{ 0x17, 0x0a, 0x15, '-', '-', '-', '-', '-', '-', 0x20 }

Definition at line 652 of file chan_unistim.c.

const unsigned char packet_send_no_ring[]
static
Initial value:
=
{ 0x16, 0x04, 0x1a, 0x00, 0x16, 0x04, 0x11, 0x00 }

Definition at line 549 of file chan_unistim.c.

const unsigned char packet_send_open_audio_stream_rx[]
static
Initial value:
=
{ 0x16, 0x1a, 0x30, 0x00, 0xff, 0x00, 0x00, 0x01, 0x00, 0xb8, 0xb8, 0x0e,
0x0e, 0x01, 0x14, 0x50, 0x00,
0x00, 0x14, 0x50, 0x00, 0x00, 0x0a, 0x93, 0x69, 0x05
}

Definition at line 608 of file chan_unistim.c.

const unsigned char packet_send_open_audio_stream_tx[]
static
Initial value:
=
{ 0x16, 0x1a, 0x30, 0xff, 0x00, 0x00, 0x00, 0x01, 0x00, 0xb8, 0xb8, 0x0e,
0x0e, 0x01, 0x14, 0x50,
0x00, 0x00, 0x14, 0x50, 0x00, 0x00, 0x0a, 0x93, 0x69, 0x05
}

Definition at line 613 of file chan_unistim.c.

unsigned char packet_send_ping[]
static
Initial value:
=
{ 0x1e, 0x05, 0x12, 0x00, 0x78 }

Definition at line 701 of file chan_unistim.c.

const unsigned char packet_send_ring[]
static
Initial value:
=
{ 0x16, 0x06, 0x32, 0xdf, 0x00, 0xff, 0x16, 0x05, 0x1c, 0x00, 0x00, 0x16,
0x04, 0x1a, 0x01, 0x16, 0x05, 0x12, 0x13 , 0x18, 0x16, 0x04, 0x18,
0x20, 0x16, 0x04, 0x10, 0x00
}

Definition at line 584 of file chan_unistim.c.

const unsigned char packet_send_rtp_packet_size[]
static
Initial value:
=
{ 0x16, 0x08, 0x38, 0x00, 0x00, 0xe0, 0x00, 0xa0 }

Definition at line 597 of file chan_unistim.c.

const unsigned char packet_send_s9[]
static
Initial value:
=
{ 0x16, 0x06, 0x32, 0xdf, 0x00, 0xff, 0x19, 0x04, 0x00, 0x10, 0x16, 0x05, 0x1c, 0x00,
0x00 }

Definition at line 594 of file chan_unistim.c.

const unsigned char packet_send_select_output[]
static
Initial value:
=
{ 0x16, 0x06, 0x32, 0xc0, 0x01, 0x00 }

Definition at line 581 of file chan_unistim.c.

const unsigned char packet_send_set_pos_cursor[]
static
Initial value:
=
{ 0x17, 0x06, 0x10, 0x81, 0x04, 0x20 }

Definition at line 646 of file chan_unistim.c.

const unsigned char packet_send_start_timer[]
static
Initial value:
=
{ 0x17, 0x05, 0x0b, 0x05, 0x00, 0x17, 0x08, 0x16,
'T', 'i', 'm', 'e', 'r' }

Definition at line 640 of file chan_unistim.c.

const unsigned char packet_send_status[]
static
Initial value:
=
{ 0x17, 0x20, 0x19, 0x08, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20
}

Definition at line 668 of file chan_unistim.c.

const unsigned char packet_send_status2[]
static
Initial value:
=
{ 0x17, 0x0b, 0x19, 0x00, 0x20, 0x20, 0x20, 0x20,
0x20, 0x20, 0x20 }

Definition at line 673 of file chan_unistim.c.

const unsigned char packet_send_stream_based_tone_dual_freq[]
static
Initial value:
=
{ 0x16, 0x08, 0x1d, 0x00, 0x01, 0xb8, 0x01, 0x5e }

Definition at line 579 of file chan_unistim.c.

const unsigned char packet_send_stream_based_tone_off[]
static
Initial value:
=
{ 0x16, 0x05, 0x1c, 0x00, 0x00 }

Definition at line 567 of file chan_unistim.c.

const unsigned char packet_send_stream_based_tone_on[]
static
Initial value:
=
{ 0x16, 0x06, 0x1b, 0x00, 0x00, 0x05 }

Definition at line 575 of file chan_unistim.c.

const unsigned char packet_send_stream_based_tone_single_freq[]
static
Initial value:
=
{ 0x16, 0x06, 0x1d, 0x00, 0x01, 0xb8 }

Definition at line 577 of file chan_unistim.c.

const unsigned char packet_send_title[]
static
Initial value:
=
{ 0x17, 0x10, 0x19, 0x02, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x20, 0x20, 0x20, 0x20 }

Definition at line 659 of file chan_unistim.c.

ast_mutex_t sessionlock = { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP , NULL, {1, 0} }
static

Protect the session list

Definition at line 271 of file chan_unistim.c.

int unistim_reloading = 0
static

Receive buffer address

Definition at line 260 of file chan_unistim.c.

Referenced by reload().

struct ast_rtp_glue unistim_rtp_glue
static
Initial value:
= {
.type = channel_type,
.get_rtp_info = unistim_get_rtp_peer,
.update_peer = unistim_set_rtp_peer,
}

Definition at line 7073 of file chan_unistim.c.

int unistimdebug = 0
static

Enable verbose output. can also be set with the CLI

Definition at line 243 of file chan_unistim.c.

Referenced by reload(), and unistim_new().