diff options
author | Scott Griepentrog <sgriepentrog@digium.com> | 2014-03-07 15:47:55 +0000 |
---|---|---|
committer | Scott Griepentrog <sgriepentrog@digium.com> | 2014-03-07 15:47:55 +0000 |
commit | 80ef9a21b9d91ff0bafc304923bc29effa230b00 (patch) | |
tree | a67db39a4c17a4b01a87201ef37ffdc43189c119 /main/bridge.c | |
parent | d3ac8b8a0e70049af7b5552c4dfd8adc2cc5df11 (diff) |
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
Diffstat (limited to 'main/bridge.c')
-rw-r--r-- | main/bridge.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/main/bridge.c b/main/bridge.c index 8acf260d1..1baf01cfc 100644 --- a/main/bridge.c +++ b/main/bridge.c @@ -732,7 +732,7 @@ struct ast_bridge *bridge_alloc(size_t size, const struct ast_bridge_methods *v_ return bridge; } -struct ast_bridge *bridge_base_init(struct ast_bridge *self, uint32_t capabilities, unsigned int flags, const char *creator, const char *name) +struct ast_bridge *bridge_base_init(struct ast_bridge *self, uint32_t capabilities, unsigned int flags, const char *creator, const char *name, const char *id) { char uuid_hold[AST_UUID_STR_LEN]; @@ -740,8 +740,12 @@ struct ast_bridge *bridge_base_init(struct ast_bridge *self, uint32_t capabiliti return NULL; } - ast_uuid_generate_str(uuid_hold, AST_UUID_STR_LEN); - ast_string_field_set(self, uniqueid, uuid_hold); + if (!ast_strlen_zero(id)) { + ast_string_field_set(self, uniqueid, id); + } else { + ast_uuid_generate_str(uuid_hold, AST_UUID_STR_LEN); + ast_string_field_set(self, uniqueid, uuid_hold); + } ast_string_field_set(self, creator, creator); if (!ast_strlen_zero(creator)) { ast_string_field_set(self, name, name); @@ -901,12 +905,12 @@ struct ast_bridge_methods ast_bridge_base_v_table = { .get_merge_priority = bridge_base_get_merge_priority, }; -struct ast_bridge *ast_bridge_base_new(uint32_t capabilities, unsigned int flags, const char *creator, const char *name) +struct ast_bridge *ast_bridge_base_new(uint32_t capabilities, unsigned int flags, const char *creator, const char *name, const char *id) { void *bridge; bridge = bridge_alloc(sizeof(struct ast_bridge), &ast_bridge_base_v_table); - bridge = bridge_base_init(bridge, capabilities, flags, creator, name); + bridge = bridge_base_init(bridge, capabilities, flags, creator, name, id); bridge = bridge_register(bridge); return bridge; } @@ -3716,7 +3720,7 @@ static enum ast_transfer_result blind_transfer_bridge(struct ast_channel *transf int cause; snprintf(chan_name, sizeof(chan_name), "%s@%s", exten, context); - local = ast_request("Local", ast_channel_nativeformats(transferer), transferer, + local = ast_request("Local", ast_channel_nativeformats(transferer), NULL, transferer, chan_name, &cause); if (!local) { return AST_BRIDGE_TRANSFER_FAIL; @@ -3879,7 +3883,7 @@ static enum ast_transfer_result attended_transfer_bridge(struct ast_channel *cha int res; const char *app = NULL; - local_chan = ast_request("Local", ast_channel_nativeformats(chan1), chan1, + local_chan = ast_request("Local", ast_channel_nativeformats(chan1), NULL, chan1, dest, &cause); if (!local_chan) { |