[asterisk-commits] mmichelson: branch group/CCSS r225240 - /team/group/CCSS/main/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Oct 21 14:07:03 CDT 2009
Author: mmichelson
Date: Wed Oct 21 14:07:00 2009
New Revision: 225240
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=225240
Log:
Use the new ast_channel_get_device name function in all
CC-related functions.
A round of testing and then I'll be moving on to manager events!
Modified:
team/group/CCSS/main/ccss.c
team/group/CCSS/main/channel.c
Modified: team/group/CCSS/main/ccss.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/main/ccss.c?view=diff&rev=225240&r1=225239&r2=225240
==============================================================================
--- team/group/CCSS/main/ccss.c (original)
+++ team/group/CCSS/main/ccss.c Wed Oct 21 14:07:00 2009
@@ -1508,23 +1508,12 @@
void ast_handle_cc_control_frame(struct ast_channel *inbound, struct ast_channel *outbound, void *frame_data)
{
char device_name[AST_CHANNEL_NAME];
- char *dash;
struct cc_tree_item *tree_item;
struct ast_datastore *cc_datastore;
struct dialed_cc_interfaces *cc_interfaces;
struct ast_control_cc_payload *cc_data = frame_data;
- /* XXX There have been discussions that indicate that hacking up the channel name is not
- * the ideal way to determine the device name of the dialed interface since ISDN channels
- * in particular can potentially change names, and their names are based on the B channel
- * chosen, not the device dialed. Furthermore, an ISDN channel has the potential to change
- * names. The correct way to handle this is to make the dialed device name part of the
- * payload for the CC control frame.
- */
- ast_copy_string(device_name, outbound->name, sizeof(device_name));
- if ((dash = strrchr(device_name, '-'))) {
- *dash = '\0';
- }
+ ast_channel_get_device_name(outbound, device_name, sizeof(device_name));
if (!(cc_datastore = ast_channel_datastore_find(inbound, &dialed_cc_interfaces_info, NULL))) {
ast_log(LOG_WARNING, "Unable to retrieve CC datastore while processing CC frame from '%s'. CC services will be unavailable.\n", device_name);
@@ -1987,16 +1976,12 @@
int ast_cc_core_init_instance(struct ast_channel *caller_chan,
struct ast_cc_interface_tree *called_tree)
{
- char *caller = ast_strdupa(caller_chan->name);
- char *dash = strrchr(caller, '-');
+ char caller[AST_CHANNEL_NAME];
struct cc_core_instance *core_instance;
int core_id;
long agent_count;
- if (dash) {
- *dash = '\0';
- }
-
+ ast_channel_get_device_name(caller_chan, caller, sizeof(caller));
/* First, we need to kill off other pending CC offers from caller. If the caller is going
* to request a CC service, it may only be for the latest call he made.
*/
@@ -2475,14 +2460,10 @@
{
struct cc_core_instance *core_instance;
char interface[AST_CHANNEL_NAME];
- char *dash;
unsigned long match_flags;
int res;
- ast_copy_string(interface, chan->name, sizeof(interface));
- if ((dash = strrchr(interface, '-'))) {
- *dash = '\0';
- }
+ ast_channel_get_device_name(chan, interface, sizeof(interface));
match_flags = MATCH_NO_MONITOR;
if (!(core_instance = ao2_t_callback_data(cc_core_instances, 0, match_agent, interface, &match_flags, "Find core instance for CallCompletionRequest"))) {
@@ -2515,14 +2496,10 @@
{
struct cc_core_instance *core_instance;
char interface[AST_CHANNEL_NAME];
- char *dash;
unsigned long match_flags;
int res;
- ast_copy_string(interface, chan->name, sizeof(interface));
- if ((dash = strrchr(interface, '-'))) {
- *dash = '\0';
- }
+ ast_channel_get_device_name(chan, interface, sizeof(interface));
match_flags = MATCH_MONITOR;
if (!(core_instance = ao2_t_callback_data(cc_core_instances, 0, match_agent, interface, &match_flags, "Find core instance for CallCompletionCancel"))) {
Modified: team/group/CCSS/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/main/channel.c?view=diff&rev=225240&r1=225239&r2=225240
==============================================================================
--- team/group/CCSS/main/channel.c (original)
+++ team/group/CCSS/main/channel.c Wed Oct 21 14:07:00 2009
@@ -7230,16 +7230,12 @@
struct ast_frame frame = {.frametype = AST_FRAME_CONTROL, .subclass = AST_CONTROL_CC };
struct ast_control_cc_payload *payload;
char chan_name[AST_CHANNEL_NAME];
- char *dash;
if (!(payload = ast_calloc(1, sizeof(*payload)))) {
return -1;
}
- ast_copy_string(chan_name, chan->name, sizeof(chan_name));
- if ((dash = strrchr(chan_name, '-'))) {
- *dash = '\0';
- }
+ ast_channel_get_device_name(chan, chan_name, sizeof(chan_name));
if (ast_cc_monitor_count(chan_name, monitor_type) >= ast_get_cc_max_monitors(ast_channel_get_cc_config_params(chan))) {
ast_log(LOG_NOTICE, "Not queuing a CC frame for channel %s since it already has its maximum monitors allocated\n", chan_name);
More information about the asterisk-commits
mailing list