[svn-commits] may: branch may/chan_ooh323_rework r205531 - in /team/may/chan_ooh323_rework/...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Jul 8 19:59:57 CDT 2009


Author: may
Date: Wed Jul  8 19:59:53 2009
New Revision: 205531

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=205531
Log:
inband dtmf support (relaxdtmf is optional), dtmfmode for peer/user is
or'ed with dtmfmode of endpoint)
added g726aal2 and Cisco G726r32 support


Modified:
    team/may/chan_ooh323_rework/addons/chan_ooh323.c
    team/may/chan_ooh323_rework/addons/ooh323c/src/ooCapability.c
    team/may/chan_ooh323_rework/addons/ooh323c/src/ooCapability.h
    team/may/chan_ooh323_rework/addons/ooh323c/src/ooh245.c
    team/may/chan_ooh323_rework/addons/ooh323cDriver.c
    team/may/chan_ooh323_rework/addons/ooh323cDriver.h

Modified: team/may/chan_ooh323_rework/addons/chan_ooh323.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/may/chan_ooh323_rework/addons/chan_ooh323.c?view=diff&rev=205531&r1=205530&r2=205531
==============================================================================
--- team/may/chan_ooh323_rework/addons/chan_ooh323.c (original)
+++ team/may/chan_ooh323_rework/addons/chan_ooh323.c Wed Jul  8 19:59:53 2009
@@ -96,10 +96,10 @@
 	struct ast_rtp_instance *rtp;
 	struct ast_rtp_instance *vrtp; /* Placeholder for now */
 	struct ast_channel *owner;	/* Master Channel */
-   union {
-    	char  *user;	/* cooperating user/peer */
-    	char  *peer;
-   } neighbor;
+   	union {
+    		char  *user;	/* cooperating user/peer */
+    		char  *peer;
+   	} neighbor;
 	time_t lastrtptx;
 	time_t lastrtprx;
 	unsigned int flags;
@@ -129,7 +129,7 @@
 	char accountcode[256];	/* Account code */
 	int nat;
 	int amaflags;
-   int progsent;			/* progress is sent */
+	int progsent;			/* progress is sent */
 	struct ast_dsp *vad;
 	struct ooh323_pvt *next;	/* Next entity */
 } *iflist = NULL;
@@ -310,6 +310,8 @@
 		if (i->dtmfmode & H323_DTMF_INBAND) {
 			i->vad = ast_dsp_new();
 			ast_dsp_set_features(i->vad, DSP_FEATURE_DIGIT_DETECT);
+			if (i->dtmfmode & H323_DTMF_INBANDRELAX)
+				ast_dsp_set_digitmode(i->vad, DSP_DIGITMODE_DTMF | DSP_DIGITMODE_RELAXDTMF);
 		}
 
 		ast_mutex_lock(&usecnt_lock);
@@ -358,6 +360,9 @@
 				ch = NULL;
 			} 
 	 	}
+
+		manager_event(EVENT_FLAG_SYSTEM, "ChannelUpdate", "Channel: %s\r\nChanneltype: %s\r\n"
+				"CallRef: %d\r\n", ch->name, "OOH323", i->call_reference);
 	} else
 		ast_log(LOG_WARNING, "Unable to allocate channel structure\n");
 
@@ -529,7 +534,7 @@
 		  p->capability = peer->capability;
 		/* } */
 		memcpy(&p->prefs, &peer->prefs, sizeof(struct ast_codec_pref));
