[asterisk-commits] mmichelson: branch group/CCSS r221746 - in /team/group/CCSS: channels/ includ...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Oct 1 16:11:12 CDT 2009
Author: mmichelson
Date: Thu Oct 1 16:11:08 2009
New Revision: 221746
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=221746
Log:
Now the dialable extension name is magically
saved properly when a local channel is dialed.
This way, the CC_INTERFACES channel variable has
all the proper stuff in it when the time comes
to recall.
Modified:
team/group/CCSS/channels/chan_local.c
team/group/CCSS/include/asterisk/ccss.h
team/group/CCSS/main/ccss.c
Modified: team/group/CCSS/channels/chan_local.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/channels/chan_local.c?view=diff&rev=221746&r1=221745&r2=221746
==============================================================================
--- team/group/CCSS/channels/chan_local.c (original)
+++ team/group/CCSS/channels/chan_local.c Thu Oct 1 16:11:08 2009
@@ -544,6 +544,7 @@
struct ast_var_t *varptr = NULL, *new;
size_t len, namelen;
char *reduced_dest = ast_strdupa(dest);
+ char full_dest[AST_CHANNEL_NAME];
char *slash;
if (!p)
@@ -634,7 +635,9 @@
if ((slash = strrchr(reduced_dest, '/'))) {
*slash = '\0';
}
+ snprintf(full_dest, sizeof(full_dest), "Local/%s", dest);
ast_set_cc_interfaces_chanvar(p->chan, reduced_dest);
+ ast_cc_set_extension_dialable_name(p->chan, full_dest);
/* Start switch on sub channel */
if (!(res = ast_pbx_start(p->chan)))
Modified: team/group/CCSS/include/asterisk/ccss.h
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/include/asterisk/ccss.h?view=diff&rev=221746&r1=221745&r2=221746
==============================================================================
--- team/group/CCSS/include/asterisk/ccss.h (original)
+++ team/group/CCSS/include/asterisk/ccss.h Thu Oct 1 16:11:08 2009
@@ -380,7 +380,24 @@
/*!
* \since 1.6.4
*
- * \brief Start the CC process.
+ * \brief Set the dialable name for an extension
+ *
+ * An extension will look like "exten at context." But when it
+ * comes time to dial the extension again, what we actually will
+ * need to dial may be "Local/exten at context" or "Local/exten at context/n"
+ * or something like that. As such, we need to store this information
+ * when we call the local channel.
+ *
+ * Honestly, this function is only used by chan_local.c, and probably
+ * will never be used outside of that file, so you can safely ignore
+ * this function, most likely.
+ */
+void ast_cc_set_extension_dialable_name(struct ast_channel *chan, const char * const dialable_name);
+
+/*!
+ * \since 1.6.4
+ *
+ * \brief Start the CC process on a call.
*
* Whenever a CC-capable application, such as Dial, wishes to
* engage in CC activity, it initiates the process by calling this
Modified: team/group/CCSS/main/ccss.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/main/ccss.c?view=diff&rev=221746&r1=221745&r2=221746
==============================================================================
--- team/group/CCSS/main/ccss.c (original)
+++ team/group/CCSS/main/ccss.c Thu Oct 1 16:11:08 2009
@@ -548,6 +548,7 @@
{
struct dialed_cc_interfaces *cc_interfaces = data;
ao2_t_ref(cc_interfaces->interface_tree, -1, "Unref dial's ref to interface tree");
+ ast_free(cc_interfaces->current_extension_dialable_name);
ast_free(cc_interfaces);
}
@@ -612,6 +613,23 @@
cc_interfaces->done = 1;
}
ast_channel_unlock(chan);
+}
+
+void ast_cc_set_extension_dialable_name(struct ast_channel *chan, const char * const dialable_name)
+{
+ struct ast_datastore *datastore;
+ struct dialed_cc_interfaces *cc_interfaces;
+
+ ast_channel_lock(chan);
+ if (!(datastore = ast_channel_datastore_find(chan, &dialed_cc_interfaces_info, NULL))) {
+ ast_channel_unlock(chan);
+ return;
+ }
+
+ cc_interfaces = datastore->data;
+ cc_interfaces->current_extension_dialable_name = ast_strdup(dialable_name);
+ ast_channel_unlock(chan);
+ return;
}
/*!
@@ -931,6 +949,10 @@
S_OR(chan->macrocontext, chan->context), interfaces->dial_parent_id))) {
return -1;
}
+ /* In situation 2, chan_local will have set the extension's dialable name
+ * on the datastore, so we need to copy that into this tree_item.
+ */
+ tree_item->dialable_name = ast_strdup(interfaces->current_extension_dialable_name);
AST_LIST_LOCK(interfaces->interface_tree);
AST_LIST_INSERT_TAIL(interfaces->interface_tree, tree_item, next);
AST_LIST_UNLOCK(interfaces->interface_tree);
@@ -2416,7 +2438,7 @@
* need to instead use a monitor callback to determine what the name
* we should use is.
*/
- ast_str_append(&var_value, 0, "%s%s", multi ? "&" : "", tree_item_iter->interface->name);
+ ast_str_append(&var_value, 0, "%s%s", multi ? "&" : "", S_OR(tree_item_iter->dialable_name, tree_item_iter->interface->name));
multi = 1;
}
}
More information about the asterisk-commits
mailing list