[asterisk-commits] rmudgett: branch group/v14_colp r157979 - /team/group/v14_colp/channels/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Nov 19 18:51:12 CST 2008


Author: rmudgett
Date: Wed Nov 19 18:51:11 2008
New Revision: 157979

URL: http://svn.digium.com/view/asterisk?view=rev&rev=157979
Log:
Merged revision 157977 from
https://origsvn.digium.com/svn/asterisk/team/group/issue8824

........
Fixes JIRA ABE-1726

The dial extension could be empty if you are using MISDN_KEYPAD
to control ISDN provider features.

Modified:
    team/group/v14_colp/channels/chan_misdn.c

Modified: team/group/v14_colp/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/team/group/v14_colp/channels/chan_misdn.c?view=diff&rev=157979&r1=157978&r2=157979
==============================================================================
--- team/group/v14_colp/channels/chan_misdn.c (original)
+++ team/group/v14_colp/channels/chan_misdn.c Wed Nov 19 18:51:11 2008
@@ -2836,7 +2836,7 @@
 	int number_type;
 	struct chan_list *ch;
 	struct misdn_bchannel *newbc;
-	char *opts = NULL, *ext, *tokb;
+	char *opts, *ext;
 	char *dest_cp;
 
 	if (!ast) {
@@ -2867,20 +2867,21 @@
 		return -1;
 	}
 
+	/*
+	 * dest is ---v
+	 * Dial(mISDN/g:group_name[/extension[/options]])
+	 * Dial(mISDN/port[:preselected_channel][/extension[/options]])
+	 *
+	 * The dial extension could be empty if you are using MISDN_KEYPAD
+	 * to control ISDN provider features.
+	 */
 	dest_cp = ast_strdupa(dest);
-	ext = strtok_r(dest_cp, "/", &tokb);
-	if (ext) {
-		ext = strtok_r(NULL, "/", &tokb);
-		if (ext) {
-			opts = strtok_r(NULL, "/", &tokb);
-		}
-	}
+	strsep(&dest_cp, "/");/* Discard port/group token */
+	ext = strsep(&dest_cp, "/");
 	if (!ext) {
-		chan_misdn_log(0, 0, "misdn_call: No Extension given!\n");
-		ast->hangupcause = AST_CAUSE_NORMAL_TEMPORARY_FAILURE;
-		ast_setstate(ast, AST_STATE_DOWN);
-		return -1;
-	}
+		ext = "";
+	}
+	opts = dest_cp;
 	
 	port = newbc->port;
 
@@ -3901,22 +3902,29 @@
 	struct ast_channel *tmp = NULL;
 	char group[BUFFERSIZE + 1] = "";
 	char dial_str[128];
-	char *buf2 = ast_strdupa(data), *ext, *port_str;
-	char *tokb = NULL, *p = NULL;
-	int channel = 0, port = 0;
+	char *buf2 = ast_strdupa(data);
+	char *ext;
+	char *port_str;
+	char *p = NULL;
+	int channel = 0;
+	int port = 0;
 	struct misdn_bchannel *newbc = NULL;
 	int dec = 0;
 
 	struct chan_list *cl;
 
-	snprintf(dial_str, sizeof(dial_str), "%s/%s", misdn_type, (char*)data);
-
-	/* 
-	 * Dial(mISDN/g:group_name/extension[/options])
-	 * Dial(mISDN/port[:preselected_channel]/extension[/options])
+	snprintf(dial_str, sizeof(dial_str), "%s/%s", misdn_type, (char *) data);
+
+	/*
+	 * data is ---v
+	 * Dial(mISDN/g:group_name[/extension[/options]])
+	 * Dial(mISDN/port[:preselected_channel][/extension[/options]])
+	 *
+	 * The dial extension could be empty if you are using MISDN_KEYPAD
+	 * to control ISDN provider features.
 	 */
-	port_str = strtok_r(buf2, "/", &tokb);
-	if (port_str) {
+	port_str = strsep(&buf2, "/");
+	if (!ast_strlen_zero(port_str)) {
 		if (port_str[0] == 'g' && port_str[1] == ':' ) {
 			/* We make a group call lets checkout which ports are in my group */
 			port_str += 2;
@@ -3936,10 +3944,9 @@
 		return NULL;
 	}
 
-	ext = strtok_r(NULL, "/", &tokb);
+	ext = strsep(&buf2, "/");
 	if (!ext) {
-		ast_log(LOG_WARNING, " --> ! IND : Dial(%s) WITHOUT extension, check extensions.conf\n", dial_str);
-		return NULL;
+		ext = "";
 	}
 
 	if (misdn_cfg_is_group_method(group, METHOD_STANDARD_DEC)) {
@@ -4522,7 +4529,7 @@
 		ast->cid.cid_name ? ast->cid.cid_name : "",
 		ast->cid.cid_num ? ast->cid.cid_num : "");
   
-	strncpy(ast->exten, "s", 2);
+	strcpy(ast->exten, "s");
   
 	if (pbx_start_chan(ch) < 0) {
 		ast = NULL;
@@ -5005,7 +5012,6 @@
 		ch->addr = bc->addr;
 
 		chan = misdn_new(ch, AST_STATE_RESERVED, bc->dialed.number, bc->caller.number, AST_FORMAT_ALAW, bc->port, bc->channel);
-
 		if (!chan) {
 			misdn_lib_send_event(bc,EVENT_RELEASE_COMPLETE);
 			ast_log(LOG_ERROR, "cb_events: misdn_new failed !\n"); 




More information about the asterisk-commits mailing list