[Asterisk-cvs] asterisk-addons/asterisk-ooh323c/ooh323c/src ooCalls.c, 1.5, 1.6 ooCalls.h, 1.3, 1.4

vphirke vphirke
Wed Aug 3 14:59:21 CDT 2005


Update of /usr/cvsroot/asterisk-addons/asterisk-ooh323c/ooh323c/src
In directory mongoose.digium.com:/tmp/cvs-serv26781/ooh323c/src

Modified Files:
	ooCalls.c ooCalls.h 
Log Message:
Updated:


Index: ooCalls.c
===================================================================
RCS file: /usr/cvsroot/asterisk-addons/asterisk-ooh323c/ooh323c/src/ooCalls.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- ooCalls.c	2 Aug 2005 18:54:54 -0000	1.5
+++ ooCalls.c	3 Aug 2005 19:03:32 -0000	1.6
@@ -397,151 +397,78 @@
    return OO_OK;
 }
 
-int ooCallAddAliasH323ID(OOH323CallData *call, const char* h323id)
+
+int ooCallAddAlias
+   (OOH323CallData *call, int aliasType, const char *value, OOBOOL local)
 {
    ooAliases * psNewAlias=NULL;
    psNewAlias = (ooAliases*)memAlloc(call->pctxt, sizeof(ooAliases));
    if(!psNewAlias)
    {
-      OOTRACEERR3("Error:Memory - ooCallAddAliasH323ID - psNewAlias"
+      OOTRACEERR3("Error:Memory - ooCallAddAlias - psNewAlias"
                   "(%s, %s)\n", call->callType, call->callToken);
       return OO_FAILED;
    }
-   psNewAlias->type = T_H225AliasAddress_h323_ID;
-   psNewAlias->value = (char*) memAlloc(call->pctxt, strlen(h323id)+1);
+   psNewAlias->type = aliasType;
+   psNewAlias->value = (char*) memAlloc(call->pctxt, strlen(value)+1);
    if(!psNewAlias->value)
    {
-      OOTRACEERR3("Error:Memory - ooCallAddAliasH323ID - psNewAlias->value"
+      OOTRACEERR3("Error:Memory - ooCallAddAlias - psNewAlias->value"
                   " (%s, %s)\n", call->callType, call->callToken);
       memFreePtr(call->pctxt, psNewAlias);
       return OO_FAILED;
    }
-   strcpy(psNewAlias->value, h323id);
-   psNewAlias->next = call->ourAliases;
-   call->ourAliases = psNewAlias;
-   OOTRACEDBGC4("Added alias H323ID %s to call. (%s, %s)\n", h323id,
-		call->callType, call->callToken);
-   return OO_OK;
-}
-
-
-int ooCallAddAliasDialedDigits(OOH323CallData *call, const char* dialedDigits)
-{
+   strcpy(psNewAlias->value, value);
 
-   ooAliases * psNewAlias=NULL;
-   psNewAlias = (ooAliases*)memAlloc(call->pctxt, sizeof(ooAliases));
-   if(!psNewAlias)
-   {
-      OOTRACEERR3("Error:Memory - ooCallAddAliasDialedDigits - psNewAlias"
-                  "(%s, %s)\n", call->callType, call->callToken);
-      return OO_FAILED;
-   }
-   psNewAlias->type = T_H225AliasAddress_dialedDigits;
-   psNewAlias->value = (char*) memAlloc(call->pctxt, strlen(dialedDigits)+1);
-   if(!psNewAlias->value)
+   if(local)
    {
-      OOTRACEERR3("Error:Memory - ooCallAddAliasDialedDigits - "
-                  "psNewAlias->value. (%s, %s)\n", call->callType, 
-                   call->callToken);
-      memFreePtr(call->pctxt, psNewAlias);
-      return OO_FAILED;
+      psNewAlias->next = call->ourAliases;
+      call->ourAliases = psNewAlias;
+   }else {
+     psNewAlias->next = call->remoteAliases;
+     call->remoteAliases = psNewAlias;
    }
-   strcpy(psNewAlias->value, dialedDigits);
-   psNewAlias->next = call->ourAliases;
-   call->ourAliases = psNewAlias;
-   OOTRACEDBGC4("Added alias dialedDigits %s to call. (%s, %s)\n",dialedDigits,
-		call->callType, call->callToken);
 
+   OOTRACEDBGC5("Added %s alias %s to call. (%s, %s)\n", 
+              local?"local":"remote", value, call->callType, call->callToken);
    return OO_OK;
 }
 
-
-int ooCallAddAliasEmailID(OOH323CallData *call, const char* email)
+int ooCallAddAliasH323ID(OOH323CallData *call, const char* h323id)
 {
+   return ooCallAddAlias(call, T_H225AliasAddress_h323_ID, h323id, TRUE);
+}
 
-   ooAliases * psNewAlias=NULL;
-   psNewAlias = (ooAliases*)memAlloc(call->pctxt, sizeof(ooAliases));
-   if(!psNewAlias)
-   {
-      OOTRACEERR3("Error:Memory - ooCallAddAliasEmailID - psNewAlias"
-                  "(%s, %s)\n", call->callType, call->callToken);
-      return OO_FAILED;
-   }
-   psNewAlias->type = T_H225AliasAddress_email_ID;
-   psNewAlias->value = (char*) memAlloc(call->pctxt, strlen(email)+1);
-   if(!psNewAlias->value)
-   {
-      OOTRACEERR3("Error:Memory - ooCallAddAliasEmailID - psNewAlias->value "
-                  "(%s, %s)\n", call->callType, call->callToken);
-      memFreePtr(call->pctxt, psNewAlias);
-      return OO_FAILED;
-   }
-   strcpy(psNewAlias->value, email);
-   psNewAlias->next = call->ourAliases;
-   call->ourAliases = psNewAlias;
-   OOTRACEDBGC4("Added alias Email-id %s to call. (%s, %s)\n", email,
-		call->callType, call->callToken);
 
-   return OO_OK;
+int ooCallAddAliasDialedDigits(OOH323CallData *call, const char* dialedDigits)
+{
+   return ooCallAddAlias
+               (call, T_H225AliasAddress_dialedDigits, dialedDigits, TRUE);
 }
 
 
-int ooCallAddAliasURLID(OOH323CallData *call, const char* url)
+int ooCallAddAliasEmailID(OOH323CallData *call, const char* email)
 {
+   return ooCallAddAlias(call, T_H225AliasAddress_email_ID, email, TRUE);
+}
 
-   ooAliases * psNewAlias=NULL;
-   psNewAlias = (ooAliases*)memAlloc(call->pctxt, sizeof(ooAliases));
-   if(!psNewAlias)
-   {
-      OOTRACEERR3("Error:Memory - ooCallAddAliasURLID - psNewAlias"
-                  "(%s, %s)\n", call->callType, call->callToken);
-      return OO_FAILED;
-   }
-   psNewAlias->type = T_H225AliasAddress_url_ID;
-   psNewAlias->value = (char*) memAlloc(call->pctxt, strlen(url)+1);
-   if(!psNewAlias->value)
-   {
-      OOTRACEERR3("Error:Memory - ooCallAddAliasURLID - psNewAlias->value"
-                  "(%s, %s)\n", call->callType, call->callToken);
-      memFreePtr(call->pctxt, psNewAlias);
-      return OO_FAILED;
-   }
-   strcpy(psNewAlias->value, url);
-   psNewAlias->next = call->ourAliases;
-   call->ourAliases = psNewAlias;
-   OOTRACEDBGC4("Added alias Url-id %s to call. (%s, %s)\n", url,
-		call->callType, call->callToken);
 
-   return OO_OK;
+int ooCallAddAliasURLID(OOH323CallData *call, const char* url)
+{
+   return ooCallAddAlias(call, T_H225AliasAddress_url_ID, url, TRUE);
 } 
  
 
 int ooCallAddRemoteAliasH323ID(OOH323CallData *call, const char* h323id)
 {
-   ooAliases * psNewAlias=NULL;
-   psNewAlias = (ooAliases*)memAlloc(call->pctxt, sizeof(ooAliases));
-   if(!psNewAlias)
-   {
-      OOTRACEERR3("Error:Memory - ooCallAddRemoteAliasH323ID - psNewAlias "
-                  "(%s, %s)\n", call->callType, call->callToken);
-      return OO_FAILED;
-   }
-   psNewAlias->type = T_H225AliasAddress_h323_ID;
-   psNewAlias->value = (char*) memAlloc(call->pctxt, strlen(h323id)+1);
-   if(!psNewAlias->value)
-   {
-      OOTRACEERR3("Error:Memory - ooCallAddRemoteAliasH323ID - "
-                  "psNewAlias->value. (%s, %s)\n", call->callType, 
-                   call->callToken);
-      memFreePtr(call->pctxt, psNewAlias);
-      return OO_FAILED;
-   }
-   strcpy(psNewAlias->value, h323id);
-   psNewAlias->next = call->remoteAliases;
-   call->remoteAliases = psNewAlias;
-   OOTRACEDBGC4("Added remote alias H323ID %s to call. (%s, %s)\n", h323id,
-		call->callType, call->callToken);
-   return OO_OK;
+   return ooCallAddAlias(call, T_H225AliasAddress_h323_ID, h323id, FALSE);
+}
+
+int ooCallAddRemoteAliasDialedDigits
+   (OOH323CallData *call, const char* dialedDigits)
+{
+   return ooCallAddAlias
+              (call, T_H225AliasAddress_dialedDigits, dialedDigits, FALSE);
 }
 
 

Index: ooCalls.h
===================================================================
RCS file: /usr/cvsroot/asterisk-addons/asterisk-ooh323c/ooh323c/src/ooCalls.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ooCalls.h	16 Jun 2005 19:41:23 -0000	1.3
+++ ooCalls.h	3 Aug 2005 19:03:32 -0000	1.4
@@ -387,6 +387,33 @@
  */
 EXTERN int ooCallAddAliasURLID(OOH323CallData *call, const char* url);
 
+
+/**
+ * This is a helper function used by other call related add aliases functions 
+ * to add a particular alias. This function is not supposed to be called 
+ * directly.
+ * @param call          Handle to the call
+ * @param aliasType     Type of alias being added
+ * @param value         Alias value
+ * @param local         Whether alias is for local party or remote party
+ *
+ * @return              OO_OK, on success. OO_FAILED, on failure.
+ */
+int ooCallAddAlias
+   (OOH323CallData *call, int aliasType, const char *value, OOBOOL local);
+
+
+/**
+ * This function is used to add an dialed digits alias for the remote endpoint 
+ * involved in a particular call.
+ * @param call          Handle to the call
+ * @param dialedDigits  dialedDigits alias to add for the remote endpoint.
+ *
+ * @return              OO_OK, on success. OO_FAILED, on failure.
+ */
+EXTERN int ooCallAddRemoteAliasDialedDigits
+   (OOH323CallData *call, const char* dialedDigits);
+
 /**
  * This function is used to add an H323ID alias for the remote endpoint 
  * involved in a particular call.




More information about the svn-commits mailing list