[asterisk-addons-commits] may: branch 1.6.2 r1096 - /branches/1.6.2/channels/ooh323c/src/

SVN commits to the Asterisk addons project asterisk-addons-commits at lists.digium.com
Sun Mar 14 09:07:28 CDT 2010


Author: may
Date: Sun Mar 14 09:07:24 2010
New Revision: 1096

URL: http://svnview.digium.com/svn/asterisk-addons?view=rev&rev=1096
Log:
added generating response on round trip delay requests

Some h.323 endpoints send round trip delay requests and require
replies from another side. One of them is Avaya IPOffice in default
config.

(issue #16976)
Reported by: vmikhelson
Patches:
      rtdr-1.6.0-2.patch uploaded by may213 (license 454)
Tested by: vmikhelson, may213


Modified:
    branches/1.6.2/channels/ooh323c/src/ooSocket.c
    branches/1.6.2/channels/ooh323c/src/ooh245.c
    branches/1.6.2/channels/ooh323c/src/ooh245.h
    branches/1.6.2/channels/ooh323c/src/ooq931.c
    branches/1.6.2/channels/ooh323c/src/ootypes.h

Modified: branches/1.6.2/channels/ooh323c/src/ooSocket.c
URL: http://svnview.digium.com/svn/asterisk-addons/branches/1.6.2/channels/ooh323c/src/ooSocket.c?view=diff&rev=1096&r1=1095&r2=1096
==============================================================================
--- branches/1.6.2/channels/ooh323c/src/ooSocket.c (original)
+++ branches/1.6.2/channels/ooh323c/src/ooSocket.c Sun Mar 14 09:07:24 2010
@@ -575,6 +575,7 @@
    struct ifconf ifc;
    int ifNum;
    OOInterface *pIf=NULL;
+   struct sockaddr_in sin;
 
    OOTRACEDBGA1("Retrieving local interfaces\n");
    if(ooSocketCreateUDP(&sock)!= ASN_OK)
@@ -653,7 +654,8 @@
             memFreePtr(pctxt, pIf);
             continue;
          }
-         strcpy(addr, inet_ntoa(((struct sockaddr_in*)&ifReq.ifr_addr)->sin_addr));
+	 memcpy(&sin, &ifReq.ifr_addr, sizeof(struct sockaddr_in));
+	 strcpy(addr, inet_ntoa(sin.sin_addr));
          OOTRACEDBGA2("\tIP address is %s\n", addr);
          pIf->addr = (char*)memAlloc(pctxt, strlen(addr)+1);
          if(!pIf->addr)
@@ -676,7 +678,8 @@
             memFreePtr(pctxt, pIf);
             continue;
          }
-         strcpy(mask, inet_ntoa(((struct sockaddr_in *)&ifReq.ifr_netmask)->sin_addr));
+	 memcpy(&sin, &ifReq.ifr_netmask, sizeof(struct sockaddr_in));
+	 strcpy(mask, inet_ntoa(sin.sin_addr));
          OOTRACEDBGA2("\tMask is %s\n", mask);
          pIf->mask = (char*)memAlloc(pctxt, strlen(mask)+1);
          if(!pIf->mask)

Modified: branches/1.6.2/channels/ooh323c/src/ooh245.c
URL: http://svnview.digium.com/svn/asterisk-addons/branches/1.6.2/channels/ooh323c/src/ooh245.c?view=diff&rev=1096&r1=1095&r2=1096
==============================================================================
--- branches/1.6.2/channels/ooh323c/src/ooh245.c (original)
+++ branches/1.6.2/channels/ooh323c/src/ooh245.c Sun Mar 14 09:07:24 2010
@@ -1969,6 +1969,53 @@
 
    return ret;
 }