-		p->dtmfmode = peer->dtmfmode;
+		p->dtmfmode |= peer->dtmfmode;
 		ast_copy_string(p->accountcode, peer->accountcode, sizeof(p->accountcode));
 		p->amaflags = peer->amaflags;
 	} else {
@@ -1474,7 +1479,7 @@
 			p->amaflags = user->amaflags;
 			p->capability = user->capability;
 			memcpy(&p->prefs, &user->prefs, sizeof(struct ast_codec_pref));
-			p->dtmfmode = user->dtmfmode;
+			p->dtmfmode |= user->dtmfmode;
 			/* Since, call is coming from a pbx user, no need to use gk */
 			/* OO_SETFLAG(p->flags, H323_DISABLEGK);
 			OO_SETFLAG(call->flags, OO_M_DISABLEGK); */
@@ -1701,6 +1706,8 @@
 			struct ast_channel* c = p->owner;
 			ast_queue_control(c, AST_CONTROL_ANSWER);
    			ast_channel_unlock(p->owner);
+			manager_event(EVENT_FLAG_SYSTEM,"ChannelUpdate","Channel: %s\r\nChanneltype: %s\r\n"
+				"CallRef: %d\r\n", c->name, "OOH323", p->call_reference);
 		}
 		ast_mutex_unlock(&p->lock);
 
@@ -1902,6 +1909,10 @@
 					user->dtmfmode = H323_DTMF_H245ALPHANUMERIC;
 				else if (!strcasecmp(v->value, "h245signal"))
 					user->dtmfmode = H323_DTMF_H245SIGNAL;
+				else if (!strcasecmp(v->value, "inband"))
+					user->dtmfmode = H323_DTMF_INBAND;
+			} else if (!strcasecmp(v->name, "relaxdtmf")) {
+				user->dtmfmode |= ast_true(v->value) ? H323_DTMF_INBANDRELAX : 0;
 			}
 			v = v->next;
 		}
@@ -2002,6 +2013,10 @@
 					peer->dtmfmode = H323_DTMF_H245ALPHANUMERIC;
 				else if (!strcasecmp(v->value, "h245signal"))
 					peer->dtmfmode = H323_DTMF_H245SIGNAL;
+				else if (!strcasecmp(v->value, "inband"))
+					peer->dtmfmode = H323_DTMF_INBAND;
+			} else if (!strcasecmp(v->name, "relaxdtmf")) {
+				peer->dtmfmode |= ast_true(v->value) ? H323_DTMF_INBANDRELAX : 0;
 			}
 			v = v->next;
 		}
@@ -2294,7 +2309,9 @@
                                                                     v->value);
 				gDTMFMode = H323_DTMF_RFC2833;
 			}
-		}  
+		} else if (!strcasecmp(v->name, "relaxdtmf")) {
+			gDTMFMode |= ast_true(v->value) ? H323_DTMF_INBANDRELAX : 0;
+		}
 		v = v->next;
 	}
 	
@@ -2398,6 +2415,10 @@
          ast_cli(a->fd, "%s\n", "h245alphanumeric");
 		else if (peer->dtmfmode & H323_DTMF_H245SIGNAL)
          ast_cli(a->fd, "%s\n", "h245signal");
+		else if (peer->dtmfmode & H323_DTMF_INBAND && peer->dtmfmode & H323_DTMF_INBANDRELAX)
+         ast_cli(a->fd, "%s\n", "inband-relaxed");
+		else if (peer->dtmfmode & H323_DTMF_INBAND)
+         ast_cli(a->fd, "%s\n", "inband");
 		else
          ast_cli(a->fd, "%s\n", "unknown");
       ast_cli(a->fd, "%-15.15s%s\n", "AccountCode: ", peer->accountcode);
@@ -2522,6 +2543,10 @@
          ast_cli(a->fd, "%s\n", "h245alphanumeric");
 		else if (user->dtmfmode & H323_DTMF_H245SIGNAL)
          ast_cli(a->fd, "%s\n", "h245signal");
+		else if (user->dtmfmode & H323_DTMF_INBAND && user->dtmfmode & H323_DTMF_INBANDRELAX)
+         ast_cli(a->fd, "%s\n", "inband-relaxed");
+		else if (user->dtmfmode & H323_DTMF_INBAND)
+         ast_cli(a->fd, "%s\n", "inband");
 		else
          ast_cli(a->fd, "%s\n", "unknown");
       ast_cli(a->fd, "%-15.15s%s\n", "AccountCode: ", user->accountcode);
@@ -2681,6 +2706,10 @@
       ast_cli(a->fd, "%s\n", "h245alphanumeric");
 	else if (gDTMFMode & H323_DTMF_H245SIGNAL)
       ast_cli(a->fd, "%s\n", "h245signal");
