[asterisk-commits] crichter: branch 1.4 r68644 - in /branches/1.4:
./ channels/ channels/misdn/
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Mon Jun 11 03:29:18 MST 2007
Author: crichter
Date: Mon Jun 11 05:29:18 2007
New Revision: 68644
URL: http://svn.digium.com/view/asterisk?view=rev&rev=68644
Log:
Merged revisions 68631 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r68631 | crichter | 2007-06-11 11:18:01 +0200 (Mo, 11 Jun 2007) | 1 line
fixed problem that the dummybc chanels had no lock, checking for the lock now. Also fixed the channel restart stuff, we can now specify and restart particular channels too.
........
Modified:
branches/1.4/ (props changed)
branches/1.4/channels/chan_misdn.c
branches/1.4/channels/misdn/ie.c
branches/1.4/channels/misdn/isdn_lib.c
branches/1.4/channels/misdn/isdn_lib.h
branches/1.4/channels/misdn/isdn_msg_parser.c
Propchange: branches/1.4/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.
Modified: branches/1.4/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_misdn.c?view=diff&rev=68644&r1=68643&r2=68644
==============================================================================
--- branches/1.4/channels/chan_misdn.c (original)
+++ branches/1.4/channels/chan_misdn.c Mon Jun 11 05:29:18 2007
@@ -793,7 +793,7 @@
static int misdn_port_block(int fd, int argc, char *argv[])
{
int port;
-
+
if (argc != 4)
return RESULT_SHOWUSAGE;
@@ -844,20 +844,6 @@
misdn_lib_pid_restart(pid);
- return 0;
-}
-
-static int misdn_send_restart(int fd, int argc, char *argv[])
-{
- int port;
-
- if (argc != 4)
- return RESULT_SHOWUSAGE;
-
- port = atoi(argv[3]);
-
- misdn_lib_send_restart(port);
-
return 0;
}
@@ -1278,6 +1264,25 @@
}
return 0;
+}
+
+static int misdn_send_restart(int fd, int argc, char *argv[])
+{
+ int port;
+ int channel;
+
+ if ( (argc < 4) || (argc > 5) )
+ return RESULT_SHOWUSAGE;
+
+ port = atoi(argv[3]);
+
+ if (argc==5) {
+ channel = atoi(argv[4]);
+ misdn_lib_send_restart(port, channel);
+ } else
+ misdn_lib_send_restart(port, -1 );
+
+ return 0;
}
static int misdn_send_digit (int fd, int argc, char *argv[])
Modified: branches/1.4/channels/misdn/ie.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/misdn/ie.c?view=diff&rev=68644&r1=68643&r2=68644
==============================================================================
--- branches/1.4/channels/misdn/ie.c (original)
+++ branches/1.4/channels/misdn/ie.c Mon Jun 11 05:29:18 2007
@@ -1402,3 +1402,21 @@
}
#endif
+/* IE_DISPLAY */
+static void enc_ie_restart_ind(unsigned char **ntmode, msg_t *msg, unsigned char rind, int nt, struct misdn_bchannel *bc)
+{
+ unsigned char *p;
+ Q931_info_t *qi = (Q931_info_t *)(msg->data + mISDN_HEADER_LEN);
+ /* if (MISDN_IE_DEBG) printf(" display='%s' (len=%d)\n", display, strlen((char *)display)); */
+
+ p = msg_put(msg, 3);
+ if (nt)
+ *ntmode = p+1;
+ else
+ qi->QI_ELEMENT(restart_ind) = p - (unsigned char *)qi - sizeof(Q931_info_t);
+ p[0] = IE_RESTART_IND;
+ p[1] = 1;
+ p[2] = rind;
+
+}
+
Modified: branches/1.4/channels/misdn/isdn_lib.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/misdn/isdn_lib.c?view=diff&rev=68644&r1=68643&r2=68644
==============================================================================
--- branches/1.4/channels/misdn/isdn_lib.c (original)
+++ branches/1.4/channels/misdn/isdn_lib.c Mon Jun 11 05:29:18 2007
@@ -1134,9 +1134,6 @@
sem_init(ibuf->rsem,0,0);
}
-
-
-
{
stack_info_t *stinf;
@@ -3208,13 +3205,15 @@
void misdn_send_lock(struct misdn_bchannel *bc)
{
//cb_log(0,bc->port,"Locking bc->pid:%d\n", bc->pid);
- pthread_mutex_lock(&bc->send_lock->lock);
+ if (bc->send_lock)
+ pthread_mutex_lock(&bc->send_lock->lock);
}
void misdn_send_unlock(struct misdn_bchannel *bc)
{
//cb_log(0,bc->port,"UnLocking bc->pid:%d\n", bc->pid);
- pthread_mutex_unlock(&bc->send_lock->lock);
+ if (bc->send_lock)
+ pthread_mutex_unlock(&bc->send_lock->lock);
}
int misdn_lib_send_event(struct misdn_bchannel *bc, enum event_e event )
@@ -3654,7 +3653,7 @@
}
/*Sends Restart message for every bchnanel*/
-int misdn_lib_send_restart(int port)
+int misdn_lib_send_restart(int port, int channel)
{
struct misdn_stack *stack=find_stack_by_port(port);
cb_log(0, port, "Sending Restarts on this port.\n");
@@ -3665,9 +3664,17 @@
dummybc.l3_id=MISDN_ID_GLOBAL;
dummybc.nt=stack->nt;
+ /*default is all channels*/
int max=stack->pri?30:2;
- int i;
- for (i=1;i<=max;i++) {
+ int i=1;
+
+ /*if a channel is specified we restart only this one*/
+ if (channel > 0) {
+ i=channel;
+ max=channel;
+ }
+
+ for (;i<=max;i++) {
dummybc.channel=i;
cb_log(0, port, "Restarting channel %d\n",i);
misdn_lib_send_event(&dummybc, EVENT_RESTART);
Modified: branches/1.4/channels/misdn/isdn_lib.h
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/misdn/isdn_lib.h?view=diff&rev=68644&r1=68643&r2=68644
==============================================================================
--- branches/1.4/channels/misdn/isdn_lib.h (original)
+++ branches/1.4/channels/misdn/isdn_lib.h Mon Jun 11 05:29:18 2007
@@ -415,7 +415,7 @@
int misdn_lib_port_restart(int port);
int misdn_lib_pid_restart(int pid);
-int misdn_lib_send_restart(int port);
+int misdn_lib_send_restart(int port, int channel);
int misdn_lib_get_port_info(int port);
Modified: branches/1.4/channels/misdn/isdn_msg_parser.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/misdn/isdn_msg_parser.c?view=diff&rev=68644&r1=68643&r2=68644
==============================================================================
--- branches/1.4/channels/misdn/isdn_msg_parser.c (original)
+++ branches/1.4/channels/misdn/isdn_msg_parser.c Mon Jun 11 05:29:18 2007
@@ -839,6 +839,7 @@
printf("Building RESTART Msg\n");
#endif
enc_ie_channel_id(&restart->CHANNEL_ID, msg, 1,bc->channel, nt,bc);
+ enc_ie_restart_ind(&restart->RESTART_IND, msg, 0x80, nt, bc);
cb_log(0,bc->port, "Restarting channel %d\n", bc->channel);
More information about the asterisk-commits
mailing list