[Asterisk-Dev] PPP over ISDN

Lattanzio Francesco f.lattanzio at mediatechnologies.it
Wed Apr 27 23:40:51 MST 2005


Hi,
    I'm using PPPD to make remote assistance through ISDN, for
people that can't (or won't) give Internet access to the PBX (i.e.,
Asterisk).
This is the overall configuration:

  1) Linux 2.6.10
  2) mISDN_for_PBX4Linux_2005_03_06.tar.gz and
     mISDNuser_for_PBX4Linux_2005_01_28.tar.gz from isdn.jolly.de
  3) chan_misdn-beta-0.1.0.tgz + BN4S0/BN8S0 from beroNet
  4) Asterisk 1.0.6
  5) app_pppd-050202.tgz from www.sirrix.de

To make things work, the following patches are needed:

for mISDN_for_PBX4Linux_2005_03_06.tar.gz:

diff -urN mISDN/drivers/isdn/hardware/mISDN/hfc_multi.c mISDN-fixed/drivers/isdn/hardware/mISDN/hfc_multi.c
--- mISDN/drivers/isdn/hardware/mISDN/hfc_multi.c	2005-01-31 18:24:03.000000000 +0100
+++ mISDN-fixed/drivers/isdn/hardware/mISDN/hfc_multi.c	2005-04-22 08:40:16.000000000 +0200
@@ -2799,7 +2799,7 @@
 		if (debug & DEBUG_HFCMULTI_INIT)
 			printk(KERN_DEBUG "setup_pci(): investigating card entry %d (looking for type %d)\n", i, hc->type);
 		inuse:
-		tmp_dev = pci_find_subsys(id_list[i].vendor_id, id_list[i].device_id, id_list[i].vendor_sub, id_list[i].device_sub, tmp_dev);
+		tmp_dev = pci_get_subsys(id_list[i].vendor_id, id_list[i].device_id, id_list[i].vendor_sub, id_list[i].device_sub, tmp_dev);
 		if (tmp_dev) {
 			/* skip if already in use */
 			list_for_each_entry_safe(hc_tmp, next, &HFCM_obj.ilist, list) {

for chan_misdn-beta-0.1.0.tgz:

diff -urN chan_misdn-beta-0.1.0/chan_misdn.c chan_misdn-beta-0.1.0-fixed/chan_misdn.c
--- chan_misdn-beta-0.1.0/chan_misdn.c	2005-04-01 16:32:10.000000000 +0200
+++ chan_misdn-beta-0.1.0-fixed/chan_misdn.c	2005-04-21 12:28:59.000000000 +0200
@@ -2528,12 +2528,12 @@
 	if ( !strlen(bc->dad) && strlen(bc->keypad)) strcpy(bc->dad,bc->keypad);
 	switch( bc->numplan ) {
 	case NUMPLAN_INTERNATIONAL:
-	  prefix=get_nat_prefix(bc);
+	  prefix=get_internat_prefix(bc);
 	  if (misdn_debug>0) chan_misdn_log(" --> Numplan: Internat. prefix %s\n", prefix);
 	  break;
 	  
 	case NUMPLAN_NATIONAL:
-	  prefix=get_internat_prefix(bc);
+	  prefix=get_nat_prefix(bc);
 	  if (misdn_debug>0) chan_misdn_log(" --> Numplan: Nat. prefix %s\n", prefix);
 	  break;
 	  
for app_pppd-050202.tgz:

diff -urN app_pppd/app_pppd.c app_pppd-fixed/app_pppd.c
--- app_pppd/app_pppd.c	2005-02-02 15:21:52.000000000 +0100
+++ app_pppd-fixed/app_pppd.c	2005-04-27 15:19:28.000000000 +0200
@@ -21,10 +21,13 @@
 
 #include "isdnhdlc.h"
 #include <stdlib.h>
+#include <fcntl.h>
 #include <unistd.h>
 #include <string.h>
 #include <signal.h>
 #include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
 #include <sys/wait.h>
 #include <sys/resource.h>
 
@@ -171,7 +174,8 @@
 
   if (! _master_fd || ! _slave_name) return 0;
   
-  master = getpt ();
+  // master = getpt ();
+  master=open("/dev/ptmx", O_RDWR|O_NOCTTY|O_NONBLOCK);
   if (master < 0)
     return 0;
   
@@ -215,9 +219,6 @@
 {
   // we really need the info struct and an Asterisk channel
   if (! info || ! info->astch) goto exit_snd;
-
-  // initialize the send HDLC
-  isdnhdlc_out_init (&(info->snd_hdlc), 0, 0);
   
   
   //////////////////////////////////////////////////////////////////////////
@@ -227,14 +228,22 @@
   info->snd_buf_fill_add = read(info->master_fd, info->snd_buf+info->snd_buf_fill, 
 				sizeof(info->snd_buf)-info->snd_buf_fill);
   if (info->snd_buf_fill_add < 0) {
-    ast_log(LOG_DEBUG, "Could not read send data: %s\n", strerror(errno));
-    goto exit_snd;
+    if (errno == EAGAIN) {
+      info->snd_buf_fill_add=0;
+      return;
+    } else {
+      ast_log(LOG_DEBUG, "Could not read send data: %s\n", strerror(errno));
+      goto exit_snd;
+    }
   }
   if (info->snd_buf_fill_add == 0) {
     ast_log(LOG_DEBUG, "EOF\n");
     goto exit_snd;
   }
 
+  // initialize the send HDLC
+  isdnhdlc_out_init (&(info->snd_hdlc), 0, 0);
+
   info->snd_buf_fill += info->snd_buf_fill_add;
   if (info->snd_buf_fill > sizeof(info->snd_buf)) info->snd_buf_fill = sizeof(info->snd_buf);
  
@@ -554,7 +563,7 @@
 
       continue;
     }
-    
+
     if (astch == info->astch) {
       // run receiver ...
       do_rcv_ch(info);     

That's all.
Bye.

-- 
Francesco Lattanzio <f.lattanzio at mediatechnologies.it>



More information about the asterisk-dev mailing list