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/



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@410157 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Scott Griepentrog
2014-03-07 15:46:32 +00:00
parent 9b77c08180
commit 7bcf69eaad
88 changed files with 1932 additions and 526 deletions
+1 -1
View File
@@ -1367,7 +1367,7 @@ static struct ast_bridge *bridge_agent_hold_new(void)
bridge = bridge_base_init(bridge, AST_BRIDGE_CAPABILITY_HOLDING,
AST_BRIDGE_FLAG_MERGE_INHIBIT_TO | AST_BRIDGE_FLAG_MERGE_INHIBIT_FROM
| AST_BRIDGE_FLAG_SWAP_INHIBIT_FROM | AST_BRIDGE_FLAG_TRANSFER_PROHIBITED,
"AgentPool", NULL);
"AgentPool", NULL, NULL);
bridge = bridge_register(bridge);
return bridge;
}
+1 -1
View File
@@ -361,7 +361,7 @@ static struct wait_bridge_wrapper *get_wait_bridge_wrapper(const char *bridge_na
AST_BRIDGE_FLAG_MERGE_INHIBIT_TO | AST_BRIDGE_FLAG_MERGE_INHIBIT_FROM
| AST_BRIDGE_FLAG_SWAP_INHIBIT_TO | AST_BRIDGE_FLAG_SWAP_INHIBIT_FROM
| AST_BRIDGE_FLAG_TRANSFER_PROHIBITED | AST_BRIDGE_FLAG_DISSOLVE_EMPTY,
APP_NAME, bridge_name);
APP_NAME, bridge_name, NULL);
if (!bridge) {
return NULL;
+1 -1
View File
@@ -171,7 +171,7 @@ static int chanavail_exec(struct ast_channel *chan, const char *data)
}
snprintf(tmp, sizeof(tmp), "%d", status);
ast_str_append(&tmp_availstat, 0, "%s%s", ast_str_strlen(tmp_availstat) ? "&" : "", tmp);
if ((inuse <= 1) && (tempchan = ast_request(tech, ast_channel_nativeformats(chan), chan, number, &status))) {
if ((inuse <= 1) && (tempchan = ast_request(tech, ast_channel_nativeformats(chan), NULL, chan, number, &status))) {
ast_str_append(&tmp_availchan, 0, "%s%s", ast_str_strlen(tmp_availchan) ? "&" : "", ast_channel_name(tempchan));
snprintf(tmp, sizeof(tmp), "%s/%s", tech, number);
+3 -3
View File
@@ -677,7 +677,7 @@ static int conf_start_record(struct confbridge_conference *conference)
ast_format_cap_add(cap, ast_format_set(&format, AST_FORMAT_SLINEAR, 0));
conference->record_chan = ast_request("CBRec", cap, NULL,
conference->record_chan = ast_request("CBRec", cap, NULL, NULL,
conference->name, NULL);
cap = ast_format_cap_destroy(cap);
if (!conference->record_chan) {
@@ -1205,7 +1205,7 @@ static struct confbridge_conference *join_conference_bridge(const char *conferen
/* Create an actual bridge that will do the audio mixing */
conference->bridge = ast_bridge_base_new(AST_BRIDGE_CAPABILITY_MULTIMIX,
AST_BRIDGE_FLAG_MASQUERADE_ONLY | AST_BRIDGE_FLAG_TRANSFER_BRIDGE_ONLY,
app, conference_name);
app, conference_name, NULL);
if (!conference->bridge) {
ao2_ref(conference, -1);
conference = NULL;
@@ -1357,7 +1357,7 @@ static int alloc_playback_chan(struct confbridge_conference *conference)
return -1;
}
ast_format_cap_add(cap, ast_format_set(&format, AST_FORMAT_SLINEAR, 0));
conference->playback_chan = ast_request("CBAnn", cap, NULL,
conference->playback_chan = ast_request("CBAnn", cap, NULL, NULL,
conference->name, NULL);
cap = ast_format_cap_destroy(cap);
if (!conference->playback_chan) {
+2 -2
View File
@@ -867,7 +867,7 @@ static void do_forward(struct chanlist *o, struct cause_args *num,
cause = AST_CAUSE_BUSY;
} else {
/* Setup parameters */
c = o->chan = ast_request(tech, ast_channel_nativeformats(in), in, stuff, &cause);
c = o->chan = ast_request(tech, ast_channel_nativeformats(in), NULL, in, stuff, &cause);
if (c) {
if (single && !caller_entertained) {
ast_channel_make_compatible(in, o->chan);
@@ -2422,7 +2422,7 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast
AST_LIST_UNLOCK(dialed_interfaces);
}
tc = ast_request(tmp->tech, ast_channel_nativeformats(chan), chan, tmp->number, &cause);
tc = ast_request(tmp->tech, ast_channel_nativeformats(chan), NULL, chan, tmp->number, &cause);
if (!tc) {
/* If we can't, just go on to the next call */
ast_log(LOG_WARNING, "Unable to create channel of type '%s' (cause %d - %s)\n",
+1 -1
View File
@@ -1056,7 +1056,7 @@ static struct ast_channel *findmeexec(struct fm_args *tpargs, struct ast_channel
? "/n" : "/m");
}
outbound = ast_request("Local", ast_channel_nativeformats(caller), caller,
outbound = ast_request("Local", ast_channel_nativeformats(caller), NULL, caller,
tmpuser->dialarg, &dg);
if (!outbound) {
ast_log(LOG_WARNING, "Unable to allocate a channel for Local/%s cause: %s\n",
+6 -6
View File
@@ -1667,7 +1667,7 @@ static struct ast_conference *build_conf(const char *confno, const char *pin,
cnf->dahdiconf = dahdic.confno;
/* Setup a new channel for playback of audio files */
cnf->chan = ast_request("DAHDI", cap_slin, chan, "pseudo", NULL);
cnf->chan = ast_request("DAHDI", cap_slin, NULL, chan, "pseudo", NULL);
if (cnf->chan) {
ast_set_read_format_by_id(cnf->chan, AST_FORMAT_SLINEAR);
ast_set_write_format_by_id(cnf->chan, AST_FORMAT_SLINEAR);
@@ -3087,7 +3087,7 @@ static void meetme_menu_admin_extended(enum menu_modes *menu_mode, int *dtmf, st
}
ast_mutex_lock(&conf->recordthreadlock);
if ((conf->recordthread == AST_PTHREADT_NULL) && ast_test_flag64(confflags, CONFFLAG_RECORDCONF) && ((conf->lchan = ast_request("DAHDI", cap_slin, chan, "pseudo", NULL)))) {
if ((conf->recordthread == AST_PTHREADT_NULL) && ast_test_flag64(confflags, CONFFLAG_RECORDCONF) && ((conf->lchan = ast_request("DAHDI", cap_slin, NULL, chan, "pseudo", NULL)))) {
ast_set_read_format_by_id(conf->lchan, AST_FORMAT_SLINEAR);
ast_set_write_format_by_id(conf->lchan, AST_FORMAT_SLINEAR);
dahdic->chan = 0;
@@ -3341,7 +3341,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc
ast_mutex_lock(&conf->recordthreadlock);
if ((conf->recordthread == AST_PTHREADT_NULL) && ast_test_flag64(confflags, CONFFLAG_RECORDCONF) &&
((conf->lchan = ast_request("DAHDI", cap_slin, chan, "pseudo", NULL)))) {
((conf->lchan = ast_request("DAHDI", cap_slin, NULL, chan, "pseudo", NULL)))) {
ast_set_read_format_by_id(conf->lchan, AST_FORMAT_SLINEAR);
ast_set_write_format_by_id(conf->lchan, AST_FORMAT_SLINEAR);
dahdic.chan = 0;
@@ -6344,7 +6344,7 @@ static int sla_ring_station(struct sla_ringing_trunk *ringing_trunk, struct sla_
tech_data = ast_strdupa(station->device);
tech = strsep(&tech_data, "/");
if (ast_dial_append(dial, tech, tech_data) == -1) {
if (ast_dial_append(dial, tech, tech_data, NULL) == -1) {
ast_dial_destroy(dial);
return -1;
}
@@ -6850,7 +6850,7 @@ static void *dial_trunk(void *data)
tech_data = ast_strdupa(trunk_ref->trunk->device);
tech = strsep(&tech_data, "/");
if (ast_dial_append(dial, tech, tech_data) == -1) {
if (ast_dial_append(dial, tech, tech_data, NULL) == -1) {
ast_mutex_lock(args->cond_lock);
ast_cond_signal(args->cond);
ast_mutex_unlock(args->cond_lock);
@@ -8132,7 +8132,7 @@ AST_TEST_DEFINE(test_meetme_data_provider)
break;
}
chan = ast_channel_alloc(0, AST_STATE_DOWN, NULL, NULL, NULL, NULL, NULL, 0, 0, "MeetMeTest");
chan = ast_channel_alloc(0, AST_STATE_DOWN, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, "MeetMeTest");
if (!chan) {
ast_test_status_update(test, "Channel allocation failed\n");
return AST_TEST_FAIL;
+2 -2
View File
@@ -178,14 +178,14 @@ static int originate_exec(struct ast_channel *chan, const char *data)
ast_pbx_outgoing_exten(chantech, cap_slin, chandata,
timeout * 1000, args.arg1, exten, priority, &outgoing_status, 0, NULL,
NULL, NULL, NULL, NULL, 0);
NULL, NULL, NULL, NULL, 0, NULL);
} else if (!strcasecmp(args.type, "app")) {
ast_debug(1, "Originating call to '%s/%s' and connecting them to %s(%s)\n",
chantech, chandata, args.arg1, S_OR(args.arg2, ""));
ast_pbx_outgoing_app(chantech, cap_slin, chandata,
timeout * 1000, args.arg1, args.arg2, &outgoing_status, 0, NULL,
NULL, NULL, NULL, NULL);
NULL, NULL, NULL, NULL, NULL);
} else {
ast_log(LOG_ERROR, "Incorrect type, it should be 'exten' or 'app': %s\n",
args.type);
+1 -1
View File
@@ -318,7 +318,7 @@ static int page_exec(struct ast_channel *chan, const char *data)
}
/* Append technology and resource */
if (ast_dial_append(dial, tech, resource) == -1) {
if (ast_dial_append(dial, tech, resource, NULL) == -1) {
ast_log(LOG_ERROR, "Failed to add %s to outbound dial\n", tech);
ast_dial_destroy(dial);
continue;
+2 -2
View File
@@ -4058,7 +4058,7 @@ static int ring_entry(struct queue_ent *qe, struct callattempt *tmp, int *busies
}
/* Request the peer */
tmp->chan = ast_request(tech, ast_channel_nativeformats(qe->chan), qe->chan, location, &status);
tmp->chan = ast_request(tech, ast_channel_nativeformats(qe->chan), NULL, qe->chan, location, &status);
if (!tmp->chan) { /* If we can't, just go on to the next call */
ao2_lock(qe->parent);
qe->parent->rrpos++;
@@ -4586,7 +4586,7 @@ static struct callattempt *wait_for_answer(struct queue_ent *qe, struct callatte
ast_verb(3, "Now forwarding %s to '%s/%s' (thanks to %s)\n", inchan_name, tech, stuff, ochan_name);
/* Setup parameters */
o->chan = ast_request(tech, ast_channel_nativeformats(in), in, stuff, &status);
o->chan = ast_request(tech, ast_channel_nativeformats(in), NULL, in, stuff, &status);
if (!o->chan) {
ast_log(LOG_NOTICE,
"Forwarding failed to create channel to dial '%s/%s'\n",
+1 -1
View File
@@ -13779,7 +13779,7 @@ AST_TEST_DEFINE(test_voicemail_vmsayname)
break;
}
if (!(test_channel1 = ast_channel_alloc(0, AST_STATE_DOWN, NULL, NULL, NULL,
if (!(test_channel1 = ast_channel_alloc(0, AST_STATE_DOWN, NULL, NULL, NULL, NULL,
NULL, NULL, 0, 0, "TestChannel1"))) {
goto exit_vmsayname_test;
}
+2 -2
View File
@@ -77,7 +77,7 @@ static void announce_pvt_destructor(void *vdoomed)
doomed->bridge = NULL;
}
static struct ast_channel *announce_request(const char *type, struct ast_format_cap *cap, const struct ast_channel *requestor, const char *data, int *cause)
static struct ast_channel *announce_request(const char *type, struct ast_format_cap *cap, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *data, int *cause)
{
struct ast_channel *chan;
const char *conf_name = data;
@@ -102,7 +102,7 @@ static struct ast_channel *announce_request(const char *type, struct ast_format_
ao2_ref(pvt->bridge, +1);
chan = ast_unreal_new_channels(&pvt->base, conf_announce_get_tech(),
AST_STATE_UP, AST_STATE_UP, NULL, NULL, requestor, NULL);
AST_STATE_UP, AST_STATE_UP, NULL, NULL, assignedids, requestor, NULL);
if (chan) {
ast_answer(pvt->base.owner);
ast_answer(pvt->base.chan);
+2 -2
View File
@@ -53,13 +53,13 @@ static int rec_write(struct ast_channel *ast, struct ast_frame *f)
return 0;
}
static struct ast_channel *rec_request(const char *type, struct ast_format_cap *cap, const struct ast_channel *requestor, const char *data, int *cause)
static struct ast_channel *rec_request(const char *type, struct ast_format_cap *cap, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *data, int *cause)
{
struct ast_channel *chan;
struct ast_format format;
const char *conf_name = data;
chan = ast_channel_alloc(1, AST_STATE_UP, NULL, NULL, NULL, NULL, NULL, NULL, 0,
chan = ast_channel_alloc(1, AST_STATE_UP, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0,
"CBRec/conf-%s-uid-%d",
conf_name, (int) ast_random());
if (!chan) {