mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-03 03:20:57 +00:00
uniqueid: channel linkedid, ami, ari object creation with id's
Much needed was a way to assign id to objects on creation, and much change was necessary to accomplish it. Channel uniqueids and linkedids are split into separate string and creation time components without breaking linkedid propgation. This allowed the uniqueid to be specified by the user interface - and those values are now carried through to channel creation, adding the assignedids value to every function in the chain including the channel drivers. For local channels, the second channel can be specified or left to default to a ;2 suffix of first. In ARI, bridge, playback, and snoop objects can also be created with a specified uniqueid. Along the way, the args order to allocating channels was fixed in chan_mgcp and chan_gtalk, and linkedid is no longer lost as masquerade occurs. (closes issue ASTERISK-23120) Review: https://reviewboard.asterisk.org/r/3191/ ........ Merged revisions 410157 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410158 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -209,9 +209,9 @@ static char *mblsendsms_desc =
|
||||
" Message - text of the message\n";
|
||||
|
||||
static struct ast_channel *mbl_new(int state, struct mbl_pvt *pvt, char *cid_num,
|
||||
const struct ast_channel *requestor);
|
||||
const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor);
|
||||
static struct ast_channel *mbl_request(const char *type, struct ast_format_cap *cap,
|
||||
const struct ast_channel *requestor, const char *data, int *cause);
|
||||
const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *data, int *cause);
|
||||
static int mbl_call(struct ast_channel *ast, const char *dest, int timeout);
|
||||
static int mbl_hangup(struct ast_channel *ast);
|
||||
static int mbl_answer(struct ast_channel *ast);
|
||||
@@ -838,7 +838,7 @@ e_return:
|
||||
*/
|
||||
|
||||
static struct ast_channel *mbl_new(int state, struct mbl_pvt *pvt, char *cid_num,
|
||||
const struct ast_channel *requestor)
|
||||
const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor)
|
||||
{
|
||||
|
||||
struct ast_channel *chn;
|
||||
@@ -855,7 +855,7 @@ static struct ast_channel *mbl_new(int state, struct mbl_pvt *pvt, char *cid_num
|
||||
ast_dsp_digitreset(pvt->dsp);
|
||||
|
||||
chn = ast_channel_alloc(1, state, cid_num, pvt->id, 0, 0, pvt->context,
|
||||
requestor ? ast_channel_linkedid(requestor) : "", 0,
|
||||
assignedids, requestor, 0,
|
||||
"Mobile/%s-%04lx", pvt->id, ast_random() & 0xffff);
|
||||
if (!chn) {
|
||||
goto e_return;
|
||||
@@ -887,7 +887,7 @@ e_return:
|
||||
}
|
||||
|
||||
static struct ast_channel *mbl_request(const char *type, struct ast_format_cap *cap,
|
||||
const struct ast_channel *requestor, const char *data, int *cause)
|
||||
const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *data, int *cause)
|
||||
{
|
||||
|
||||
struct ast_channel *chn = NULL;
|
||||
@@ -946,7 +946,7 @@ static struct ast_channel *mbl_request(const char *type, struct ast_format_cap *
|
||||
}
|
||||
|
||||
ast_mutex_lock(&pvt->lock);
|
||||
chn = mbl_new(AST_STATE_DOWN, pvt, NULL, requestor);
|
||||
chn = mbl_new(AST_STATE_DOWN, pvt, NULL, assignedids, requestor);
|
||||
ast_mutex_unlock(&pvt->lock);
|
||||
if (!chn) {
|
||||
ast_log(LOG_WARNING, "Unable to allocate channel structure.\n");
|
||||
@@ -3591,7 +3591,7 @@ static int handle_response_clip(struct mbl_pvt *pvt, char *buf)
|
||||
ast_debug(1, "[%s] error parsing CLIP: %s\n", pvt->id, buf);
|
||||
}
|
||||
|
||||
if (!(chan = mbl_new(AST_STATE_RING, pvt, clip, NULL))) {
|
||||
if (!(chan = mbl_new(AST_STATE_RING, pvt, clip, NULL, NULL))) {
|
||||
ast_log(LOG_ERROR, "[%s] unable to allocate channel for incoming call\n", pvt->id);
|
||||
hfp_send_chup(pvt->hfp);
|
||||
msg_queue_push(pvt, AT_OK, AT_CHUP);
|
||||
@@ -3681,7 +3681,7 @@ static int handle_response_cmgr(struct mbl_pvt *pvt, char *buf)
|
||||
pvt->incoming_sms = 0;
|
||||
|
||||
/* XXX this channel probably does not need to be associated with this pvt */
|
||||
if (!(chan = mbl_new(AST_STATE_DOWN, pvt, NULL, NULL))) {
|
||||
if (!(chan = mbl_new(AST_STATE_DOWN, pvt, NULL, NULL, NULL))) {
|
||||
ast_debug(1, "[%s] error creating sms message channel, disconnecting\n", pvt->id);
|
||||
return -1;
|
||||
}
|
||||
@@ -4140,7 +4140,7 @@ static void *do_monitor_headset(void *data)
|
||||
|
||||
pvt->incoming = 1;
|
||||
|
||||
if (!(chan = mbl_new(AST_STATE_UP, pvt, NULL, NULL))) {
|
||||
if (!(chan = mbl_new(AST_STATE_UP, pvt, NULL, NULL, NULL))) {
|
||||
ast_log(LOG_ERROR, "[%s] unable to allocate channel for incoming call\n", pvt->id);
|
||||
ast_mutex_unlock(&pvt->lock);
|
||||
goto e_cleanup;
|
||||
|
@@ -71,7 +71,7 @@ static struct ast_jb_conf global_jbconf;
|
||||
|
||||
/* Channel Definition */
|
||||
static struct ast_channel *ooh323_request(const char *type, struct ast_format_cap *cap,
|
||||
const struct ast_channel *requestor, const char *data, int *cause);
|
||||
const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *data, int *cause);
|
||||
static int ooh323_digit_begin(struct ast_channel *ast, char digit);
|
||||
static int ooh323_digit_end(struct ast_channel *ast, char digit, unsigned int duration);
|
||||
static int ooh323_call(struct ast_channel *ast, const char *dest, int timeout);
|
||||
@@ -363,7 +363,8 @@ static pthread_t monitor_thread = AST_PTHREADT_NULL;
|
||||
|
||||
|
||||
static struct ast_channel *ooh323_new(struct ooh323_pvt *i, int state,
|
||||
const char *host, struct ast_format_cap *cap, const char *linkedid)
|
||||
const char *host, struct ast_format_cap *cap,
|
||||
const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor)
|
||||
{
|
||||
struct ast_channel *ch = NULL;
|
||||
struct ast_format tmpfmt;
|
||||
@@ -378,7 +379,7 @@ static struct ast_channel *ooh323_new(struct ooh323_pvt *i, int state,
|
||||
ast_mutex_unlock(&i->lock);
|
||||
ast_mutex_lock(&ooh323c_cn_lock);
|
||||
ch = ast_channel_alloc(1, state, i->callerid_num, i->callerid_name,
|
||||
i->accountcode, i->exten, i->context, linkedid, i->amaflags,
|
||||
i->accountcode, i->exten, i->context, assignedids, requestor, i->amaflags,
|
||||
"OOH323/%s-%ld", host, callnumber);
|
||||
callnumber++;
|
||||
ast_mutex_unlock(&ooh323c_cn_lock);
|
||||
@@ -569,7 +570,7 @@ static struct ooh323_pvt *ooh323_alloc(int callref, char *callToken)
|
||||
Possible data values - peername, exten/peername, exten@ip
|
||||
*/
|
||||
static struct ast_channel *ooh323_request(const char *type, struct ast_format_cap *cap,
|
||||
const struct ast_channel *requestor, const char *data, int *cause)
|
||||
const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *data, int *cause)
|
||||
|
||||
{
|
||||
struct ast_channel *chan = NULL;
|
||||
@@ -718,7 +719,7 @@ static struct ast_channel *ooh323_request(const char *type, struct ast_format_ca
|
||||
|
||||
|
||||
chan = ooh323_new(p, AST_STATE_DOWN, p->username, cap,
|
||||
requestor ? ast_channel_linkedid(requestor) : NULL);
|
||||
assignedids, requestor);
|
||||
|
||||
ast_mutex_unlock(&p->lock);
|
||||
|
||||
@@ -1918,7 +1919,7 @@ int ooh323_onReceivedSetup(ooCallData *call, Q931Message *pmsg)
|
||||
ooh323c_set_capability_for_call(call, &p->prefs, p->cap, p->dtmfmode, p->dtmfcodec,
|
||||
p->t38support, p->g729onlyA);
|
||||
/* Incoming call */
|
||||
c = ooh323_new(p, AST_STATE_RING, p->username, 0, NULL);
|
||||
c = ooh323_new(p, AST_STATE_RING, p->username, 0, NULL, NULL);
|
||||
if(!c) {
|
||||
ast_mutex_unlock(&p->lock);
|
||||
ast_log(LOG_ERROR, "Could not create ast_channel\n");
|
||||
|
Reference in New Issue
Block a user