mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-19 03:07:59 +00:00
Support devicestate requests.
Now you should be able to subscribe to a Skinny device/line. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@56579 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -73,6 +73,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|||||||
#include "asterisk/astobj.h"
|
#include "asterisk/astobj.h"
|
||||||
#include "asterisk/abstract_jb.h"
|
#include "asterisk/abstract_jb.h"
|
||||||
#include "asterisk/threadstorage.h"
|
#include "asterisk/threadstorage.h"
|
||||||
|
#include "asterisk/devicestate.h"
|
||||||
|
|
||||||
/*************************************
|
/*************************************
|
||||||
* Skinny/Asterisk Protocol Settings *
|
* Skinny/Asterisk Protocol Settings *
|
||||||
@@ -1028,6 +1029,7 @@ static struct skinnysession {
|
|||||||
} *sessions = NULL;
|
} *sessions = NULL;
|
||||||
|
|
||||||
static struct ast_channel *skinny_request(const char *type, int format, void *data, int *cause);
|
static struct ast_channel *skinny_request(const char *type, int format, void *data, int *cause);
|
||||||
|
static int skinny_devicestate(void *data);
|
||||||
static int skinny_call(struct ast_channel *ast, char *dest, int timeout);
|
static int skinny_call(struct ast_channel *ast, char *dest, int timeout);
|
||||||
static int skinny_hangup(struct ast_channel *ast);
|
static int skinny_hangup(struct ast_channel *ast);
|
||||||
static int skinny_answer(struct ast_channel *ast);
|
static int skinny_answer(struct ast_channel *ast);
|
||||||
@@ -1044,6 +1046,7 @@ static const struct ast_channel_tech skinny_tech = {
|
|||||||
.capabilities = ((AST_FORMAT_MAX_AUDIO << 1) - 1),
|
.capabilities = ((AST_FORMAT_MAX_AUDIO << 1) - 1),
|
||||||
.properties = AST_CHAN_TP_WANTSJITTER | AST_CHAN_TP_CREATESJITTER,
|
.properties = AST_CHAN_TP_WANTSJITTER | AST_CHAN_TP_CREATESJITTER,
|
||||||
.requester = skinny_request,
|
.requester = skinny_request,
|
||||||
|
.devicestate = skinny_devicestate,
|
||||||
.call = skinny_call,
|
.call = skinny_call,
|
||||||
.hangup = skinny_hangup,
|
.hangup = skinny_hangup,
|
||||||
.answer = skinny_answer,
|
.answer = skinny_answer,
|
||||||
@@ -4416,6 +4419,41 @@ static struct ast_channel *skinny_request(const char *type, int format, void *da
|
|||||||
return tmpc;
|
return tmpc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int skinny_devicestate(void *data)
|
||||||
|
{
|
||||||
|
struct skinny_line *l;
|
||||||
|
struct skinny_subchannel *sub;
|
||||||
|
char *tmp;
|
||||||
|
int res = AST_DEVICE_UNKNOWN;
|
||||||
|
|
||||||
|
tmp = ast_strdupa(data);
|
||||||
|
|
||||||
|
l = find_line_by_name(tmp);
|
||||||
|
|
||||||
|
if (!l)
|
||||||
|
res = AST_DEVICE_INVALID;
|
||||||
|
else if (!l->parent)
|
||||||
|
res = AST_DEVICE_UNAVAILABLE;
|
||||||
|
else if (l->dnd)
|
||||||
|
res = AST_DEVICE_BUSY;
|
||||||
|
else {
|
||||||
|
if (l->hookstate == SKINNY_ONHOOK) {
|
||||||
|
res = AST_DEVICE_NOT_INUSE;
|
||||||
|
} else {
|
||||||
|
res = AST_DEVICE_INUSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (sub = l->sub; sub; sub = sub->next) {
|
||||||
|
if (sub->onhold) {
|
||||||
|
res = AST_DEVICE_ONHOLD;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
static int reload_config(void)
|
static int reload_config(void)
|
||||||
{
|
{
|
||||||
int on = 1;
|
int on = 1;
|
||||||
|
Reference in New Issue
Block a user