[asterisk-commits] crichter: branch 1.2 r50495 - in /branches/1.2/channels: ./ misdn/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Jan 11 06:27:53 MST 2007


Author: crichter
Date: Thu Jan 11 07:27:52 2007
New Revision: 50495

URL: http://svn.digium.com/view/asterisk?view=rev&rev=50495
Log:
* more additions to make the RESTART message work
* added fix for misdn_call to allow SETUPs with empty 
  extensions, replaced the strtok_r functions with strsep for that 
  (inspired by Sandro Cappellazzo, thanks)


Modified:
    branches/1.2/channels/chan_misdn.c
    branches/1.2/channels/misdn/isdn_lib.c
    branches/1.2/channels/misdn/isdn_msg_parser.c

Modified: branches/1.2/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/channels/chan_misdn.c?view=diff&rev=50495&r1=50494&r2=50495
==============================================================================
--- branches/1.2/channels/chan_misdn.c (original)
+++ branches/1.2/channels/chan_misdn.c Thu Jan 11 07:27:52 2007
@@ -1623,23 +1623,21 @@
 	int r;
 	struct chan_list *ch=MISDN_ASTERISK_TECH_PVT(ast);
 	struct misdn_bchannel *newbc;
-	char *opts=NULL, *ext,*tokb;
+	char *opts=NULL, *ext;
 	char dest_cp[256];
 	
 	{
 		strncpy(dest_cp,dest,sizeof(dest_cp)-1);
 		dest_cp[sizeof(dest_cp)]=0;
-		
-		ext=strtok_r(dest_cp,"/",&tokb);
-		
+
+		ext=dest_cp;
+		strsep(&ext,"/");
 		if (ext) {
-			ext=strtok_r(NULL,"/",&tokb);
-			if (ext) {
-				opts=strtok_r(NULL,"/",&tokb);
-			} else {
-				chan_misdn_log(0,0,"misdn_call: No Extension given!\n");
-				return -1;
-			}
+			opts=ext;
+			strsep(&opts,"/");
+		}  else {
+			ast_log(LOG_WARNING, "Malformed dialstring\n");
+			return -1;
 		}
 	}
 

Modified: branches/1.2/channels/misdn/isdn_lib.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/channels/misdn/isdn_lib.c?view=diff&rev=50495&r1=50494&r2=50495
==============================================================================
--- branches/1.2/channels/misdn/isdn_lib.c (original)
+++ branches/1.2/channels/misdn/isdn_lib.c Thu Jan 11 07:27:52 2007
@@ -3587,12 +3587,12 @@
 	struct misdn_bchannel dummybc;
 	memset (&dummybc,0,sizeof(dummybc));
 	dummybc.port=stack->port;
-	dummybc.l3_id=MISDN_ID_DUMMY;
+	dummybc.l3_id=MISDN_ID_GLOBAL;
 	dummybc.nt=stack->nt;
 
 	int max=stack->pri?30:2;
 	int i;
-	for (i=1;i<max;i++) {
+	for (i=1;i<=max;i++) {
 		dummybc.channel=i;
 		cb_log(0, port, "Restarting channel %d\n",i);
 		misdn_lib_send_event(&dummybc, EVENT_RESTART);
@@ -3722,6 +3722,16 @@
 					iframe_t *frm = (iframe_t *)msg->data;
 					struct misdn_bchannel *bc = find_bc_by_l3id(stack, frm->dinfo);
 					if (bc) send_msg(glob_mgr->midev, bc, msg);
+					else  {
+						if (frm->dinfo == MISDN_ID_GLOBAL) {
+							struct misdn_bchannel dummybc;
+							memset (&dummybc,0,sizeof(dummybc));
+							dummybc.port=stack->port;
+							dummybc.l3_id=MISDN_ID_GLOBAL;
+							dummybc.nt=stack->nt;
+							send_msg(glob_mgr->midev, &dummybc, msg);
+						}
+					}
 				}
 			}
 		}

Modified: branches/1.2/channels/misdn/isdn_msg_parser.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/channels/misdn/isdn_msg_parser.c?view=diff&rev=50495&r1=50494&r2=50495
==============================================================================
--- branches/1.2/channels/misdn/isdn_msg_parser.c (original)
+++ branches/1.2/channels/misdn/isdn_msg_parser.c Thu Jan 11 07:27:52 2007
@@ -794,10 +794,14 @@
 	msg_t *msg =(msg_t*)create_l3msg(CC_RESTART | REQUEST, MT_RESTART,  bc?bc->l3_id:-1, sizeof(RESTART_t) ,nt); 
  
 	restart=(RESTART_t*)((msg->data+HEADER_LEN)); 
-
+	
 #if DEBUG 
 	printf("Building RESTART Msg\n"); 
 #endif
+	enc_ie_channel_id(&restart->CHANNEL_ID, msg, 1,bc->channel, nt,bc);
+
+	cb_log(0,bc->port, "Restarting channel %d\n", bc->channel);
+	
 	return msg; 
 }
 



More information about the asterisk-commits mailing list