+		else if (gDTMFMode & H323_DTMF_INBAND && gDTMFMode & H323_DTMF_INBANDRELAX)
+         ast_cli(a->fd, "%s\n", "inband-relaxed");
+		else if (gDTMFMode & H323_DTMF_INBAND)
+         ast_cli(a->fd, "%s\n", "inband");
 	else
       ast_cli(a->fd, "%s\n", "unknown");
 
@@ -3325,6 +3354,8 @@
 		return OO_G729A;
 	case AST_FORMAT_G726:
 		return OO_G726;
+	case AST_FORMAT_G726_AAL2:
+		return OO_G726AAL2;
 	case AST_FORMAT_G723_1:
 		return OO_G7231;
 	case AST_FORMAT_H263:
@@ -3434,6 +3465,10 @@
 	them.sin_addr.s_addr = inet_addr(remoteIp); /* only works for IPv4 */
 	them.sin_port = htons(remotePort);
 	ast_rtp_instance_set_remote_address(p->rtp, &them);
+
+	if (p->writeformat & AST_FORMAT_G726_AAL2) 
+                ast_rtp_codecs_payloads_set_rtpmap_type(ast_rtp_instance_get_codecs(p->rtp), p->rtp, 2,
+							"audio", "G726-32", AST_RTP_OPT_G726_NONSTANDARD);
 
 	if(gH323Debug)
 		ast_verbose("+++   setup_rtp_connection\n");
@@ -3534,10 +3569,12 @@
 			/* if (!p->owner->readformat)
 				p->owner->readformat = p->owner->nativeformats; */
 
-			if ((p->dtmfmode & H323_DTMF_INBAND) && p->vad) {
+			if ((p->dtmfmode & H323_DTMF_INBAND) && p->vad &&
+				(f->subclass == AST_FORMAT_SLINEAR || f->subclass == AST_FORMAT_ALAW ||
+					f->subclass == AST_FORMAT_ULAW)) {
 				f = ast_dsp_process(p->owner, p->vad, f);
-            		if (f && (f->frametype == AST_FRAME_DTMF)) 
-               			ast_log(LOG_DEBUG, "* Detected inband DTMF '%c'\n",f->subclass);
+            			if (f && (f->frametype == AST_FRAME_DTMF)) 
+               				ast_debug(1, "* Detected inband DTMF '%c'\n",f->subclass);
 			}
 		}
 	}

Modified: team/may/chan_ooh323_rework/addons/ooh323c/src/ooCapability.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/may/chan_ooh323_rework/addons/ooh323c/src/ooCapability.c?view=diff&rev=205531&r1=205530&r2=205531
==============================================================================
--- team/may/chan_ooh323_rework/addons/ooh323c/src/ooCapability.c (original)
+++ team/may/chan_ooh323_rework/addons/ooh323c/src/ooCapability.c Wed Jul  8 19:59:53 2009
@@ -619,6 +619,7 @@
    case OO_G7231:
      return ooCapabilityCreateSimpleCapability(epCap, pctxt, dir);
    case OO_G726:
+   case OO_G726AAL2:
    case OO_AMRNB:
      return ooCapabilityCreateNonStandardCapability(epCap, pctxt, dir);
    case OO_GSMHALFRATE:
