struct skinny_line *l = sub->parent;
struct skinny_device *d = l->device;
+ if (!d) {
+ return;
+ }
+
if (!c->caller.id.number.valid
|| ast_strlen_zero(c->caller.id.number.str)
|| !c->connected.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(d->exten);
struct skinny_line *l = sub->parent;
struct skinny_device *d = l->device;
- if (!d->registered) {
+ if (!d || !d->registered) {
ast_log(LOG_ERROR, "Device not registered, cannot call %s\n", dest);
return -1;
}
l = sub->parent;
d = l->device;
+ if (!d) {
+ ast_log(LOG_WARNING, "Device for line %s is not registered.\n", l->name);
+ return 0;
+ }
+
if (skinnydebug)
ast_verb(3,"Hanging up %s/%d\n",d->name,sub->callid);
struct skinny_subchannel *sub = ast->tech_pvt;
struct skinny_line *l = sub->parent;
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->name);
struct skinny_device *d = l->device;
/* Don't try to hold a channel that doesn't exist */
- if (!sub || !sub->owner)
+ if (!sub || !sub->owner) {
return 0;
+ }
+ if (!d) {
+ ast_log(LOG_WARNING, "Device for line %s is not registered.\n", l->name);
+ return 0;
+ }
/* Channel needs to be put on hold */
if (skinnydebug)
struct skinny_device *d = l->device;
/* Don't try to unhold a channel that doesn't exist */
- if (!sub || !sub->owner)
+ if (!sub || !sub->owner) {
return 0;
+ }
+ if (!d) {
+ ast_log(LOG_WARNING, "Device for line %s is not registered.\n", l->name);
+ return 0;
+ }
/* Channel is on hold, so we will unhold */
if (skinnydebug)
l = sub->parent;
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->onhold) {
struct ast_channel *c = sub->owner;
pthread_t t;
+ if (!d) {
+ ast_log(LOG_WARNING, "Device for line %s is not registered.\n", l->name);
+ return 0;
+ }
+
if (l->hookstate == SKINNY_ONHOOK) {
l->hookstate = SKINNY_OFFHOOK;
transmit_speaker_mode(d, SKINNY_SPEAKERON);