Hi!

I managed to make 3G video calls over a SS7 link (Asterisk + SS7 link kindly provided by first-telecom.de).

Attached is a patch for chan_ss7 1.0.0 which add support for h324m video calls (@Anders: this patch also includes the patches I already sent to you).

At the moment the patch is not cleaned (lots of comments and loggin), this can be cleaned up when people report their experiences.

The usage is rather simple:

1. Patch chan_ss7

2. set the variable ISDN_H324M (details in file ASTERISK_VARIABLES), e.g:

               [from-sip-phone]
               exten => _videoX.,1,h324m_call([EMAIL PROTECTED])
               [tomobile]
               exten => _videoX.,1,Set(CALLERID(num)=0043123456)
               exten => _videoX.,n,Set(__ISDN_H324M=USI+LLC)
               exten => _videoX.,n,Dial(ss7/siuc/${EXTEN:5}|90|)

3. use Asterisk >=1.4.17

4. user files from sip.fontventa.com with revision >= 212

5. edit app_h324m.c:

- pseudo = ast_request("Local", AST_FORMAT_ALAW | AST_FORMAT_ULAW, data, &reason);
+   pseudo = ast_request("Local", AST_FORMAT_ALAW, data, &reason);


6. have fun and report issues to me/mailing list

regards
klaus

diff -u --new-file chan_ss7-1.0.0/ASTERISK_VARIABLES 
chan_ss7-1.0.0-h324m/ASTERISK_VARIABLES
--- chan_ss7-1.0.0/ASTERISK_VARIABLES   1970-01-01 01:00:00.000000000 +0100
+++ chan_ss7-1.0.0-h324m/ASTERISK_VARIABLES     2008-03-05 19:24:40.000000000 
+0100
@@ -0,0 +1,33 @@
+chan_ss7 variables:
+===================
+
+variables read by chan_ss7:
+---------------------------
+  ISDN_H324M: If this variable is set, then chan_ss7 signals 
+              H324M (3G Video aka H.223 and H.245) in outgoing IAM
+              messages. Allowed values (case sensitive):
+                USI    signal H324M in User Service Information field
+                LLC    signal H324M in Access Transport field using Low
+                       Layer Compatibility
+                USI+LLC        signal H324M in User Service Information field 
AND
+                       Access Transport
+
+              Note: chan_ss7 read the variable from the outgoing channel. As 
in 
+              extensions.conf only the incoming channel variables can be set, 
you
+              have to set the variable as a global variable by prefixing with 
__ 
+              (double underscore). Usage example:
+
+               [from-sip-phone]
+               exten => _videoX.,1,h324m_call([EMAIL PROTECTED])
+               [tomobile]
+               exten => _videoX.,1,Set(CALLERID(num)=0043123456)
+               exten => _videoX.,n,Set(__ISDN_H324M=USI+LLC)
+               exten => _videoX.,n,Dial(ss7/siuc/${EXTEN:5}|90|)
+
+
+
+
+variables set by chan_ss7:
+--------------------------
+  none (there should be a variable which indicates if the incoming call
+  is a H324M video call, but this is not implemented yet)
Binary files chan_ss7-1.0.0/chan_ss7.o and chan_ss7-1.0.0-h324m/chan_ss7.o 
differ
Binary files chan_ss7-1.0.0/chan_ss7.so and chan_ss7-1.0.0-h324m/chan_ss7.so 
differ
Binary files chan_ss7-1.0.0/chan_ss7.so.orig and 
chan_ss7-1.0.0-h324m/chan_ss7.so.orig differ
diff -u --new-file chan_ss7-1.0.0/INSTALL chan_ss7-1.0.0-h324m/INSTALL
--- chan_ss7-1.0.0/INSTALL      2007-11-22 09:45:47.000000000 +0100
+++ chan_ss7-1.0.0-h324m/INSTALL        2008-03-05 19:08:46.000000000 +0100
@@ -47,5 +47,24 @@
 
     load chan_ss7.so
 
-in the Asterisk console.
+in the Asterisk console. Read the file "ASTERISK_VARIABLES" to find out which
+variables are read/set by chan_ss7.
+
+
+Debugging
+---------
+
+chan_ss7 allows dumping of MTP2 packets into a capture 
+file in pcap format (wireshark) using the 
+    ss7 dump start /path/to/filename
+command.
+
+If you want "live" decoding you could dump into a FIFO 
+file and use tshark to capture from the FIFO, e.g.:
+
+  # mkfifo /tmp/mtp2fifo.pcap
+  # asterisk -r
+  > ss7 dump start /tmp/mtp2fifo.pcap
+  > quit
+  # tshark -V -i /tmp/mtp2fifo.pcap
 
diff -u --new-file chan_ss7-1.0.0/isup.c chan_ss7-1.0.0-h324m/isup.c
--- chan_ss7-1.0.0/isup.c       2007-11-27 10:17:36.000000000 +0100
+++ chan_ss7-1.0.0-h324m/isup.c 2008-03-05 19:05:07.000000000 +0100
@@ -579,6 +579,8 @@
                           IP_CALLING_PARTY_NUMBER, decode_ani_rni, 