@@ -934,6 +935,7 @@
    {
    case OO_AMRNB:
    case OO_G726:
+   case OO_G726AAL2:
       pAudio->t = T_H245AudioCapability_nonStandard;
       pAudio->u.nonStandard = (H245NonStandardParameter*)memAlloc(pctxt, 
                                            sizeof(H245NonStandardParameter));
@@ -965,6 +967,15 @@
       case OO_G726:
        pAudio->u.nonStandard->data.data = "G.726-32k";
        pAudio->u.nonStandard->data.numocts = sizeof("G.726-32k")-1;
+       break;
+      case OO_G726AAL2:
+       pAudio->u.nonStandard->data.data = "G726r32";
+       pAudio->u.nonStandard->data.numocts = sizeof("G726r32")-1;
+       /* Cisco G726 */
+       pAudio->u.nonStandard->nonStandardIdentifier.u.h221NonStandard->t35CountryCode = 181;
+       pAudio->u.nonStandard->nonStandardIdentifier.u.h221NonStandard->t35Extension = 0;
+       pAudio->u.nonStandard->nonStandardIdentifier.u.h221NonStandard->manufacturerCode = 18;
+
        break;
       case OO_AMRNB:
        pAudio->u.nonStandard->data.data = "AMRNB";
@@ -1091,6 +1102,13 @@
 	 else
 	  return FALSE;
 	 break;
+        case sizeof("G726r32")-1:
+	 if (!strncmp(audioCap->u.nonStandard->data.data, "G726r32",
+		audioCap->u.nonStandard->data.numocts))
+	  cap = OO_G726AAL2;
+	 else
+	  return FALSE;
+	 break;
 	case sizeof("AMRNB")-1:
 	 if (!strncmp(audioCap->u.nonStandard->data.data, "AMRNB", 
 		audioCap->u.nonStandard->data.numocts))
@@ -1766,6 +1784,13 @@
 	 else
 	  return NULL;
 	 break;
+        case sizeof("G726r32")-1:
+	 if (!strncmp(audioCap->u.nonStandard->data.data, "G726r32",
+		audioCap->u.nonStandard->data.numocts))
+	  cap = OO_G726AAL2;
+	 else
+	  return NULL;
+	 break;
 	case sizeof("AMRNB")-1:
 	 if (!strncmp(audioCap->u.nonStandard->data.data, "AMRNB",
 		audioCap->u.nonStandard->data.numocts))
@@ -2324,6 +2349,15 @@
       if (audioCap->u.nonStandard && 
           audioCap->u.nonStandard->nonStandardIdentifier.t == 
            T_H245NonStandardIdentifier_h221NonStandard &&
+          audioCap->u.nonStandard->data.numocts == sizeof("G726r32")-1 &&
+          !strncmp(audioCap->u.nonStandard->data.data, "G726r32", 
+                   audioCap->u.nonStandard->data.numocts))
+      return ooCapabilityAddSimpleCapability(call, OO_G726AAL2, 20, 
+                           240, FALSE, dir, NULL, NULL, NULL, NULL, TRUE);
+
+      if (audioCap->u.nonStandard && 
+          audioCap->u.nonStandard->nonStandardIdentifier.t == 
+           T_H245NonStandardIdentifier_h221NonStandard &&
           audioCap->u.nonStandard->data.numocts == sizeof("AMRNB")-1 &&
           !strncmp(audioCap->u.nonStandard->data.data, "AMRNB", 
                    audioCap->u.nonStandard->data.numocts))
@@ -2632,7 +2666,7 @@
       "OO_G729",
       "OO_G729ANNEXA",
       "OO_AMRNB",
-      "OO_UNUSED",
+      "OO_G726AAL2",
       "OO_G729WANNEXB",
       "OO_G729ANNEXAWANNEXB",
       "OO_G7231ANNEXC",

Modified: team/may/chan_ooh323_rework/addons/ooh323c/src/ooCapability.h
URL: http://svn.asterisk.org/svn-view/asterisk/team/may/chan_ooh323_rework/addons/ooh323c/src/ooCapability.h?view=diff&rev=205531&r1=205530&r2=205531
==============================================================================
--- team/may/chan_ooh323_rework/addons/ooh323c/src/ooCapability.h (original)
+++ team/may/chan_ooh323_rework/addons/ooh323c/src/ooCapability.h Wed Jul  8 19:59:53 2009
@@ -50,6 +50,7 @@
    OO_IS13818_AUDIO       = 14,
 #else
    OO_AMRNB		  = 13,
+   OO_G726AAL2		  = 14,
 #endif
    OO_G729B               = 15,
    OO_G729AB              = 16,

Modified: team/may/chan_ooh323_rework/addons/ooh323c/src/ooh245.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/may/chan_ooh323_rework/addons/ooh323c/src/ooh245.c?view=diff&rev=205531&r1=205530&r2=205531
==============================================================================
--- team/may/chan_ooh323_rework/addons/ooh323c/src/ooh245.c (original)
+++ team/may/chan_ooh323_rework/addons/ooh323c/src/ooh245.c Wed Jul  8 19:59:53 2009
@@ -3004,6 +3004,7 @@
    case OO_G711ULAW64K:
    case OO_G711ULAW56K:
    case OO_G726:
+   case OO_G726AAL2:
    case OO_AMRNB:
    case OO_G728:
    case OO_G729:

Modified: team/may/chan_ooh323_rework/addons/ooh323cDriver.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/may/chan_ooh323_rework/addons/ooh323cDriver.c?view=diff&rev=205531&r1=205530&r2=205531
==============================================================================
--- team/may/chan_ooh323_rework/addons/ooh323cDriver.c (original)
+++ team/may/chan_ooh323_rework/addons/ooh323cDriver.c Wed Jul  8 19:59:53 2009
@@ -203,6 +203,18 @@
 
       }
 