+int ooOnReceivedRoundTripDelayRequest(OOH323CallData *call, 
+                                     H245SequenceNumber sequenceNumber)
+{
+   int ret=0;
+   H245Message *ph245msg=NULL;
+   H245ResponseMessage *response = NULL;
+   OOCTXT *pctxt=NULL;
+   H245RoundTripDelayResponse *rtdr;
+
+   ret = ooCreateH245Message(&ph245msg, 
+                             T_H245MultimediaSystemControlMessage_response);
+   if(ret != OO_OK)
+   {
+      OOTRACEERR3("ERROR:Memory allocation for RoundTripDelayResponse message "
+                  "failed (%s, %s)\n", call->callType, call->callToken);
+      return OO_FAILED;
+   }
+
+   pctxt = &gH323ep.msgctxt;
+   ph245msg->msgType = OORequestDelayResponse;
+   response = ph245msg->h245Msg.u.response;
+   response->t = T_H245ResponseMessage_roundTripDelayResponse;
+   response->u.roundTripDelayResponse = (H245RoundTripDelayResponse *)ASN1MALLOC
+                                   (pctxt, sizeof(H245RoundTripDelayResponse));
+   if(!response->u.roundTripDelayResponse)
+   {
+      OOTRACEERR3("ERROR:Failed to allocate memory for H245RoundTripDelayResponse "
+                  "message (%s, %s)\n", call->callType, call->callToken);
+      return OO_FAILED;
+   }
+   rtdr = response->u.roundTripDelayResponse;
+   memset(rtdr, 0, sizeof(H245RoundTripDelayResponse));
+   rtdr->sequenceNumber = sequenceNumber;
+
+   OOTRACEDBGA3("Built RoundTripDelayResponse message (%s, %s)\n", 
+                 call->callType, call->callToken);
+   ret = ooSendH245Msg(call, ph245msg);
+   if(ret != OO_OK)
+   {
+      OOTRACEERR3("Error:Failed to enqueue RoundTripDelayResponse to outbound queue. (%s, %s)\n",
+	call->callType, call->callToken);
+   }
+
+   ooFreeH245Message(call, ph245msg);
+   
+   return ret;
+}
 
 /*
   We clear channel here. Ideally the remote endpoint should send 
@@ -2159,6 +2206,11 @@
                ooOnReceivedRequestChannelClose(call, 
                                                request->u.requestChannelClose);
                break;
+	     case T_H245RequestMessage_roundTripDelayRequest:
+	       OOTRACEINFO4("Received roundTripDelayRequest - %d (%s, %s)\n",
+		  request->u.roundTripDelayRequest->sequenceNumber,  call->callType, call->callToken);
+	       ooOnReceivedRoundTripDelayRequest(call, request->u.roundTripDelayRequest->sequenceNumber);
+	       break;
             default:
                ;
          } /* End of Request Message */

Modified: branches/1.6.2/channels/ooh323c/src/ooh245.h
URL: http://svnview.digium.com/svn/asterisk-addons/branches/1.6.2/channels/ooh323c/src/ooh245.h?view=diff&rev=1096&r1=1095&r2=1096
==============================================================================
--- branches/1.6.2/channels/ooh323c/src/ooh245.h (original)
+++ branches/1.6.2/channels/ooh323c/src/ooh245.h Sun Mar 14 09:07:24 2010
@@ -28,6 +28,10 @@
 
 #include "ooq931.h"
 #include "MULTIMEDIA-SYSTEM-CONTROL.h"
+
+int ooOnReceivedRoundTripDelayRequest(OOH323CallData *call,
+                                     H245SequenceNumber sequenceNumber);
+
 
 #ifdef __cplusplus
 extern "C" {

Modified: branches/1.6.2/channels/ooh323c/src/ooq931.c
URL: http://svnview.digium.com/svn/asterisk-addons/branches/1.6.2/channels/ooh323c/src/ooq931.c?view=diff&rev=1096&r1=1095&r2=1096
==============================================================================
--- branches/1.6.2/channels/ooh323c/src/ooq931.c (original)
+++ branches/1.6.2/channels/ooh323c/src/ooq931.c Sun Mar 14 09:07:24 2010
@@ -3380,7 +3380,9 @@
       "OORequestChannelCloseAck",
       "OORequestChannelCloseReject",
       "OORequestChannelCloseRelease",
-      "OOEndSessionCommand"
+      "OOEndSessionCommand",
+      "OOUserInputIndication",
+      "OORequestDelayResponse"
    };
    int idx = msgType - OO_MSGTYPE_MIN;
    return ooUtilsGetText (idx, msgTypeText, OONUMBEROF(msgTypeText));

Modified: branches/1.6.2/channels/ooh323c/src/ootypes.h
URL: http://svnview.digium.com/svn/asterisk-addons/branches/1.6.2/channels/ooh323c/src/ootypes.h?view=diff&rev=1096&r1=1095&r2=1096
==============================================================================
--- branches/1.6.2/channels/ooh323c/src/ootypes.h (original)
+++ branches/1.6.2/channels/ooh323c/src/ootypes.h Sun Mar 14 09:07:24 2010
@@ -180,8 +180,9 @@
 #define OORequestChannelCloseRelease       128
 #define OOEndSessionCommand                129
 #define OOUserInputIndication              130
-
-#define OO_MSGTYPE_MAX                     130
+#define OORequestDelayResponse             131
+
+#define OO_MSGTYPE_MAX                     131
 
 /* Timer types */
 #define OO_CALLESTB_TIMER  (1<<0)




More information about the asterisk-addons-commits mailing list