aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--addons/chan_ooh323.c11
-rw-r--r--addons/ooh323c/src/ooCmdChannel.c9
-rw-r--r--addons/ooh323c/src/ooStackCmds.c48
-rw-r--r--addons/ooh323c/src/ooStackCmds.h5
-rw-r--r--addons/ooh323c/src/oochannels.c2
-rw-r--r--addons/ooh323c/src/ooh323.c11
6 files changed, 84 insertions, 2 deletions
diff --git a/addons/chan_ooh323.c b/addons/chan_ooh323.c
index 1d012a9eb..9c2ce6fa1 100644
--- a/addons/chan_ooh323.c
+++ b/addons/chan_ooh323.c
@@ -902,6 +902,10 @@ static int ooh323_call(struct ast_channel *ast, char *dest, int timeout)
if(p->callerid_name)
free(p->callerid_name);
p->callerid_name = strdup(ast->connected.id.name);
+ } else if (ast->connected.id.number) {
+ if(p->callerid_name)
+ free(p->callerid_name);
+ p->callerid_name = strdup(ast->connected.id.number);
} else {
ast->connected.id.name = strdup(gCallerID);
if(p->callerid_name)
@@ -1206,6 +1210,13 @@ static int ooh323_indicate(struct ast_channel *ast, int condition, const void *d
ast_rtp_instance_new_source(p->rtp);
break;
+ case AST_CONTROL_CONNECTED_LINE:
+ if (gH323Debug)
+ ast_log(LOG_DEBUG, "Sending connected line info for %s (%s)\n",
+ callToken, ast->connected.id.name);
+ ooSetANI(callToken, ast->connected.id.name);
+ break;
+
case AST_CONTROL_T38_PARAMETERS:
if (p->t38support != T38_ENABLED) {
struct ast_control_t38_parameters parameters = { .request_response = 0 };
diff --git a/addons/ooh323c/src/ooCmdChannel.c b/addons/ooh323c/src/ooCmdChannel.c
index 003a5df1b..27a28a282 100644
--- a/addons/ooh323c/src/ooCmdChannel.c
+++ b/addons/ooh323c/src/ooCmdChannel.c
@@ -402,6 +402,15 @@ int ooReadAndProcessCallStackCommand(OOH323CallData* call)
ooSendRequestMode(call, *(int *)cmd.param2);
break;
+ case OO_CMD_SETANI:
+ OOTRACEINFO3("Processing SetANI command %s, ani is %s\n",
+ (char *)cmd.param1, (char *)cmd.param2);
+ if(cmd.param2) {
+ strncpy(call->ourCallerId, cmd.param2, sizeof(call->ourCallerId)-1);
+ call->ourCallerId[sizeof(call->ourCallerId)-1] = '\0';
+ }
+ break;
+
default: OOTRACEERR1("ERROR:Unknown command\n");
}
}
diff --git a/addons/ooh323c/src/ooStackCmds.c b/addons/ooh323c/src/ooStackCmds.c
index f09d33405..4c732d538 100644
--- a/addons/ooh323c/src/ooStackCmds.c
+++ b/addons/ooh323c/src/ooStackCmds.c
@@ -494,6 +494,54 @@ OOStkCmdStat ooSendDTMFDigit(const char *callToken, const char* dtmf)
return OO_STKCMD_SUCCESS;
}
+OOStkCmdStat ooSetANI(const char *callToken, const char* ani)
+{
+ OOStackCommand cmd;
+ OOH323CallData *call;
+
+ if(!callToken)
+ {
+ return OO_STKCMD_INVALIDPARAM;
+ }
+
+ if(!(call = ooFindCallByToken(callToken))) {
+ return OO_STKCMD_INVALIDPARAM;
+ }
+
+ if(call->CmdChan == 0)
+ {
+ if(ooCreateCallCmdConnection(call) != OO_OK)
+ return OO_STKCMD_CONNECTIONERR;
+ }
+
+ memset(&cmd, 0, sizeof(OOStackCommand));
+ cmd.type = OO_CMD_SETANI;
+
+ cmd.param1 = (void*) malloc(strlen(callToken)+1);
+ cmd.param2 = (void*) malloc(strlen(ani)+1);
+ if(!cmd.param1 || !cmd.param2)
+ {
+ if(cmd.param1) free(cmd.param1); /* Release memory */
+ if(cmd.param2) free(cmd.param2);
+ return OO_STKCMD_MEMERR;
+ }
+ strcpy((char*)cmd.param1, callToken);
+ cmd.plen1 = strlen(callToken);
+ strcpy((char*)cmd.param2, ani);
+ cmd.plen2 = strlen(ani);
+
+ if(ooWriteCallStackCommand(call,&cmd) != OO_OK)
+ {
+ free(cmd.param1);
+ free(cmd.param2);
+ return OO_STKCMD_WRITEERR;
+ }
+ free(cmd.param1);
+ free(cmd.param2);
+
+ return OO_STKCMD_SUCCESS;
+}
+
OOStkCmdStat ooRequestChangeMode(const char *callToken, int isT38Mode)
{
OOStackCommand cmd;
diff --git a/addons/ooh323c/src/ooStackCmds.h b/addons/ooh323c/src/ooStackCmds.h
index 3fd1a8dab..dc6a2128e 100644
--- a/addons/ooh323c/src/ooStackCmds.h
+++ b/addons/ooh323c/src/ooStackCmds.h
@@ -67,7 +67,8 @@ typedef enum OOStackCmdID {
OO_CMD_MANUALRINGBACK, /*!< Send Alerting - ringback */
OO_CMD_MANUALPROGRESS, /*!< Send progress */
OO_CMD_STOPMONITOR, /*!< Stop the event monitor */
- OO_CMD_REQMODE /*!< Request new mode */
+ OO_CMD_REQMODE, /*!< Request new mode */
+ OO_CMD_SETANI /*! <Set conncted info */
} OOStackCmdID;
@@ -176,6 +177,8 @@ EXTERN OOStkCmdStat ooRunCall(const char* dest, char* callToken, size_t bufsiz,
int ooGenerateOutgoingCallToken (char *callToken, size_t size);
+EXTERN OOStkCmdStat ooSetANI(const char *callToken, const char* ani);
+
#ifdef __cplusplus
}
#endif
diff --git a/addons/ooh323c/src/oochannels.c b/addons/ooh323c/src/oochannels.c
index fd6cbb376..2b2f0b493 100644
--- a/addons/ooh323c/src/oochannels.c
+++ b/addons/ooh323c/src/oochannels.c
@@ -1124,7 +1124,7 @@ int ooH2250Receive(OOH323CallData *call)
finishPrint();
removeEventHandler(pctxt);
if(ret == OO_OK) {
- ooHandleH2250Message(call, pmsg);
+ ret = ooHandleH2250Message(call, pmsg);
}
return ret;
}
diff --git a/addons/ooh323c/src/ooh323.c b/addons/ooh323c/src/ooh323.c
index 971b668a2..59b6afdb1 100644
--- a/addons/ooh323c/src/ooh323.c
+++ b/addons/ooh323c/src/ooh323.c
@@ -1533,6 +1533,17 @@ int ooHandleH2250Message(OOH323CallData *call, Q931Message *q931Msg)
OOTimer *pTimer=NULL;
int type = q931Msg->messageType;
struct timespec ts;
+
+/* checking of message validity for first/next messages of calls */
+
+ if (!strcmp(call->callType, "incoming")) {
+ if ((call->callState != OO_CALL_CREATED && type == Q931SetupMsg) ||
+ (call->callState == OO_CALL_CREATED && type != Q931SetupMsg)) {
+ ooFreeQ931Message(call->msgctxt, q931Msg);
+ return OO_FAILED;
+ }
+ }
+
switch(type)
{
case Q931SetupMsg: /* SETUP message is received */