mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-29 23:39:35 +00:00
Generate response to Status Enquiry message with Status q.931 message.
Some PBXes require this for call status checking
(closes issue ASTERISK-18748)
Reported by: Fabrizio Lazzaretti
Patches:
ASTERISK-18748-5.patch (License #5415) patch uploaded by may213
Tested by: Fabrizio Lazzaretti
........
Merged revisions 344158 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
Merged revisions 344159 from http://svn.asterisk.org/svn/asterisk/branches/10
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@344161 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -1588,6 +1588,10 @@ int ooOnSendMsg
|
|||||||
/* if(gH323ep.h323Callbacks.onAlerting && call->callState < OO_CALL_CLEAR)
|
/* if(gH323ep.h323Callbacks.onAlerting && call->callState < OO_CALL_CLEAR)
|
||||||
gH323ep.h323Callbacks.onAlerting(call); */
|
gH323ep.h323Callbacks.onAlerting(call); */
|
||||||
break;
|
break;
|
||||||
|
case OOStatus:
|
||||||
|
OOTRACEINFO3("Sent Message - Status (%s, %s) \n", call->callType,
|
||||||
|
call->callToken);
|
||||||
|
break;
|
||||||
case OOConnect:
|
case OOConnect:
|
||||||
OOTRACEINFO3("Sent Message - Connect (%s, %s)\n", call->callType,
|
OOTRACEINFO3("Sent Message - Connect (%s, %s)\n", call->callType,
|
||||||
call->callToken);
|
call->callToken);
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
#include "asterisk.h"
|
#include "asterisk.h"
|
||||||
#include "asterisk/lock.h"
|
#include "asterisk/lock.h"
|
||||||
#include "ooh245.h"
|
#include "ooh245.h"
|
||||||
|
#include "ooq931.h"
|
||||||
#include "ooCalls.h"
|
#include "ooCalls.h"
|
||||||
#include "printHandler.h"
|
#include "printHandler.h"
|
||||||
#include "ooh323ep.h"
|
#include "ooh323ep.h"
|
||||||
@@ -957,6 +958,9 @@ int ooHandleMasterSlave(OOH323CallData *call, void * pmsg,
|
|||||||
/*Since Cap exchange and MasterSlave Procedures are done */
|
/*Since Cap exchange and MasterSlave Procedures are done */
|
||||||
if(gH323ep.h323Callbacks.openLogicalChannels)
|
if(gH323ep.h323Callbacks.openLogicalChannels)
|
||||||
gH323ep.h323Callbacks.openLogicalChannels(call);
|
gH323ep.h323Callbacks.openLogicalChannels(call);
|
||||||
|
|
||||||
|
/* ooSendStatusInquiry(call); */
|
||||||
|
|
||||||
if(!ooGetTransmitLogicalChannel(call))
|
if(!ooGetTransmitLogicalChannel(call))
|
||||||
ooOpenLogicalChannels(call);
|
ooOpenLogicalChannels(call);
|
||||||
#if 0
|
#if 0
|
||||||
@@ -2173,6 +2177,9 @@ int ooOnReceivedTerminalCapabilitySetAck(OOH323CallData* call)
|
|||||||
{
|
{
|
||||||
if(gH323ep.h323Callbacks.openLogicalChannels)
|
if(gH323ep.h323Callbacks.openLogicalChannels)
|
||||||
gH323ep.h323Callbacks.openLogicalChannels(call);
|
gH323ep.h323Callbacks.openLogicalChannels(call);
|
||||||
|
|
||||||
|
/* ooSendStatusInquiry(call); */
|
||||||
|
|
||||||
if(!ooGetTransmitLogicalChannel(call))
|
if(!ooGetTransmitLogicalChannel(call))
|
||||||
ooOpenLogicalChannels(call);
|
ooOpenLogicalChannels(call);
|
||||||
#if 0
|
#if 0
|
||||||
@@ -3121,7 +3128,12 @@ int ooOnReceivedTerminalCapabilitySet(OOH323CallData *call, H245Message *pmsg)
|
|||||||
we can accept new capability set only. We must remember also that new join caps
|
we can accept new capability set only. We must remember also that new join caps
|
||||||
will be previously joined caps with new cap set.
|
will be previously joined caps with new cap set.
|
||||||
*/
|
*/
|
||||||
if(call->remoteTermCapSeqNo == tcs->sequenceNumber)
|
|
||||||
|
/* 20111103 */
|
||||||
|
/* for addition for previous we must check repeated tcs if it's not first
|
||||||
|
tcs i.e. SeqNo is not null */
|
||||||
|
|
||||||
|
if(call->remoteTermCapSeqNo && call->remoteTermCapSeqNo == tcs->sequenceNumber)
|
||||||
call->localTermCapState = OO_LocalTermCapExchange_Idle;
|
call->localTermCapState = OO_LocalTermCapExchange_Idle;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3208,6 +3220,9 @@ int ooOnReceivedTerminalCapabilitySet(OOH323CallData *call, H245Message *pmsg)
|
|||||||
|
|
||||||
if(gH323ep.h323Callbacks.openLogicalChannels)
|
if(gH323ep.h323Callbacks.openLogicalChannels)
|
||||||
gH323ep.h323Callbacks.openLogicalChannels(call);
|
gH323ep.h323Callbacks.openLogicalChannels(call);
|
||||||
|
|
||||||
|
/* ooSendStatusInquiry(call); */
|
||||||
|
|
||||||
if(!ooGetTransmitLogicalChannel(call))
|
if(!ooGetTransmitLogicalChannel(call))
|
||||||
ooOpenLogicalChannels(call);
|
ooOpenLogicalChannels(call);
|
||||||
#if 0
|
#if 0
|
||||||
|
|||||||
@@ -1803,6 +1803,7 @@ int ooHandleH2250Message(OOH323CallData *call, Q931Message *q931Msg)
|
|||||||
case Q931StatusEnquiryMsg:
|
case Q931StatusEnquiryMsg:
|
||||||
OOTRACEINFO3("H.225 Status Inquiry message Received (%s, %s)\n",
|
OOTRACEINFO3("H.225 Status Inquiry message Received (%s, %s)\n",
|
||||||
call->callType, call->callToken);
|
call->callType, call->callToken);
|
||||||
|
ooSendStatus(call);
|
||||||
ooFreeQ931Message(call->msgctxt, q931Msg);
|
ooFreeQ931Message(call->msgctxt, q931Msg);
|
||||||
break;
|
break;
|
||||||
case Q931SetupAckMsg:
|
case Q931SetupAckMsg:
|
||||||
|
|||||||
@@ -238,6 +238,15 @@ EXTERN int ooQ931Decode
|
|||||||
OOTRACEDBGB1(" }\n");
|
OOTRACEDBGB1(" }\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Handle CallState ie */
|
||||||
|
if(ie->discriminator == Q931CallStateIE)
|
||||||
|
{
|
||||||
|
msg->causeIE = ie;
|
||||||
|
OOTRACEDBGB1(" CallState IE = {\n");
|
||||||
|
OOTRACEDBGB2(" %d\n", ie->data[0]);
|
||||||
|
OOTRACEDBGB1(" }\n");
|
||||||
|
}
|
||||||
|
|
||||||
/* TODO: Get rid of ie list.*/
|
/* TODO: Get rid of ie list.*/
|
||||||
dListAppend (pctxt, &msg->ies, ie);
|
dListAppend (pctxt, &msg->ies, ie);
|
||||||
if (rv != ASN_OK)
|
if (rv != ASN_OK)
|
||||||
@@ -405,6 +414,7 @@ int ooCreateQ931Message(OOCTXT* pctxt, Q931Message **q931msg, int msgType)
|
|||||||
(*q931msg)->callingPartyNumberIE = NULL;
|
(*q931msg)->callingPartyNumberIE = NULL;
|
||||||
(*q931msg)->calledPartyNumberIE = NULL;
|
(*q931msg)->calledPartyNumberIE = NULL;
|
||||||
(*q931msg)->causeIE = NULL;
|
(*q931msg)->causeIE = NULL;
|
||||||
|
(*q931msg)->callstateIE = NULL;
|
||||||
return OO_OK;
|
return OO_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -683,6 +693,10 @@ int ooEncodeH225Message(OOH323CallData *call, Q931Message *pq931Msg,
|
|||||||
else if(pq931Msg->messageType == Q931InformationMsg){
|
else if(pq931Msg->messageType == Q931InformationMsg){
|
||||||
msgbuf[i++] = OOInformationMessage;
|
msgbuf[i++] = OOInformationMessage;
|
||||||
}
|
}
|
||||||
|
else if(pq931Msg->messageType == Q931StatusMsg ||
|
||||||
|
pq931Msg->messageType == Q931StatusEnquiryMsg){
|
||||||
|
msgbuf[i++] = OOStatus;
|
||||||
|
}
|
||||||
else if(pq931Msg->messageType == Q931FacilityMsg){
|
else if(pq931Msg->messageType == Q931FacilityMsg){
|
||||||
msgbuf[i++] = OOFacility;
|
msgbuf[i++] = OOFacility;
|
||||||
msgbuf[i++] = pq931Msg->tunneledMsgType;
|
msgbuf[i++] = pq931Msg->tunneledMsgType;
|
||||||
@@ -753,8 +767,8 @@ int ooEncodeH225Message(OOH323CallData *call, Q931Message *pq931Msg,
|
|||||||
msgbuf[i++] = 0x88;
|
msgbuf[i++] = 0x88;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
/*Add display ie. */
|
/*Add display ie. for all but Status message as per ASTERISK-18748 */
|
||||||
if(!ooUtilsIsStrEmpty(call->ourCallerId))
|
if(!ooUtilsIsStrEmpty(call->ourCallerId) && (pq931Msg->messageType != Q931StatusMsg))
|
||||||
{
|
{
|
||||||
msgbuf[i++] = Q931DisplayIE;
|
msgbuf[i++] = Q931DisplayIE;
|
||||||
ieLen = strlen(call->ourCallerId)+1;
|
ieLen = strlen(call->ourCallerId)+1;
|
||||||
@@ -793,6 +807,13 @@ int ooEncodeH225Message(OOH323CallData *call, Q931Message *pq931Msg,
|
|||||||
i += pq931Msg->keypadIE->length;
|
i += pq931Msg->keypadIE->length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(pq931Msg->callstateIE) {
|
||||||
|
msgbuf[i++] = Q931CallStateIE;
|
||||||
|
msgbuf[i++] = pq931Msg->callstateIE->length;
|
||||||
|
memcpy(msgbuf+i, pq931Msg->callstateIE->data, pq931Msg->callstateIE->length);
|
||||||
|
i += pq931Msg->callstateIE->length;
|
||||||
|
}
|
||||||
|
|
||||||
/* Note: Have to fix this, though it works. Need to get rid of ie list.
|
/* Note: Have to fix this, though it works. Need to get rid of ie list.
|
||||||
Right now we only put UUIE in ie list. Can be easily removed.
|
Right now we only put UUIE in ie list. Can be easily removed.
|
||||||
*/
|
*/
|
||||||
@@ -1741,6 +1762,138 @@ int ooSendStartH245Facility(OOH323CallData *call)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
int ooSendStatus(OOH323CallData *call)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
H225Status_UUIE *status;
|
||||||
|
Q931Message *q931msg=NULL;
|
||||||
|
/* OOCTXT *pctxt = &gH323ep.msgctxt; */
|
||||||
|
OOCTXT *pctxt = call->msgctxt;
|
||||||
|
|
||||||
|
OOTRACEDBGC3("Building StatusMsg (%s, %s)\n", call->callType,
|
||||||
|
call->callToken);
|
||||||
|
ret = ooCreateQ931Message(pctxt, &q931msg, Q931StatusMsg);
|
||||||
|
if(ret != OO_OK)
|
||||||
|
{
|
||||||
|
OOTRACEERR1("Error: In allocating memory for - H225 Status "
|
||||||
|
"message\n");
|
||||||
|
return OO_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
q931msg->callReference = call->callReference;
|
||||||
|
|
||||||
|
q931msg->userInfo = (H225H323_UserInformation*)memAllocZ(pctxt,
|
||||||
|
sizeof(H225H323_UserInformation));
|
||||||
|
if(!q931msg->userInfo)
|
||||||
|
{
|
||||||
|
OOTRACEERR1("ERROR:Memory - ooSendStatus - userInfo\n");
|
||||||
|
return OO_FAILED;
|
||||||
|
}
|
||||||
|
q931msg->userInfo->h323_uu_pdu.m.h245TunnelingPresent=1;
|
||||||
|
q931msg->userInfo->h323_uu_pdu.h245Tunneling =
|
||||||
|
OO_TESTFLAG(call->flags, OO_M_TUNNELING);
|
||||||
|
q931msg->userInfo->h323_uu_pdu.h323_message_body.t =
|
||||||
|
T_H225H323_UU_PDU_h323_message_body_status;
|
||||||
|
|
||||||
|
status = (H225Status_UUIE*)memAllocZ(pctxt,
|
||||||
|
sizeof(H225Status_UUIE));
|
||||||
|
if(!status)
|
||||||
|
{
|
||||||
|
OOTRACEERR1("ERROR:Memory - ooSendStatus \n");
|
||||||
|
return OO_FAILED;
|
||||||
|
}
|
||||||
|
q931msg->userInfo->h323_uu_pdu.h323_message_body.u.status = status;
|
||||||
|
|
||||||
|
status->callIdentifier.guid.numocts =
|
||||||
|
call->callIdentifier.guid.numocts;
|
||||||
|
memcpy(status->callIdentifier.guid.data,
|
||||||
|
call->callIdentifier.guid.data,
|
||||||
|
call->callIdentifier.guid.numocts);
|
||||||
|
status->protocolIdentifier = gProtocolID;
|
||||||
|
|
||||||
|
ooQ931SetCauseIE(pctxt, q931msg, Q931StatusEnquiryResponse, 0, 0);
|
||||||
|
ooQ931SetCallStateIE(pctxt, q931msg, 10);
|
||||||
|
|
||||||
|
OOTRACEDBGA3("Built Status (%s, %s)\n", call->callType,
|
||||||
|
call->callToken);
|
||||||
|
ret = ooSendH225Msg(call, q931msg);
|
||||||
|
if(ret != OO_OK)
|
||||||
|
{
|
||||||
|
OOTRACEERR3("Error:Failed to enqueue Status message to outbound queue.(%s, %s)\n", call->callType, call->callToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* memReset(&gH323ep.msgctxt); */
|
||||||
|
memReset(call->msgctxt);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ooSendStatusInquiry(OOH323CallData *call)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
H225StatusInquiry_UUIE *statusInq;
|
||||||
|
Q931Message *q931msg=NULL;
|
||||||
|
/* OOCTXT *pctxt = &gH323ep.msgctxt; */
|
||||||
|
OOCTXT *pctxt = call->msgctxt;
|
||||||
|
|
||||||
|
OOTRACEDBGC3("Building StatusInquryMsg (%s, %s)\n", call->callType,
|
||||||
|
call->callToken);
|
||||||
|
ret = ooCreateQ931Message(pctxt, &q931msg, Q931StatusEnquiryMsg);
|
||||||
|
if(ret != OO_OK)
|
||||||
|
{
|
||||||
|
OOTRACEERR1("Error: In allocating memory for - H225 Status "
|
||||||
|
"message\n");
|
||||||
|
return OO_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
q931msg->callReference = call->callReference;
|
||||||
|
|
||||||
|
q931msg->userInfo = (H225H323_UserInformation*)memAllocZ(pctxt,
|
||||||
|
sizeof(H225H323_UserInformation));
|
||||||
|
if(!q931msg->userInfo)
|
||||||
|
{
|
||||||
|
OOTRACEERR1("ERROR:Memory - ooSendStatus - userInfo\n");
|
||||||
|
return OO_FAILED;
|
||||||
|
}
|
||||||
|
q931msg->userInfo->h323_uu_pdu.m.h245TunnelingPresent=1;
|
||||||
|
q931msg->userInfo->h323_uu_pdu.h245Tunneling =
|
||||||
|
OO_TESTFLAG(call->flags, OO_M_TUNNELING);
|
||||||
|
q931msg->userInfo->h323_uu_pdu.h323_message_body.t =
|
||||||
|
T_H225H323_UU_PDU_h323_message_body_statusInquiry;
|
||||||
|
|
||||||
|
statusInq = (H225StatusInquiry_UUIE*)memAllocZ(pctxt,
|
||||||
|
sizeof(H225StatusInquiry_UUIE));
|
||||||
|
if(!statusInq)
|
||||||
|
{
|
||||||
|
OOTRACEERR1("ERROR:Memory - ooSendStatusInquiry \n");
|
||||||
|
return OO_FAILED;
|
||||||
|
}
|
||||||
|
q931msg->userInfo->h323_uu_pdu.h323_message_body.u.statusInquiry = statusInq;
|
||||||
|
|
||||||
|
statusInq->callIdentifier.guid.numocts =
|
||||||
|
call->callIdentifier.guid.numocts;
|
||||||
|
memcpy(statusInq->callIdentifier.guid.data,
|
||||||
|
call->callIdentifier.guid.data,
|
||||||
|
call->callIdentifier.guid.numocts);
|
||||||
|
statusInq->protocolIdentifier = gProtocolID;
|
||||||
|
|
||||||
|
OOTRACEDBGA3("Built StatusInquiry (%s, %s)\n", call->callType,
|
||||||
|
call->callToken);
|
||||||
|
ret = ooSendH225Msg(call, q931msg);
|
||||||
|
if(ret != OO_OK)
|
||||||
|
{
|
||||||
|
OOTRACEERR3("Error:Failed to enqueue Status message to outbound queue.(%s, %s)\n", call->callType, call->callToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* memReset(&gH323ep.msgctxt); */
|
||||||
|
memReset(call->msgctxt);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
int ooSendReleaseComplete(OOH323CallData *call)
|
int ooSendReleaseComplete(OOH323CallData *call)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
@@ -3253,6 +3406,28 @@ int ooQ931SetCalledPartyNumberIE
|
|||||||
return OO_OK;
|
return OO_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ooQ931SetCallStateIE
|
||||||
|
(OOCTXT* pctxt, Q931Message *pmsg, unsigned char callstate)
|
||||||
|
{
|
||||||
|
if(pmsg->callstateIE){
|
||||||
|
memFreePtr(pctxt, pmsg->callstateIE);
|
||||||
|
pmsg->callstateIE = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
pmsg->callstateIE = (Q931InformationElement*)
|
||||||
|
memAllocZ(pctxt, sizeof(Q931InformationElement));
|
||||||
|
if(!pmsg->callstateIE)
|
||||||
|
{
|
||||||
|
OOTRACEERR1("Error:Memory - ooQ931SetCallstateIE - causeIE\n");
|
||||||
|
return OO_FAILED;
|
||||||
|
}
|
||||||
|
pmsg->callstateIE->discriminator = Q931CallStateIE;
|
||||||
|
pmsg->callstateIE->length = 1;
|
||||||
|
pmsg->callstateIE->data[0] = callstate;
|
||||||
|
|
||||||
|
return OO_OK;
|
||||||
|
}
|
||||||
|
|
||||||
int ooQ931SetCauseIE
|
int ooQ931SetCauseIE
|
||||||
(OOCTXT* pctxt, Q931Message *pmsg, enum Q931CauseValues cause, unsigned coding,
|
(OOCTXT* pctxt, Q931Message *pmsg, enum Q931CauseValues cause, unsigned coding,
|
||||||
unsigned location)
|
unsigned location)
|
||||||
|
|||||||
@@ -246,6 +246,7 @@ typedef struct Q931Message {
|
|||||||
Q931InformationElement *calledPartyNumberIE;
|
Q931InformationElement *calledPartyNumberIE;
|
||||||
Q931InformationElement *causeIE;
|
Q931InformationElement *causeIE;
|
||||||
Q931InformationElement *keypadIE;
|
Q931InformationElement *keypadIE;
|
||||||
|
Q931InformationElement *callstateIE;
|
||||||
H225H323_UserInformation *userInfo;
|
H225H323_UserInformation *userInfo;
|
||||||
} Q931Message;
|
} Q931Message;
|
||||||
|
|
||||||
@@ -469,6 +470,10 @@ EXTERN int ooSendAlerting(struct OOH323CallData *call);
|
|||||||
|
|
||||||
EXTERN int ooSendProgress(struct OOH323CallData *call);
|
EXTERN int ooSendProgress(struct OOH323CallData *call);
|
||||||
|
|
||||||
|
EXTERN int ooSendStatus(struct OOH323CallData *call);
|
||||||
|
|
||||||
|
EXTERN int ooSendStatusInquiry(struct OOH323CallData *call);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function is invoked to send Facility message.
|
* This function is invoked to send Facility message.
|
||||||
*
|
*
|
||||||
@@ -714,6 +719,9 @@ EXTERN int ooQ931SetCauseIE
|
|||||||
(OOCTXT *pctxt, Q931Message *pmsg,enum Q931CauseValues cause, unsigned coding,
|
(OOCTXT *pctxt, Q931Message *pmsg,enum Q931CauseValues cause, unsigned coding,
|
||||||
unsigned location);
|
unsigned location);
|
||||||
|
|
||||||
|
EXTERN int ooQ931SetCallStateIE
|
||||||
|
(OOCTXT *pctxt, Q931Message *pmsg, unsigned char callstate);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function is used to convert a call clear reason to cause and
|
* This function is used to convert a call clear reason to cause and
|
||||||
* reason code. It is used when local user is endoing the call and
|
* reason code. It is used when local user is endoing the call and
|
||||||
|
|||||||
@@ -190,8 +190,9 @@ typedef enum OOCallClearReason {
|
|||||||
#define OORequestMode 133
|
#define OORequestMode 133
|
||||||
#define OORequestDelayResponse 134
|
#define OORequestDelayResponse 134
|
||||||
#define OORequestDelayRequest 135
|
#define OORequestDelayRequest 135
|
||||||
|
#define OOStatus 136
|
||||||
|
|
||||||
#define OO_MSGTYPE_MAX 135
|
#define OO_MSGTYPE_MAX 136
|
||||||
|
|
||||||
/* Timer types */
|
/* Timer types */
|
||||||
#define OO_CALLESTB_TIMER (1<<0)
|
#define OO_CALLESTB_TIMER (1<<0)
|
||||||
|
|||||||
Reference in New Issue
Block a user