&msg->iam.ani,
                           IP_REDIRECTING_NUMBER, decode_ani_rni, &msg->iam.rni,
                           IP_REDIRECTION_INFORMATION, decode_redir_inf, 
&msg->iam.redir_inf,
+//kd
+//                          IP_USER_SERVICE_INFORMATION, decode_usi, 
&msg->iam.usi, 
                           0);
 
     case ISUP_SAM:
diff -u --new-file chan_ss7-1.0.0/isup.h chan_ss7-1.0.0-h324m/isup.h
--- chan_ss7-1.0.0/isup.h       2007-11-22 09:33:41.000000000 +0100
+++ chan_ss7-1.0.0-h324m/isup.h 2008-02-25 14:43:22.000000000 +0100
@@ -72,6 +72,9 @@
   IP_OPTIONAL_BACKWARD_CALL_INDICATORS = 0x29,                /* (3.5) */
   IP_SUSPEND_RESUME_INDICATORS = 0x22,                        /* (3.21) */
   IP_ECHO_CONTROL_INFORMATION = 0x37,                         /* (3.19) */
+//kd
+  IP_USER_SERVICE_INFORMATION = 0x1d,                         /* (3.57) */
+  IP_ACCESS_TRANSPORT = 0x03,                                 /* (3.3) */
 };
 
 #define PHONENUM_MAX 20
Binary files chan_ss7-1.0.0/isup.o and chan_ss7-1.0.0-h324m/isup.o differ
diff -u --new-file chan_ss7-1.0.0/l4isup.c chan_ss7-1.0.0-h324m/l4isup.c
--- chan_ss7-1.0.0/l4isup.c     2007-11-27 10:18:05.000000000 +0100
+++ chan_ss7-1.0.0-h324m/l4isup.c       2008-03-05 18:40:52.000000000 +0100
@@ -111,6 +111,7 @@
   int hangupcause;
   int dohangup;
   int has_inband_ind;
+  int is_digital;
   /* Circuit blocking status: {local,remote} {maintenance,hardware}. */
   enum { BL_LM=1, BL_LH=2, BL_RM=4, BL_RH=8, BL_UNEQUIPPED=0x10, 
BL_LINKDOWN=0x20 } blocked;
   /* Circuit equipped */
@@ -736,6 +737,8 @@
   chan->nativeformats = AST_FORMAT_ALAW;
   chan->rawreadformat = AST_FORMAT_ALAW;
   chan->rawwriteformat = AST_FORMAT_ALAW;
+  chan->readformat = AST_FORMAT_ALAW;
+  chan->writeformat = AST_FORMAT_ALAW;
   ast_setstate(chan, state);
   chan->fds[0] = pvt->zaptel_fd;
 
@@ -785,8 +788,10 @@
 
   ast_log(LOG_DEBUG, "SS7 request (%s/%s) format = 0x%X.\n", type, arg, 
format);
 
-  if(format != AST_FORMAT_ALAW) {
-    ast_log(LOG_NOTICE, "Audio format 0x%X not supported by SS7 channel.\n",
+//kd
+//  if(format != AST_FORMAT_ALAW) {
+  if(!(format & AST_FORMAT_ALAW)) {
+    ast_log(LOG_NOTICE, "Audio format 0x%X not supported by SS7 
channel...missing ALAW.\n",
             format);
     return NULL;
   }
@@ -887,7 +892,7 @@
            pvt->cic, pvt->has_inband_ind);
     ss7_send_call_progress(pvt, 0x01);
     ast_setstate(chan, AST_STATE_RINGING);
-    res = !pvt->has_inband_ind; /* If there is no indication of in-band 
information, tell asterisk to generate ringing indication tone */
+    res = !pvt->has_inband_ind && !pvt->is_digital; /* If there is no 
indication of in-band information, tell asterisk to generate ringing indication 
tone */
     break;
 
   case AST_CONTROL_PROGRESS:
@@ -900,7 +905,7 @@
 
   default:
     /* Not supported. */
-    res = - !pvt->has_inband_ind; /* If there is no indication of in-band 
information, tell asterisk to generate ringing indication tone */
+    res = !pvt->has_inband_ind && !pvt->is_digital; /* If there is no 
indication of in-band information, tell asterisk to generate ringing indication 
tone */
   }
 
   ast_mutex_unlock(&pvt->lock);
@@ -1429,6 +1434,7 @@
   pvt->hangupcause = 0;
   pvt->dohangup = 0;
   pvt->has_inband_ind = 0;
+  pvt->is_digital = 0;
   pvt->owner = NULL;
   add_to_idlelist(pvt);
 }
@@ -1695,8 +1701,10 @@
   }
 
   param[0] = (is_odd << 7) | (is_international ? 4 : 3);
+//kd
   param[1] = 0x11; /* Number complete; ISDN number plan; user provided,
                       verified and passed */
+//  param[1] = 0x13; /* Number complete; ISDN number plan; network provided */
   if(pres_restr) {
     param[1] |= (0x1 << 2);
   }
@@ -1740,6 +1748,22 @@
   char dnicpy[100]; 
   int pres_restr;
   int res;
