|
|
@ -2203,7 +2203,7 @@ struct ast_channel *ast_request_and_dial(const char *type, int format, void *dat
|
|
|
|
struct ast_channel *ast_request(const char *type, int format, void *data, int *cause)
|
|
|
|
struct ast_channel *ast_request(const char *type, int format, void *data, int *cause)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
struct chanlist *chan;
|
|
|
|
struct chanlist *chan;
|
|
|
|
struct ast_channel *c = NULL;
|
|
|
|
struct ast_channel *c;
|
|
|
|
int capabilities;
|
|
|
|
int capabilities;
|
|
|
|
int fmt;
|
|
|
|
int fmt;
|
|
|
|
int res;
|
|
|
|
int res;
|
|
|
@ -2212,13 +2212,16 @@ struct ast_channel *ast_request(const char *type, int format, void *data, int *c
|
|
|
|
if (!cause)
|
|
|
|
if (!cause)
|
|
|
|
cause = &foo;
|
|
|
|
cause = &foo;
|
|
|
|
*cause = AST_CAUSE_NOTDEFINED;
|
|
|
|
*cause = AST_CAUSE_NOTDEFINED;
|
|
|
|
|
|
|
|
|
|
|
|
if (ast_mutex_lock(&chlock)) {
|
|
|
|
if (ast_mutex_lock(&chlock)) {
|
|
|
|
ast_log(LOG_WARNING, "Unable to lock channel list\n");
|
|
|
|
ast_log(LOG_WARNING, "Unable to lock channel list\n");
|
|
|
|
return NULL;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
chan = backends;
|
|
|
|
|
|
|
|
while(chan) {
|
|
|
|
for (chan = backends; chan; chan = chan->next) {
|
|
|
|
if (!strcasecmp(type, chan->tech->type)) {
|
|
|
|
if (strcasecmp(type, chan->tech->type))
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
|
|
capabilities = chan->tech->capabilities;
|
|
|
|
capabilities = chan->tech->capabilities;
|
|
|
|
fmt = format;
|
|
|
|
fmt = format;
|
|
|
|
res = ast_translator_best_choice(&fmt, &capabilities);
|
|
|
|
res = ast_translator_best_choice(&fmt, &capabilities);
|
|
|
@ -2228,9 +2231,12 @@ struct ast_channel *ast_request(const char *type, int format, void *data, int *c
|
|
|
|
return NULL;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ast_mutex_unlock(&chlock);
|
|
|
|
ast_mutex_unlock(&chlock);
|
|
|
|
if (chan->tech->requester)
|
|
|
|
if (!chan->tech->requester)
|
|
|
|
c = chan->tech->requester(type, capabilities, data, cause);
|
|
|
|
return NULL;
|
|
|
|
if (c) {
|
|
|
|
|
|
|
|
|
|
|
|
if (!(c = chan->tech->requester(type, capabilities, data, cause)))
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
|
|
if (c->_state == AST_STATE_DOWN) {
|
|
|
|
if (c->_state == AST_STATE_DOWN) {
|
|
|
|
manager_event(EVENT_FLAG_CALL, "Newchannel",
|
|
|
|
manager_event(EVENT_FLAG_CALL, "Newchannel",
|
|
|
|
"Channel: %s\r\n"
|
|
|
|
"Channel: %s\r\n"
|
|
|
@ -2238,19 +2244,19 @@ struct ast_channel *ast_request(const char *type, int format, void *data, int *c
|
|
|
|
"CallerID: %s\r\n"
|
|
|
|
"CallerID: %s\r\n"
|
|
|
|
"CallerIDName: %s\r\n"
|
|
|
|
"CallerIDName: %s\r\n"
|
|
|
|
"Uniqueid: %s\r\n",
|
|
|
|
"Uniqueid: %s\r\n",
|
|
|
|
c->name, ast_state2str(c->_state), c->cid.cid_num ? c->cid.cid_num : "<unknown>", c->cid.cid_name ? c->cid.cid_name : "<unknown>",c->uniqueid);
|
|
|
|
c->name, ast_state2str(c->_state),
|
|
|
|
}
|
|
|
|
c->cid.cid_num ? c->cid.cid_num : "<unknown>",
|
|
|
|
|
|
|
|
c->cid.cid_name ? c->cid.cid_name : "<unknown>",
|
|
|
|
|
|
|
|
c->uniqueid);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return c;
|
|
|
|
return c;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
chan = chan->next;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!chan) {
|
|
|
|
|
|
|
|
ast_log(LOG_WARNING, "No channel type registered for '%s'\n", type);
|
|
|
|
ast_log(LOG_WARNING, "No channel type registered for '%s'\n", type);
|
|
|
|
*cause = AST_CAUSE_NOSUCHDRIVER;
|
|
|
|
*cause = AST_CAUSE_NOSUCHDRIVER;
|
|
|
|
}
|
|
|
|
|
|
|
|
ast_mutex_unlock(&chlock);
|
|
|
|
ast_mutex_unlock(&chlock);
|
|
|
|
return c;
|
|
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int ast_call(struct ast_channel *chan, char *addr, int timeout)
|
|
|
|
int ast_call(struct ast_channel *chan, char *addr, int timeout)
|
|
|
|