+      if(format & AST_FORMAT_G726_AAL2)
+      {
+         if(gH323Debug)
+            ast_verbose("\tAdding g726aal2 capability to H323 endpoint\n");
+         ret = ooH323EpAddG726Capability(OO_G726AAL2, gtxframes, grxframes, FALSE, 
+                                     OORXANDTX, &ooh323c_start_receive_channel,
+                                     &ooh323c_start_transmit_channel,
+                                     &ooh323c_stop_receive_channel, 
+                                     &ooh323c_stop_transmit_channel);
+
+      }
+
       if(format & AST_FORMAT_H263)
       {
          if(gH323Debug)
@@ -305,6 +317,20 @@
                                            call->callType, call->callToken);
 	 txframes = prefs->framing[x];
          ret = ooCallAddG726Capability(call, OO_G726, txframes, grxframes, FALSE,
+                                     OORXANDTX, &ooh323c_start_receive_channel,
+                                     &ooh323c_start_transmit_channel,
+                                     &ooh323c_stop_receive_channel, 
+                                     &ooh323c_stop_transmit_channel);
+
+      }
+
+      if(format & AST_FORMAT_G726_AAL2)
+      {
+         if(gH323Debug)
+            ast_verbose("\tAdding g726aal2 capability to call (%s, %s)\n",
+                                           call->callType, call->callToken);
+	 txframes = prefs->framing[x];
+         ret = ooCallAddG726Capability(call, OO_G726AAL2, txframes, grxframes, FALSE,
                                      OORXANDTX, &ooh323c_start_receive_channel,
                                      &ooh323c_start_transmit_channel,
                                      &ooh323c_stop_receive_channel, 
@@ -491,6 +517,8 @@
          return AST_FORMAT_G723_1;
       case OO_G726:
          return AST_FORMAT_G726;
+      case OO_G726AAL2:
+         return AST_FORMAT_G726_AAL2;
       case OO_H263VIDEO:
          return AST_FORMAT_H263;
       default:

Modified: team/may/chan_ooh323_rework/addons/ooh323cDriver.h
URL: http://svn.asterisk.org/svn-view/asterisk/team/may/chan_ooh323_rework/addons/ooh323cDriver.h?view=diff&rev=205531&r1=205530&r2=205531
==============================================================================
--- team/may/chan_ooh323_rework/addons/ooh323cDriver.h (original)
+++ team/may/chan_ooh323_rework/addons/ooh323cDriver.h Wed Jul  8 19:59:53 2009
@@ -27,6 +27,7 @@
 #define H323_DTMF_H245ALPHANUMERIC (1 << 2)
 #define H323_DTMF_H245SIGNAL       (1 << 3)
 #define H323_DTMF_INBAND           (1 << 4)
+#define H323_DTMF_INBANDRELAX	   (1 << 8)
 
 struct h323_pvt;
 int ooh323c_start_stack_thread(void);




More information about the svn-commits mailing list