+//kd
+  const char *isdn_h324m;
+  int h324m_usi=0, h324m_llc=0;
+  isdn_h324m = pbx_builtin_getvar_helper(chan, "ISDN_H324M");
+  if (isdn_h324m) {
+    ast_verbose(VERBOSE_PREFIX_3 "chan_ss7: isup_send_iam: ISDN_H324M=%s\n", 
isdn_h324m);
+    if (strstr(isdn_h324m,"USI")) {
+      h324m_usi = 1;
+    } 
+    if (strstr(isdn_h324m,"LLC")) {
+      h324m_llc = 1;
+    }
+    ast_verbose(VERBOSE_PREFIX_3 "chan_ss7: isup_send_iam: h324m_usi=%d, 
h324m_llc=%d\n", h324m_usi, h324m_llc);
+  } else {
+    ast_verbose(VERBOSE_PREFIX_3 "chan_ss7: isup_send_iam: ISDN_H324M is not 
set.\n");
+  }
 
   isup_msg_init(msg, sizeof(msg), this_host->opc, peerpc(pvt), pvt->cic, 
ISUP_IAM, &current);
 
@@ -1748,8 +1772,14 @@
   isup_msg_add_fixed(msg, sizeof(msg), &current, param, 1);
 
   /* Forward call indicator Q.763 (3.23). */
-  param[0] = 0x60; /* No end-to-end method , no interworking, no end-to-end
-                      info, ISDN all the way, ISDN not required */
+//kd
+  if (h324m_usi || h324m_llc) {
+    param[0] = 0xA0; /* No end-to-end method , no interworking, no end-to-end
+                        info, ISDN all the way, ISDN required */
+  } else {
+    param[0] = 0x60; /* No end-to-end method , no interworking, no end-to-end
+                        info, ISDN all the way, ISDN not required */
+  }
   param[1] = 0x01; /* Originating access ISDN, no SCCP indication */
   isup_msg_add_fixed(msg, sizeof(msg), &current, param, 2);
 
@@ -1758,7 +1788,13 @@
   isup_msg_add_fixed(msg, sizeof(msg), &current, param, 1);
 
   /* Transmission medium requirement Q.763 (3.54). */
-  param[0] = 0x00; /* Speech */
+//kd
+  if (h324m_usi || h324m_llc) {
+    param[0] = 0x02; /* 64 kbit/s unrestricted */
+    pvt->is_digital = 1;
+  } else {
+    param[0] = 0x00; /* Speech */
+  }
   isup_msg_add_fixed(msg, sizeof(msg), &current, param, 1);
 
   /* Called party number Q.763 (3.9). */
@@ -1798,6 +1834,29 @@
                           param, res);
   }
 
+//kd 
+  /* Some switches do not understand H.223. Those switches use Access Transport
+   * (Low Layer Compatibility) to signal the video call end-to-end.
+   */
+  if (h324m_usi) {
+    /* User Service Information: Q.763 3.57 */
+    param[0] = 0x88; /* unrestricted digital information */
+    param[1] = 0x90; /* circuit mode, 64 kbit */
+    param[2] = 0xA6; /* UL1, H.223 and H.245 */
+    isup_msg_add_optional(msg, sizeof(msg), &current, 
IP_USER_SERVICE_INFORMATION,
+                          param, 3);
+  }
+  if (h324m_llc) {
+    /* Access Transport Q.763 3.3 */
+    param[0] = 0x7C; /* unrestricted digital information */
+    param[1] = 0x03; /* circuit mode, 64 kbit */
+    param[2] = 0x88; /* UL1, H.223 and H.245 */
+    param[3] = 0x90; /* UL1, H.223 and H.245 */
+    param[4] = 0xA6; /* UL1, H.223 and H.245 */
+    isup_msg_add_optional(msg, sizeof(msg), &current, IP_ACCESS_TRANSPORT,
+                          param, 5);
+  }
+
   if (*rdni) {
     /* ToDo: Pass on RDNIS (and redirection cause when we implement that) as
        ISUP parameters? */
@@ -2641,9 +2700,12 @@
     request_hangup(pvt->owner, AST_CAUSE_NORMAL_CLEARING);
   }
 
+  if (inmsg->iam.trans_medium == 0x02) { /* 64kbit unrestricted data */
+       pvt->is_digital = 1;
+  }
   switch (pvt->link->echocancel) {
     case EC_ALLWAYS: 
-      pvt->echocan_start = 1;
+      pvt->echocan_start = !pvt->is_digital;
       break;
 
     case EC_31SPEECH:
Binary files chan_ss7-1.0.0/l4isup.o and chan_ss7-1.0.0-h324m/l4isup.o differ
Binary files chan_ss7-1.0.0/mtp3d and chan_ss7-1.0.0-h324m/mtp3d differ
Binary files chan_ss7-1.0.0/mtp3d.o and chan_ss7-1.0.0-h324m/mtp3d.o differ
_______________________________________________
--Bandwidth and Colocation Provided by http://www.api-digital.com--

asterisk-ss7 mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-ss7

Reply via email to