struct skinny_line *l = sub->line;
struct skinny_device *d = l->device;
+ if (!d) {
+ return;
+ }
+
if (!ast_channel_caller(c)->id.number.valid
|| ast_strlen_zero(ast_channel_caller(c)->id.number.str)
|| !ast_channel_connected(c)->id.number.valid
int res = 0;
int loop_pause = 100;
+ if (!d) {
+ ast_log(LOG_WARNING, "Device for line %s is not registered.\n", l->name);
+ return NULL;
+ }
+
ast_verb(3, "Starting simple switch on '%s@%s'\n", l->name, d->name);
len = strlen(sub->exten);
struct ast_var_t *current;
int doautoanswer = 0;
- if (!d->registered) {
+ if (!d || !d->registered) {
ast_log(LOG_ERROR, "Device not registered, cannot call %s\n", dest);
return -1;
}
struct skinny_subchannel *sub = ast_channel_tech_pvt(ast);
struct skinny_line *l = sub->line;
struct skinny_device *d = l->device;
- struct skinnysession *s = d->session;
+ struct skinnysession *s;
+
+ if (!d) {
+ ast_log(LOG_WARNING, "Device for line %s is not registered.\n", l->name);
+ return -1;
+ }
+ s = d->session;
if (!s) {
ast_log(LOG_NOTICE, "Asked to indicate '%s' condition on channel %s, but session does not exist.\n", control2str(ind), ast_channel_name(ast));
l = sub->line;
d = l->device;
+ if (!d) {
+ ast_log(LOG_WARNING, "Device for line %s is not registered.\n", l->name);
+ return -1;
+ }
+
if (!sub->related) {
/* Another sub has not been created so this must be first XFER press */
if (!(sub->substate == SUBSTATE_HOLD)) {
struct skinny_device *d = l->device;
struct ast_channel *c = sub->owner;
+ if (!d) {
+ ast_log(LOG_WARNING, "Device for line %s is not registered.\n", l->name);
+ return 0;
+ }
+
if (d->hookstate == SKINNY_ONHOOK) {
d->hookstate = SKINNY_OFFHOOK;
transmit_speaker_mode(d, SKINNY_SPEAKERON);