![]() |
Home page |
Mailing list |
Docs
Asterisk developer's documentation :: Codename Pineapple
chan_skinny.c File Reference
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.
|
|
Definition at line 671 of file chan_skinny.c. Referenced by skinny_hold(), skinny_unhold(), and transmit_callstate(). |
|
|
Definition at line 219 of file chan_skinny.c. Referenced by handle_message(). |
|
|
Definition at line 394 of file chan_skinny.c. |
|
|
Definition at line 396 of file chan_skinny.c. Referenced by get_button_template(). |
|
|
Definition at line 397 of file chan_skinny.c. |
|
|
Definition at line 395 of file chan_skinny.c. Referenced by get_button_template(). |
|
|
Definition at line 404 of file chan_skinny.c. |
|
|
Definition at line 403 of file chan_skinny.c. Referenced by get_button_template(), and handle_button_template_req_message(). |
|
|
Definition at line 391 of file chan_skinny.c. Referenced by get_button_template(). |
|
|
Definition at line 388 of file chan_skinny.c. Referenced by get_button_template(). |
|
|
Definition at line 389 of file chan_skinny.c. |
|
|
Definition at line 390 of file chan_skinny.c. |
|
|
Definition at line 386 of file chan_skinny.c. Referenced by get_button_template(). |
|
|
Definition at line 392 of file chan_skinny.c. Referenced by get_button_template(), and handle_button_template_req_message(). |
|
|
Definition at line 398 of file chan_skinny.c. Referenced by get_button_template(), and handle_button_template_req_message(). |
|
|
Definition at line 384 of file chan_skinny.c. Referenced by get_button_template(). |
|
|
Definition at line 385 of file chan_skinny.c. Referenced by get_button_template(). |
|
|
Definition at line 387 of file chan_skinny.c. Referenced by get_button_template(). |
|
|
Definition at line 393 of file chan_skinny.c. Referenced by get_button_template(). |
|
|
Definition at line 215 of file chan_skinny.c. Referenced by handle_message(). |
|
|
Definition at line 355 of file chan_skinny.c. Referenced by handle_button_template_req_message(). |
|
|
Definition at line 314 of file chan_skinny.c. Referenced by transmit_callinfo(). |
|
|
Definition at line 650 of file chan_skinny.c. Referenced by transmit_callstate(). |
|
|
Definition at line 427 of file chan_skinny.c. Referenced by handle_register_message(). |
|
|
Definition at line 189 of file chan_skinny.c. Referenced by handle_message(). |
|
|
Definition at line 425 of file chan_skinny.c. Referenced by transmit_displaymessage(). |
|
|
Definition at line 423 of file chan_skinny.c. |
|
|
Definition at line 424 of file chan_skinny.c. |
|
|
Definition at line 462 of file chan_skinny.c. Referenced by skinny_hold(), and transmit_callstate(). |
|
|
Definition at line 142 of file chan_skinny.c. Referenced by control2str(). |
|
|
Definition at line 97 of file chan_skinny.c. Referenced by reload_config(). |
|
|
Definition at line 96 of file chan_skinny.c. Referenced by build_device(), and reload_config(). |
|
|
Definition at line 342 of file chan_skinny.c. Referenced by handle_time_date_req_message(). |
|
|
Definition at line 139 of file chan_skinny.c. Referenced by device2str(). |
|
|
Definition at line 676 of file chan_skinny.c. Referenced by transmit_dialednumber(). |
|
|
Definition at line 665 of file chan_skinny.c. Referenced by transmit_displaynotify(). |
|
|
Definition at line 657 of file chan_skinny.c. Referenced by transmit_displaypromptstatus(). |
|
|
Definition at line 418 of file chan_skinny.c. Referenced by transmit_displaymessage(). |
|
|
Definition at line 246 of file chan_skinny.c. Referenced by handle_message(). |
|
|
|
Definition at line 108 of file chan_skinny.c. |
|
|
Definition at line 161 of file chan_skinny.c. Referenced by handle_message(). |
|
|
Definition at line 450 of file chan_skinny.c. Referenced by handle_keep_alive_message(). |
|
|
Definition at line 148 of file chan_skinny.c. Referenced by handle_message(). |
|
|
Definition at line 476 of file chan_skinny.c. Referenced by handle_offhook_message(), handle_soft_key_event_message(), and handle_stimulus_message(). |
|
|
Definition at line 482 of file chan_skinny.c. |
|
|
Definition at line 480 of file chan_skinny.c. |
|
|
Definition at line 481 of file chan_skinny.c. |
|
|
Definition at line 479 of file chan_skinny.c. Referenced by handle_offhook_message(), handle_soft_key_event_message(), and handle_stimulus_message(). |
|
|
Definition at line 484 of file chan_skinny.c. |
|
|
Definition at line 477 of file chan_skinny.c. |
|
|
Definition at line 475 of file chan_skinny.c. |
|
|
Definition at line 478 of file chan_skinny.c. Referenced by skinny_call(). |
|
|
Definition at line 483 of file chan_skinny.c. |
|
|
Definition at line 485 of file chan_skinny.c. |
|
|
Definition at line 163 of file chan_skinny.c. Referenced by handle_message(). |
|
|
|
Definition at line 106 of file chan_skinny.c. |
|
|
Definition at line 334 of file chan_skinny.c. Referenced by handle_line_state_req_message(). |
|
|
Definition at line 209 of file chan_skinny.c. Referenced by handle_message(). |
|
|
Definition at line 177 of file chan_skinny.c. Referenced by handle_message(). |
|
|
Definition at line 183 of file chan_skinny.c. Referenced by handle_message(). |
|
|
Definition at line 227 of file chan_skinny.c. Referenced by handle_message(). |
|
|
Definition at line 452 of file chan_skinny.c. Referenced by transmit_connect(). |
|
|
Definition at line 249 of file chan_skinny.c. Referenced by handle_register_message(). |
|
|
Definition at line 247 of file chan_skinny.c. Referenced by handle_message(). |
|
|
Definition at line 151 of file chan_skinny.c. Referenced by handle_message(). |
|
|
Definition at line 429 of file chan_skinny.c. Referenced by handle_register_message(). |
|
|
Definition at line 445 of file chan_skinny.c. Referenced by skinny_reset_device(). |
|
|
Definition at line 642 of file chan_skinny.c. Referenced by transmit_selectsoftkeys(). |
|
|
Definition at line 217 of file chan_skinny.c. Referenced by handle_message(). |
|
|
Definition at line 434 of file chan_skinny.c. Referenced by handle_server_request_message(). |
|
|
Definition at line 272 of file chan_skinny.c. Referenced by transmit_lamp_indication(). |
|
|
Definition at line 285 of file chan_skinny.c. |
|
|
Definition at line 265 of file chan_skinny.c. Referenced by transmit_ringer_mode(). |
|
|
Definition at line 279 of file chan_skinny.c. Referenced by transmit_speaker_mode(). |
|
|
Definition at line 829 of file chan_skinny.c. Referenced by skinny_call(), and skinny_indicate(). |
|
|
Definition at line 817 of file chan_skinny.c. Referenced by skinny_indicate(). |
|
|
Definition at line 828 of file chan_skinny.c. Referenced by skinny_indicate(). |
|
|
Definition at line 820 of file chan_skinny.c. |
|
|
Definition at line 831 of file chan_skinny.c. Referenced by skinny_call(). |
|
|
Definition at line 818 of file chan_skinny.c. Referenced by skinny_indicate(). |
|
|
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(). |
|
|
Definition at line 852 of file chan_skinny.c. |
|
|
Definition at line 853 of file chan_skinny.c. |
|
|
Definition at line 855 of file chan_skinny.c. Referenced by skinny_new(). |
|
|
Definition at line 854 of file chan_skinny.c. |
|
|
Definition at line 850 of file chan_skinny.c. Referenced by handle_onhook_message(), and handle_soft_key_event_message(). |
|
|
Definition at line 849 of file chan_skinny.c. |
|
|
Definition at line 851 of file chan_skinny.c. Referenced by skinny_answer(). |
|
|
Definition at line 782 of file chan_skinny.c. Referenced by device2str(), and get_button_template(). |
|
|
Definition at line 781 of file chan_skinny.c. Referenced by device2str(), and get_button_template(). |
|
|
Definition at line 780 of file chan_skinny.c. Referenced by device2str(), and get_button_template(). |
|
|
Definition at line 779 of file chan_skinny.c. Referenced by device2str(), and get_button_template(). |
|
|
Definition at line 783 of file chan_skinny.c. Referenced by device2str(), and get_button_template(). |
|
|
Definition at line 799 of file chan_skinny.c. Referenced by device2str(), and get_button_template(). |
|
|
Definition at line 795 of file chan_skinny.c. Referenced by device2str(), and get_button_template(). |
|
|
Definition at line 784 of file chan_skinny.c. Referenced by device2str(), and get_button_template(). |
|
|
Definition at line 792 of file chan_skinny.c. Referenced by device2str(), and get_button_template(). |
|
|
Definition at line 798 of file chan_skinny.c. Referenced by device2str(), and get_button_template(). |
|
|
Definition at line 796 of file chan_skinny.c. Referenced by device2str(), and get_button_template(). |
|
|
Definition at line 787 of file chan_skinny.c. Referenced by device2str(), and get_button_template(). |
|
|
Definition at line 802 of file chan_skinny.c. Referenced by device2str(), and get_button_template(). |
|
|
Definition at line 786 of file chan_skinny.c. Referenced by device2str(), and get_button_template(). |
|
|
Definition at line 789 of file chan_skinny.c. Referenced by device2str(), and get_button_template(). |
|
|
Definition at line 794 of file chan_skinny.c. Referenced by device2str(), and get_button_template(). |
|
|
Definition at line 785 of file chan_skinny.c. Referenced by device2str(), and get_button_template(). |
|
|
Definition at line 801 of file chan_skinny.c. Referenced by device2str(), and get_button_template(). |
|
|
Definition at line 793 of file chan_skinny.c. Referenced by device2str(), and get_button_template(). |
|
|
Definition at line 797 of file chan_skinny.c. Referenced by device2str(), and get_button_template(). |
|
|
Definition at line 790 of file chan_skinny.c. Referenced by device2str(), and get_button_template(). |
|
|
Definition at line 791 of file chan_skinny.c. Referenced by device2str(), and get_button_template(). |
|
|
Definition at line 788 of file chan_skinny.c. Referenced by device2str(), and get_button_template(). |
|
|
Definition at line 800 of file chan_skinny.c. Referenced by device2str(), and get_button_template(). |
|
|
Definition at line 778 of file chan_skinny.c. Referenced by device2str(). |
|
|
Definition at line 803 of file chan_skinny.c. Referenced by device2str(), and get_button_template(). |
|
|
Definition at line 804 of file chan_skinny.c. Referenced by device2str(), and get_button_template(). |
|
|
Definition at line 777 of file chan_skinny.c. Referenced by device2str(). |
|
|
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(). |
|
|
Definition at line 819 of file chan_skinny.c. |
|
|
Definition at line 824 of file chan_skinny.c. |
|
|
Definition at line 838 of file chan_skinny.c. Referenced by skinny_call(), and skinny_hold(). |
|
|
Definition at line 837 of file chan_skinny.c. |
|
|
Definition at line 834 of file chan_skinny.c. Referenced by handle_soft_key_event_message(), handle_stimulus_message(), and skinny_hangup(). |
|
|
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(). |
|
|
Definition at line 836 of file chan_skinny.c. |
|
|
Definition at line 98 of file chan_skinny.c. Referenced by skinny_req_parse(), and transmit_response(). |
|
|
Definition at line 810 of file chan_skinny.c. |
|
|
Definition at line 809 of file chan_skinny.c. |
|
|
Definition at line 832 of file chan_skinny.c. Referenced by transmit_tone(). |
|
|
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(). |
|
|
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(). |
|
|
Definition at line 822 of file chan_skinny.c. |
|
|
Definition at line 823 of file chan_skinny.c. Referenced by skinny_indicate(). |
|
|
Definition at line 830 of file chan_skinny.c. Referenced by skinny_indicate(), skinny_newcall(), and skinny_ss(). |
|
|
Definition at line 843 of file chan_skinny.c. |
|
|
Definition at line 841 of file chan_skinny.c. Referenced by skinny_call(). |
|
|
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(). |
|
|
Definition at line 842 of file chan_skinny.c. |
|
|
Definition at line 815 of file chan_skinny.c. Referenced by skinny_call(). |
|
|
Definition at line 814 of file chan_skinny.c. Referenced by skinny_indicate(). |
|
|
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(). |
|
|
Definition at line 807 of file chan_skinny.c. Referenced by skinny_hangup(), and transmit_callstate(). |
|
|
Definition at line 806 of file chan_skinny.c. Referenced by handle_stimulus_message(). |
|
|
Definition at line 821 of file chan_skinny.c. |
|
|
Definition at line 237 of file chan_skinny.c. Referenced by handle_message(). |
|
|
Definition at line 235 of file chan_skinny.c. Referenced by handle_message(). |
|
|
Definition at line 627 of file chan_skinny.c. Referenced by handle_soft_key_set_req_message(). |
|
|
Definition at line 245 of file chan_skinny.c. Referenced by handle_message(). |
|
|
Definition at line 468 of file chan_skinny.c. Referenced by handle_soft_key_template_req_message(). |
|
|
Definition at line 498 of file chan_skinny.c. Referenced by handle_soft_key_event_message(). |
|
|
Definition at line 495 of file chan_skinny.c. Referenced by handle_soft_key_event_message(). |
|
|
Definition at line 492 of file chan_skinny.c. Referenced by handle_soft_key_event_message(). |
|
|
Definition at line 493 of file chan_skinny.c. Referenced by handle_soft_key_event_message(). |
|
|
Definition at line 494 of file chan_skinny.c. Referenced by handle_soft_key_event_message(). |
|
|
Definition at line 500 of file chan_skinny.c. Referenced by handle_soft_key_event_message(). |
|
|
Definition at line 496 of file chan_skinny.c. Referenced by handle_soft_key_event_message(). |
|
|
Definition at line 505 of file chan_skinny.c. Referenced by handle_soft_key_event_message(). |
|
|
Definition at line 490 of file chan_skinny.c. Referenced by handle_soft_key_event_message(). |
|
|
Definition at line 499 of file chan_skinny.c. Referenced by handle_soft_key_event_message(). |
|
|
Definition at line 502 of file chan_skinny.c. Referenced by handle_soft_key_event_message(). |
|
|
Definition at line 503 of file chan_skinny.c. Referenced by handle_soft_key_event_message(). |
|
|
Definition at line 489 of file chan_skinny.c. Referenced by handle_soft_key_event_message(). |
|
|
Definition at line 487 of file chan_skinny.c. Referenced by handle_soft_key_event_message(). |
|
|
Definition at line 501 of file chan_skinny.c. Referenced by handle_soft_key_event_message(). |
|
|
Definition at line 504 of file chan_skinny.c. Referenced by handle_soft_key_event_message(). |
|
|
Definition at line 488 of file chan_skinny.c. Referenced by handle_soft_key_event_message(). |
|
|
Definition at line 497 of file chan_skinny.c. Referenced by handle_soft_key_event_message(). |
|
|
Definition at line 491 of file chan_skinny.c. Referenced by handle_soft_key_event_message(). |
|
|
Definition at line 204 of file chan_skinny.c. Referenced by handle_message(). |
|
|
Definition at line 327 of file chan_skinny.c. Referenced by handle_speed_dial_stat_req_message(). |
|
|
Definition at line 290 of file chan_skinny.c. Referenced by handle_open_receive_channel_ack_message(). |
|
|
Definition at line 258 of file chan_skinny.c. Referenced by transmit_tone(). |
|
|
Definition at line 377 of file chan_skinny.c. |
|
|
Definition at line 379 of file chan_skinny.c. Referenced by handle_stimulus_message(). |
|
|
Definition at line 380 of file chan_skinny.c. |
|
|
Definition at line 378 of file chan_skinny.c. Referenced by handle_stimulus_message(). |
|
|
Definition at line 374 of file chan_skinny.c. Referenced by handle_stimulus_message(). |
|
|
Definition at line 371 of file chan_skinny.c. Referenced by handle_soft_key_event_message(), and handle_stimulus_message(). |
|
|
Definition at line 372 of file chan_skinny.c. Referenced by handle_stimulus_message(). |
|
|
Definition at line 373 of file chan_skinny.c. Referenced by handle_stimulus_message(). |
|
|
Definition at line 369 of file chan_skinny.c. Referenced by handle_stimulus_message(). |
|
|
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(). |
|
|
Definition at line 170 of file chan_skinny.c. Referenced by handle_message(). |
|
|
Definition at line 381 of file chan_skinny.c. |
|
|
Definition at line 367 of file chan_skinny.c. Referenced by handle_stimulus_message(). |
|
|
Definition at line 368 of file chan_skinny.c. Referenced by handle_stimulus_message(). |
|
|
Definition at line 370 of file chan_skinny.c. Referenced by handle_stimulus_message(). |
|
|
Definition at line 376 of file chan_skinny.c. Referenced by handle_stimulus_message(). |
|
|
Definition at line 308 of file chan_skinny.c. Referenced by skinny_hold(), and transmit_callstate(). |
|
|
Definition at line 263 of file chan_skinny.c. Referenced by transmit_tone(). |
|
|
Definition at line 214 of file chan_skinny.c. Referenced by handle_message(). |
|
|
Definition at line 846 of file chan_skinny.c. |
|
|
Definition at line 845 of file chan_skinny.c. |
|
|
Definition at line 244 of file chan_skinny.c. Referenced by handle_message(). |
|
|
Definition at line 216 of file chan_skinny.c. Referenced by handle_message(). |
|
|
Definition at line 413 of file chan_skinny.c. Referenced by handle_version_req_message(). |
|
|
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 };
|
|
|
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 }
|
|
||||||||||||||||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||||||||||||
|
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 }
|
|
|
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 }
|
|
|
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 }
|
|
||||||||||||||||||||
|
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 }
|
|
|
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 }
|
|
|
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 }
|
|
|
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 }
|
|
|
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 }
|
|
|
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 }
|
|
|
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 }
|
|
||||||||||||
|
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 }
|
|
|
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 }
|
|
||||||||||||
|
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 }
|
|
||||||||||||||||
|
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 }
|
|
||||||||||||
|
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 }
|
|
||||||||||||
|
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 }
|
|
|
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 }
|
|
||||||||||||
|
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 }
|
|
||||||||||||
|
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 }
|
|
||||||||||||
|
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 }
|
|
||||||||||||
|
Definition at line 3973 of file chan_skinny.c. Referenced by handle_message().
|
|
||||||||||||
|
Definition at line 2903 of file chan_skinny.c. Referenced by handle_message().
|