[asterisk-commits] may: branch may/ooh323_ipv6_direct_rtp r346345 - in /team/may/ooh323_ipv6_dir...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Nov 28 12:15:07 CST 2011
Author: may
Date: Mon Nov 28 12:15:02 2011
New Revision: 346345
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=346345
Log:
introduce callback for setup early media ip from fs part of setup packet
(HandleFastStartChannels & setup_rtp_remote)
fix dead lock bug of printlock in fast start proccessing routines
Modified:
team/may/ooh323_ipv6_direct_rtp/addons/chan_ooh323.c
team/may/ooh323_ipv6_direct_rtp/addons/chan_ooh323.h
team/may/ooh323_ipv6_direct_rtp/addons/ooh323c/src/ooCalls.h
team/may/ooh323_ipv6_direct_rtp/addons/ooh323c/src/ooh323.c
team/may/ooh323_ipv6_direct_rtp/addons/ooh323c/src/ooh323ep.c
team/may/ooh323_ipv6_direct_rtp/addons/ooh323c/src/ooq931.c
team/may/ooh323_ipv6_direct_rtp/addons/ooh323c/src/ooq931.h
Modified: team/may/ooh323_ipv6_direct_rtp/addons/chan_ooh323.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6_direct_rtp/addons/chan_ooh323.c?view=diff&rev=346345&r1=346344&r2=346345
==============================================================================
--- team/may/ooh323_ipv6_direct_rtp/addons/chan_ooh323.c (original)
+++ team/may/ooh323_ipv6_direct_rtp/addons/chan_ooh323.c Mon Nov 28 12:15:02 2011
@@ -3561,7 +3561,8 @@
.onCallCleared = onCallCleared,
.openLogicalChannels = NULL,
.onReceivedDTMF = ooh323_onReceivedDigit,
- .onModeChanged = onModeChanged
+ .onModeChanged = onModeChanged,
+ .onMediaChanged = (cb_OnMediaChanged) setup_rtp_remote,
};
if (!(gCap = ast_format_cap_alloc())) {
return 1;
@@ -4433,6 +4434,45 @@
return 1;
}
+
+void setup_rtp_remote(ooCallData *call, const char *remoteIp,
+ int remotePort)
+{
+ struct ooh323_pvt *p = NULL;
+ struct ast_sockaddr tmp;
+
+ if (gH323Debug)
+ ast_verbose("--- setup_rtp_remote %s:%d\n", remoteIp, remotePort);
+
+ if (!remoteIp || !remoteIp[0] || !remotePort) {
+ if (gH323Debug) {
+ ast_verbose("+++ setup_rtp_remote no data\n");
+ }
+ return;
+ }
+
+ /* Find the call or allocate a private structure if call not found */
+ p = find_call(call);
+
+ if (!p || !p->rtp) {
+ ast_log(LOG_ERROR, "Something is wrong: rtp\n");
+ return;
+ }
+
+ ast_mutex_lock(&p->lock);
+
+ ast_parse_arg(remoteIp, PARSE_ADDR, &tmp);
+ ast_sockaddr_set_port(&tmp, remotePort);
+ ast_rtp_instance_set_remote_address(p->rtp, &tmp);
+
+ ast_mutex_unlock(&p->lock);
+
+ if(gH323Debug)
+ ast_verbose("+++ setup_rtp_remote\n");
+
+ return;
+}
+
void setup_rtp_connection(ooCallData *call, const char *remoteIp,
int remotePort)
Modified: team/may/ooh323_ipv6_direct_rtp/addons/chan_ooh323.h
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6_direct_rtp/addons/chan_ooh323.h?view=diff&rev=346345&r1=346344&r2=346345
==============================================================================
--- team/may/ooh323_ipv6_direct_rtp/addons/chan_ooh323.h (original)
+++ team/may/ooh323_ipv6_direct_rtp/addons/chan_ooh323.h Mon Nov 28 12:15:02 2011
@@ -94,6 +94,8 @@
int restart_monitor(void);
int configure_local_rtp(struct ooh323_pvt *p, ooCallData* call);
+void setup_rtp_remote(ooCallData *call, const char *remoteIp,
+ int remotePort);
void setup_rtp_connection(ooCallData *call, const char *remoteIp,
int remotePort);
void close_rtp_connection(ooCallData *call);
Modified: team/may/ooh323_ipv6_direct_rtp/addons/ooh323c/src/ooCalls.h
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6_direct_rtp/addons/ooh323c/src/ooCalls.h?view=diff&rev=346345&r1=346344&r2=346345
==============================================================================
--- team/may/ooh323_ipv6_direct_rtp/addons/ooh323c/src/ooCalls.h (original)
+++ team/may/ooh323_ipv6_direct_rtp/addons/ooh323c/src/ooCalls.h Mon Nov 28 12:15:02 2011
@@ -328,6 +328,9 @@
typedef void (*cb_OnModeChanged)
(struct OOH323CallData *call, int isT38Mode);
+typedef void (*cb_OnMediaChanged)
+ (struct OOH323CallData *call, char* remoteIP, int remotePort);
+
/**
* This structure holds all of the H.323 signaling callback function
* addresses.
@@ -345,6 +348,7 @@
cb_OpenLogicalChannels openLogicalChannels;
cb_OnReceivedDTMF onReceivedDTMF;
cb_OnModeChanged onModeChanged;
+ cb_OnMediaChanged onMediaChanged;
} OOH323CALLBACKS;
/**
Modified: team/may/ooh323_ipv6_direct_rtp/addons/ooh323c/src/ooh323.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6_direct_rtp/addons/ooh323c/src/ooh323.c?view=diff&rev=346345&r1=346344&r2=346345
==============================================================================
--- team/may/ooh323_ipv6_direct_rtp/addons/ooh323c/src/ooh323.c (original)
+++ team/may/ooh323_ipv6_direct_rtp/addons/ooh323c/src/ooh323.c Mon Nov 28 12:15:02 2011
@@ -104,6 +104,8 @@
call->callEndReason = OO_REASON_LOCAL_CLEARED;
call->callState = OO_CALL_CLEAR;
}
+ finishPrint();
+ removeEventHandler(call->pctxt);
return OO_FAILED;
}
memset(olc, 0, sizeof(H245OpenLogicalChannel));
@@ -122,6 +124,8 @@
call->callEndReason = OO_REASON_INVALIDMESSAGE;
call->callState = OO_CALL_CLEAR;
}
+ finishPrint();
+ removeEventHandler(call->pctxt);
return OO_FAILED;
}
@@ -134,6 +138,8 @@
"(%s, %s)\n",
olc->forwardLogicalChannelNumber, call->callType,
call->callToken);
+ finishPrint();
+ removeEventHandler(call->pctxt);
return OO_FAILED;
}
if(pChannel->channelNo != olc->forwardLogicalChannelNumber)
@@ -165,6 +171,8 @@
OOTRACEERR3("ERROR:Invalid OLC received in fast start. No "
"forward Logical Channel Parameters found. "
"(%s, %s)\n", call->callType, call->callToken);
+ finishPrint();
+ removeEventHandler(call->pctxt);
return OO_FAILED;
}
if(!h2250lcp->m.mediaChannelPresent)
@@ -187,6 +195,8 @@
}
OOTRACEERR3("ERROR:Unsupported media channel address type "
"(%s, %s)\n", call->callType, call->callToken);
+ finishPrint();
+ removeEventHandler(call->pctxt);
return OO_FAILED;
}
@@ -579,6 +589,8 @@
call->callEndReason = OO_REASON_LOCAL_CLEARED;
call->callState = OO_CALL_CLEAR;
}
+ finishPrint();
+ removeEventHandler(call->pctxt);
return OO_FAILED;
}
memset(olc, 0, sizeof(H245OpenLogicalChannel));
@@ -598,7 +610,9 @@
call->callEndReason = OO_REASON_INVALIDMESSAGE;
call->callState = OO_CALL_CLEAR;
}
- return OO_FAILED;
+ finishPrint();
+ removeEventHandler(call->pctxt);
+ return OO_FAILED;
}
/* For now, just add decoded fast start elemts to list. This list
will be processed at the time of sending CONNECT message. */
@@ -672,6 +686,8 @@
call->callEndReason = OO_REASON_LOCAL_CLEARED;
call->callState = OO_CALL_CLEAR;
}
+ finishPrint();
+ removeEventHandler(call->pctxt);
return OO_FAILED;
}
memset(olc, 0, sizeof(H245OpenLogicalChannel));
@@ -690,6 +706,8 @@
call->callEndReason = OO_REASON_INVALIDMESSAGE;
call->callState = OO_CALL_CLEAR;
}
+ finishPrint();
+ removeEventHandler(call->pctxt);
return OO_FAILED;
}
@@ -702,6 +720,8 @@
"(%s, %s)\n",
olc->forwardLogicalChannelNumber, call->callType,
call->callToken);
+ finishPrint();
+ removeEventHandler(call->pctxt);
return OO_FAILED;
}
if(pChannel->channelNo != olc->forwardLogicalChannelNumber)
@@ -732,6 +752,8 @@
OOTRACEERR3("ERROR:Invalid OLC received in fast start. No "
"forward Logical Channel Parameters found. "
"(%s, %s)\n", call->callType, call->callToken);
+ finishPrint();
+ removeEventHandler(call->pctxt);
return OO_FAILED;
}
if(!h2250lcp->m.mediaChannelPresent)
@@ -739,6 +761,252 @@
OOTRACEERR3("ERROR:Invalid OLC received in fast start. No "
"reverse media channel information found."
"(%s, %s)\n", call->callType, call->callToken);
+ finishPrint();
+ removeEventHandler(call->pctxt);
+ return OO_FAILED;
+ }
+ ret = ooGetIpPortFromH245TransportAddress(call,
+ &h2250lcp->mediaChannel, pChannel->remoteIP,
+ &pChannel->remoteMediaPort);
+
+ if(ret != OO_OK)
+ {
+ if(call->callState < OO_CALL_CLEAR)
+ {
+ call->callEndReason = OO_REASON_INVALIDMESSAGE;
+ call->callState = OO_CALL_CLEAR;
+ }
+ OOTRACEERR3("ERROR:Unsupported media channel address type "
+ "(%s, %s)\n", call->callType, call->callToken);
+ finishPrint();
+ removeEventHandler(call->pctxt);
+ return OO_FAILED;
+ }
+
+ if(!pChannel->chanCap->startTransmitChannel)
+ {
+ OOTRACEERR3("ERROR:No callback registered to start transmit "
+ "channel (%s, %s)\n",call->callType,
+ call->callToken);
+ finishPrint();
+ removeEventHandler(call->pctxt);
+ return OO_FAILED;
+ }
+ pChannel->chanCap->startTransmitChannel(call, pChannel);
+ }
+ /* Mark the current channel as established and close all other
+ logical channels with same session id and in same direction.
+ */
+ ooOnLogicalChannelEstablished(call, pChannel);
+ }
+ finishPrint();
+ removeEventHandler(call->pctxt);
+ OO_SETFLAG(call->flags, OO_M_FASTSTARTANSWERED);
+ }
+
+ }
+
+ /* Retrieve tunneling info/H.245 control channel address from the connect msg */
+ if(q931Msg->userInfo->h323_uu_pdu.m.h245TunnelingPresent &&
+ !q931Msg->userInfo->h323_uu_pdu.h245Tunneling) {
+ if (OO_TESTFLAG (call->flags, OO_M_TUNNELING)) {
+ OO_CLRFLAG (call->flags, OO_M_TUNNELING);
+ OOTRACEINFO3("Tunneling is disabled for call due to remote reject tunneling"
+ " (%s, %s)\n", call->callType, call->callToken);
+ }
+ }
+ if(q931Msg->userInfo->h323_uu_pdu.m.h245TunnelingPresent &&
+ q931Msg->userInfo->h323_uu_pdu.h245Tunneling &&
+ OO_TESTFLAG (call->flags, OO_M_TUNNELING) &&
+ callProceeding->m.h245AddressPresent) {
+ OOTRACEINFO3("Tunneling and h245address provided."
+ "Using Tunneling for H.245 messages (%s, %s)\n",
+ call->callType, call->callToken);
+ }
+ else if(callProceeding->m.h245AddressPresent)
+ {
+ if (OO_TESTFLAG (call->flags, OO_M_TUNNELING))
+ {
+ OO_CLRFLAG (call->flags, OO_M_TUNNELING);
+ OOTRACEINFO3("Tunneling is disabled for call as H245 address is "
+ "provided in callProceeding message (%s, %s)\n",
+ call->callType, call->callToken);
+ }
+ ret = ooH323GetIpPortFromH225TransportAddress(call,
+ &callProceeding->h245Address, call->remoteIP,
+ &call->remoteH245Port);
+ if(ret != OO_OK)
+ {
+ OOTRACEERR3("Error: Unknown H245 address type in received "
+ "CallProceeding message (%s, %s)", call->callType,
+ call->callToken);
+ /* Mark call for clearing */
+ if(call->callState < OO_CALL_CLEAR)
+ {
+ call->callEndReason = OO_REASON_INVALIDMESSAGE;
+ call->callState = OO_CALL_CLEAR;
+ }
+ return OO_FAILED;
+ }
+ if(call->remoteH245Port != 0 && !call->pH245Channel) {
+ /* Create an H.245 connection.
+ */
+ if(ooCreateH245Connection(call)== OO_FAILED)
+ {
+ OOTRACEERR3("Error: H.245 channel creation failed (%s, %s)\n",
+ call->callType, call->callToken);
+
+ if(call->callState < OO_CALL_CLEAR)
+ {
+ call->callEndReason = OO_REASON_TRANSPORTFAILURE;
+ call->callState = OO_CALL_CLEAR;
+ }
+ return OO_FAILED;
+ }
+ }
+ }
+
+ return OO_OK;
+}
+
+
+int ooOnReceivedAlerting(OOH323CallData *call, Q931Message *q931Msg)
+{
+ H225Alerting_UUIE *alerting=NULL;
+ H245OpenLogicalChannel* olc;
+ ASN1OCTET msgbuf[MAXMSGLEN];
+ ooLogicalChannel * pChannel = NULL;
+ H245H2250LogicalChannelParameters * h2250lcp = NULL;
+ int i=0, ret=0;
+
+ ooHandleDisplayIE(call, q931Msg);
+
+ if(!q931Msg->userInfo)
+ {
+ OOTRACEERR3("ERROR:No User-User IE in received Alerting message."
+ " (%s, %s)\n", call->callType, call->callToken);
+ return OO_FAILED;
+ }
+ alerting = q931Msg->userInfo->h323_uu_pdu.h323_message_body.u.alerting;
+ if(alerting == NULL)
+ {
+ OOTRACEERR3("Error: Received Alerting message does not have "
+ "alerting UUIE (%s, %s)\n", call->callType,
+ call->callToken);
+ /* Mark call for clearing */
+ if(call->callState < OO_CALL_CLEAR)
+ {
+ call->callEndReason = OO_REASON_INVALIDMESSAGE;
+ call->callState = OO_CALL_CLEAR;
+ }
+ return OO_FAILED;
+ }
+ ooHandleH2250ID(call, alerting->protocolIdentifier);
+ /*Handle fast-start */
+ if(OO_TESTFLAG (call->flags, OO_M_FASTSTART) &&
+ !OO_TESTFLAG(call->flags, OO_M_FASTSTARTANSWERED))
+ {
+ if(alerting->m.fastStartPresent)
+ {
+ /* For printing the decoded message to log, initialize handler. */
+ initializePrintHandler(&printHandler, "FastStart Elements");
+
+ /* Set print handler */
+ setEventHandler (call->pctxt, &printHandler);
+
+ for(i=0; i<(int)alerting->fastStart.n; i++)
+ {
+ olc = NULL;
+
+ olc = (H245OpenLogicalChannel*)memAlloc(call->pctxt,
+ sizeof(H245OpenLogicalChannel));
+ if(!olc)
+ {
+ OOTRACEERR3("ERROR:Memory - ooOnReceivedAlerting - olc"
+ "(%s, %s)\n", call->callType, call->callToken);
+ /*Mark call for clearing */
+ if(call->callState < OO_CALL_CLEAR)
+ {
+ call->callEndReason = OO_REASON_LOCAL_CLEARED;
+ call->callState = OO_CALL_CLEAR;
+ }
+ finishPrint();
+ removeEventHandler(call->pctxt);
+ return OO_FAILED;
+ }
+ memset(olc, 0, sizeof(H245OpenLogicalChannel));
+ memcpy(msgbuf, alerting->fastStart.elem[i].data,
+ alerting->fastStart.elem[i].numocts);
+ setPERBuffer(call->pctxt, msgbuf,
+ alerting->fastStart.elem[i].numocts, 1);
+ ret = asn1PD_H245OpenLogicalChannel(call->pctxt, olc);
+ if(ret != ASN_OK)
+ {
+ OOTRACEERR3("ERROR:Failed to decode fast start olc element "
+ "(%s, %s)\n", call->callType, call->callToken);
+ /* Mark call for clearing */
+ if(call->callState < OO_CALL_CLEAR)
+ {
+ call->callEndReason = OO_REASON_INVALIDMESSAGE;
+ call->callState = OO_CALL_CLEAR;
+ }
+ finishPrint();
+ removeEventHandler(call->pctxt);
+ return OO_FAILED;
+ }
+
+ dListAppend(call->pctxt, &call->remoteFastStartOLCs, olc);
+
+ pChannel = ooFindLogicalChannelByOLC(call, olc);
+ if(!pChannel)
+ {
+ OOTRACEERR4("ERROR: Logical Channel %d not found, fast start. "
+ "(%s, %s)\n",
+ olc->forwardLogicalChannelNumber, call->callType,
+ call->callToken);
+ finishPrint();
+ removeEventHandler(call->pctxt);
+ return OO_FAILED;
+ }
+ if(pChannel->channelNo != olc->forwardLogicalChannelNumber)
+ {
+ OOTRACEINFO5("Remote endpoint changed forwardLogicalChannel"
+ "Number from %d to %d (%s, %s)\n",
+ pChannel->channelNo,
+ olc->forwardLogicalChannelNumber, call->callType,
+ call->callToken);
+ pChannel->channelNo = olc->forwardLogicalChannelNumber;
+ }
+ if(!strcmp(pChannel->dir, "transmit"))
+ {
+ if(olc->forwardLogicalChannelParameters.multiplexParameters.t !=
+ T_H245OpenLogicalChannel_forwardLogicalChannelParameters_multiplexParameters_h2250LogicalChannelParameters)
+ {
+ OOTRACEERR4("ERROR:Unknown multiplex parameter type for "
+ "channel %d (%s, %s)\n",
+ olc->forwardLogicalChannelNumber, call->callType,
+ call->callToken);
+ continue;
+ }
+
+ /* Extract the remote media endpoint address */
+ h2250lcp = olc->forwardLogicalChannelParameters.multiplexParameters.u.h2250LogicalChannelParameters;
+ if(!h2250lcp)
+ {
+ OOTRACEERR3("ERROR:Invalid OLC received in fast start. No "
+ "forward Logical Channel Parameters found. "
+ "(%s, %s)\n", call->callType, call->callToken);
+ finishPrint();
+ removeEventHandler(call->pctxt);
+ return OO_FAILED;
+ }
+ if(!h2250lcp->m.mediaChannelPresent)
+ {
+ OOTRACEERR3("ERROR:Invalid OLC received in fast start. No "
+ "reverse media channel information found."
+ "(%s, %s)\n", call->callType, call->callToken);
+ finishPrint();
+ removeEventHandler(call->pctxt);
return OO_FAILED;
}
ret = ooGetIpPortFromH245TransportAddress(call,
@@ -762,236 +1030,8 @@
OOTRACEERR3("ERROR:No callback registered to start transmit "
"channel (%s, %s)\n",call->callType,
call->callToken);
- return OO_FAILED;
- }
- pChannel->chanCap->startTransmitChannel(call, pChannel);
- }
- /* Mark the current channel as established and close all other
- logical channels with same session id and in same direction.
- */
- ooOnLogicalChannelEstablished(call, pChannel);
- }
- finishPrint();
- removeEventHandler(call->pctxt);
- OO_SETFLAG(call->flags, OO_M_FASTSTARTANSWERED);
- }
-
- }
-
- /* Retrieve tunneling info/H.245 control channel address from the connect msg */
- if(q931Msg->userInfo->h323_uu_pdu.m.h245TunnelingPresent &&
- !q931Msg->userInfo->h323_uu_pdu.h245Tunneling) {
- if (OO_TESTFLAG (call->flags, OO_M_TUNNELING)) {
- OO_CLRFLAG (call->flags, OO_M_TUNNELING);
- OOTRACEINFO3("Tunneling is disabled for call due to remote reject tunneling"
- " (%s, %s)\n", call->callType, call->callToken);
- }
- }
- if(q931Msg->userInfo->h323_uu_pdu.m.h245TunnelingPresent &&
- q931Msg->userInfo->h323_uu_pdu.h245Tunneling &&
- OO_TESTFLAG (call->flags, OO_M_TUNNELING) &&
- callProceeding->m.h245AddressPresent) {
- OOTRACEINFO3("Tunneling and h245address provided."
- "Using Tunneling for H.245 messages (%s, %s)\n",
- call->callType, call->callToken);
- }
- else if(callProceeding->m.h245AddressPresent)
- {
- if (OO_TESTFLAG (call->flags, OO_M_TUNNELING))
- {
- OO_CLRFLAG (call->flags, OO_M_TUNNELING);
- OOTRACEINFO3("Tunneling is disabled for call as H245 address is "
- "provided in callProceeding message (%s, %s)\n",
- call->callType, call->callToken);
- }
- ret = ooH323GetIpPortFromH225TransportAddress(call,
- &callProceeding->h245Address, call->remoteIP,
- &call->remoteH245Port);
- if(ret != OO_OK)
- {
- OOTRACEERR3("Error: Unknown H245 address type in received "
- "CallProceeding message (%s, %s)", call->callType,
- call->callToken);
- /* Mark call for clearing */
- if(call->callState < OO_CALL_CLEAR)
- {
- call->callEndReason = OO_REASON_INVALIDMESSAGE;
- call->callState = OO_CALL_CLEAR;
- }
- return OO_FAILED;
- }
- if(call->remoteH245Port != 0 && !call->pH245Channel) {
- /* Create an H.245 connection.
- */
- if(ooCreateH245Connection(call)== OO_FAILED)
- {
- OOTRACEERR3("Error: H.245 channel creation failed (%s, %s)\n",
- call->callType, call->callToken);
-
- if(call->callState < OO_CALL_CLEAR)
- {
- call->callEndReason = OO_REASON_TRANSPORTFAILURE;
- call->callState = OO_CALL_CLEAR;
- }
- return OO_FAILED;
- }
- }
- }
-
- return OO_OK;
-}
-
-
-int ooOnReceivedAlerting(OOH323CallData *call, Q931Message *q931Msg)
-{
- H225Alerting_UUIE *alerting=NULL;
- H245OpenLogicalChannel* olc;
- ASN1OCTET msgbuf[MAXMSGLEN];
- ooLogicalChannel * pChannel = NULL;
- H245H2250LogicalChannelParameters * h2250lcp = NULL;
- int i=0, ret=0;
-
- ooHandleDisplayIE(call, q931Msg);
-
- if(!q931Msg->userInfo)
- {
- OOTRACEERR3("ERROR:No User-User IE in received Alerting message."
- " (%s, %s)\n", call->callType, call->callToken);
- return OO_FAILED;
- }
- alerting = q931Msg->userInfo->h323_uu_pdu.h323_message_body.u.alerting;
- if(alerting == NULL)
- {
- OOTRACEERR3("Error: Received Alerting message does not have "
- "alerting UUIE (%s, %s)\n", call->callType,
- call->callToken);
- /* Mark call for clearing */
- if(call->callState < OO_CALL_CLEAR)
- {
- call->callEndReason = OO_REASON_INVALIDMESSAGE;
- call->callState = OO_CALL_CLEAR;
- }
- return OO_FAILED;
- }
- ooHandleH2250ID(call, alerting->protocolIdentifier);
- /*Handle fast-start */
- if(OO_TESTFLAG (call->flags, OO_M_FASTSTART) &&
- !OO_TESTFLAG(call->flags, OO_M_FASTSTARTANSWERED))
- {
- if(alerting->m.fastStartPresent)
- {
- /* For printing the decoded message to log, initialize handler. */
- initializePrintHandler(&printHandler, "FastStart Elements");
-
- /* Set print handler */
- setEventHandler (call->pctxt, &printHandler);
-
- for(i=0; i<(int)alerting->fastStart.n; i++)
- {
- olc = NULL;
-
- olc = (H245OpenLogicalChannel*)memAlloc(call->pctxt,
- sizeof(H245OpenLogicalChannel));
- if(!olc)
- {
- OOTRACEERR3("ERROR:Memory - ooOnReceivedAlerting - olc"
- "(%s, %s)\n", call->callType, call->callToken);
- /*Mark call for clearing */
- if(call->callState < OO_CALL_CLEAR)
- {
- call->callEndReason = OO_REASON_LOCAL_CLEARED;
- call->callState = OO_CALL_CLEAR;
- }
- return OO_FAILED;
- }
- memset(olc, 0, sizeof(H245OpenLogicalChannel));
- memcpy(msgbuf, alerting->fastStart.elem[i].data,
- alerting->fastStart.elem[i].numocts);
- setPERBuffer(call->pctxt, msgbuf,
- alerting->fastStart.elem[i].numocts, 1);
- ret = asn1PD_H245OpenLogicalChannel(call->pctxt, olc);
- if(ret != ASN_OK)
- {
- OOTRACEERR3("ERROR:Failed to decode fast start olc element "
- "(%s, %s)\n", call->callType, call->callToken);
- /* Mark call for clearing */
- if(call->callState < OO_CALL_CLEAR)
- {
- call->callEndReason = OO_REASON_INVALIDMESSAGE;
- call->callState = OO_CALL_CLEAR;
- }
- return OO_FAILED;
- }
-
- dListAppend(call->pctxt, &call->remoteFastStartOLCs, olc);
-
- pChannel = ooFindLogicalChannelByOLC(call, olc);
- if(!pChannel)
- {
- OOTRACEERR4("ERROR: Logical Channel %d not found, fast start. "
- "(%s, %s)\n",
- olc->forwardLogicalChannelNumber, call->callType,
- call->callToken);
- return OO_FAILED;
- }
- if(pChannel->channelNo != olc->forwardLogicalChannelNumber)
- {
- OOTRACEINFO5("Remote endpoint changed forwardLogicalChannel"
- "Number from %d to %d (%s, %s)\n",
- pChannel->channelNo,
- olc->forwardLogicalChannelNumber, call->callType,
- call->callToken);
- pChannel->channelNo = olc->forwardLogicalChannelNumber;
- }
- if(!strcmp(pChannel->dir, "transmit"))
- {
- if(olc->forwardLogicalChannelParameters.multiplexParameters.t !=
- T_H245OpenLogicalChannel_forwardLogicalChannelParameters_multiplexParameters_h2250LogicalChannelParameters)
- {
- OOTRACEERR4("ERROR:Unknown multiplex parameter type for "
- "channel %d (%s, %s)\n",
- olc->forwardLogicalChannelNumber, call->callType,
- call->callToken);
- continue;
- }
-
- /* Extract the remote media endpoint address */
- h2250lcp = olc->forwardLogicalChannelParameters.multiplexParameters.u.h2250LogicalChannelParameters;
- if(!h2250lcp)
- {
- OOTRACEERR3("ERROR:Invalid OLC received in fast start. No "
- "forward Logical Channel Parameters found. "
- "(%s, %s)\n", call->callType, call->callToken);
- return OO_FAILED;
- }
- if(!h2250lcp->m.mediaChannelPresent)
- {
- OOTRACEERR3("ERROR:Invalid OLC received in fast start. No "
- "reverse media channel information found."
- "(%s, %s)\n", call->callType, call->callToken);
- return OO_FAILED;
- }
- ret = ooGetIpPortFromH245TransportAddress(call,
- &h2250lcp->mediaChannel, pChannel->remoteIP,
- &pChannel->remoteMediaPort);
-
- if(ret != OO_OK)
- {
- if(call->callState < OO_CALL_CLEAR)
- {
- call->callEndReason = OO_REASON_INVALIDMESSAGE;
- call->callState = OO_CALL_CLEAR;
- }
- OOTRACEERR3("ERROR:Unsupported media channel address type "
- "(%s, %s)\n", call->callType, call->callToken);
- return OO_FAILED;
- }
-
- if(!pChannel->chanCap->startTransmitChannel)
- {
- OOTRACEERR3("ERROR:No callback registered to start transmit "
- "channel (%s, %s)\n",call->callType,
- call->callToken);
+ finishPrint();
+ removeEventHandler(call->pctxt);
return OO_FAILED;
}
pChannel->chanCap->startTransmitChannel(call, pChannel);
@@ -1139,6 +1179,8 @@
call->callEndReason = OO_REASON_LOCAL_CLEARED;
call->callState = OO_CALL_CLEAR;
}
+ finishPrint();
+ removeEventHandler(call->pctxt);
return OO_FAILED;
}
memset(olc, 0, sizeof(H245OpenLogicalChannel));
@@ -1157,6 +1199,8 @@
call->callEndReason = OO_REASON_INVALIDMESSAGE;
call->callState = OO_CALL_CLEAR;
}
+ finishPrint();
+ removeEventHandler(call->pctxt);
return OO_FAILED;
}
@@ -1169,6 +1213,8 @@
"(%s, %s)\n",
olc->forwardLogicalChannelNumber, call->callType,
call->callToken);
+ finishPrint();
+ removeEventHandler(call->pctxt);
return OO_FAILED;
}
if(pChannel->channelNo != olc->forwardLogicalChannelNumber)
@@ -1199,6 +1245,8 @@
OOTRACEERR3("ERROR:Invalid OLC received in fast start. No "
"forward Logical Channel Parameters found. "
"(%s, %s)\n", call->callType, call->callToken);
+ finishPrint();
+ removeEventHandler(call->pctxt);
return OO_FAILED;
}
if(!h2250lcp->m.mediaChannelPresent)
@@ -1206,6 +1254,8 @@
OOTRACEERR3("ERROR:Invalid OLC received in fast start. No "
"reverse media channel information found."
"(%s, %s)\n", call->callType, call->callToken);
+ finishPrint();
+ removeEventHandler(call->pctxt);
return OO_FAILED;
}
ret = ooGetIpPortFromH245TransportAddress(call,
@@ -1221,6 +1271,8 @@
}
OOTRACEERR3("ERROR:Unsupported media channel address type "
"(%s, %s)\n", call->callType, call->callToken);
+ finishPrint();
+ removeEventHandler(call->pctxt);
return OO_FAILED;
}
@@ -1229,6 +1281,8 @@
OOTRACEERR3("ERROR:No callback registered to start transmit "
"channel (%s, %s)\n",call->callType,
call->callToken);
+ finishPrint();
+ removeEventHandler(call->pctxt);
return OO_FAILED;
}
pChannel->chanCap->startTransmitChannel(call, pChannel);
@@ -1687,11 +1741,12 @@
}
}
if (call->callState < OO_CALL_CLEAR) {
+ ooHandleFastStartChannels(call);
ooSendCallProceeding(call);/* Send call proceeding message*/
ret = ooH323CallAdmitted (call);
+ call->callState = OO_CALL_CONNECTING;
}
- call->callState = OO_CALL_CONNECTING;
} /* end ret == OO_OK */
break;
Modified: team/may/ooh323_ipv6_direct_rtp/addons/ooh323c/src/ooh323ep.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6_direct_rtp/addons/ooh323c/src/ooh323ep.c?view=diff&rev=346345&r1=346344&r2=346345
==============================================================================
--- team/may/ooh323_ipv6_direct_rtp/addons/ooh323c/src/ooh323ep.c (original)
+++ team/may/ooh323_ipv6_direct_rtp/addons/ooh323c/src/ooh323ep.c Mon Nov 28 12:15:02 2011
@@ -346,6 +346,7 @@
gH323ep.h323Callbacks.openLogicalChannels = h323Callbacks.openLogicalChannels;
gH323ep.h323Callbacks.onReceivedDTMF = h323Callbacks.onReceivedDTMF;
gH323ep.h323Callbacks.onModeChanged = h323Callbacks.onModeChanged;
+ gH323ep.h323Callbacks.onMediaChanged = h323Callbacks.onMediaChanged;
return OO_OK;
}
Modified: team/may/ooh323_ipv6_direct_rtp/addons/ooh323c/src/ooq931.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6_direct_rtp/addons/ooh323c/src/ooq931.c?view=diff&rev=346345&r1=346344&r2=346345
==============================================================================
--- team/may/ooh323_ipv6_direct_rtp/addons/ooh323c/src/ooq931.c (original)
+++ team/may/ooh323_ipv6_direct_rtp/addons/ooh323c/src/ooq931.c Mon Nov 28 12:15:02 2011
@@ -870,6 +870,114 @@
#endif
return OO_OK;
}
+
+/* Handle FS receive channels for early media */
+int ooHandleFastStartChannels(OOH323CallData *pCall)
+{
+ int i=0, j=0, remoteMediaControlPort = 0, dir=0;
+ char remoteMediaControlIP[2+8*4+7];
+ DListNode *pNode = NULL;
+ H245OpenLogicalChannel *olc = NULL;
+ ooH323EpCapability *epCap = NULL;
+ H245H2250LogicalChannelParameters *h2250lcp = NULL;
+ ooLogicalChannel* pChannel;
+
+
+ OOCTXT *pctxt = pCall->msgctxt;
+ /* If fast start supported and remote endpoint has sent faststart element */
+ if(OO_TESTFLAG(pCall->flags, OO_M_FASTSTART) &&
+ pCall->remoteFastStartOLCs.count>0)
+ {
+ /* Go though all the proposed channels */
+ for(i=0, j=0; i<(int)pCall->remoteFastStartOLCs.count; i++)
+ {
+
+ pNode = dListFindByIndex(&pCall->remoteFastStartOLCs, i);
+ olc = (H245OpenLogicalChannel*)pNode->data;
+
+ /* Don't support both direction channel */
+ if(olc->forwardLogicalChannelParameters.dataType.t !=
+ T_H245DataType_nullData &&
+ olc->m.reverseLogicalChannelParametersPresent)
+ continue;
+
+ /* Check forward logic channel */
+ if(olc->forwardLogicalChannelParameters.dataType.t !=
+ T_H245DataType_nullData)
+ {
+ /* Forward Channel - remote transmits - local receives */
+ OOTRACEDBGC4("Processing received forward olc %d (%s, %s)\n",
+ olc->forwardLogicalChannelNumber, pCall->callType,
+ pCall->callToken);
+ dir = OORX;
+ epCap = ooIsDataTypeSupported(pCall,
+ &olc->forwardLogicalChannelParameters.dataType,
+ OORX);
+
+ if(!epCap) { continue; } /* Not Supported Channel */
+
+ OOTRACEINFO1("Receive Channel data type supported\n");
+ if(olc->forwardLogicalChannelParameters.multiplexParameters.t !=
+ T_H245OpenLogicalChannel_forwardLogicalChannelParameters_multiplexParameters_h2250LogicalChannelParameters)
+ {
+ OOTRACEERR4("ERROR:Unknown multiplex parameter type for "
+ "channel %d (%s, %s)\n",
+ olc->forwardLogicalChannelNumber,
+ pCall->callType, pCall->callToken);
+ memFreePtr(pCall->pctxt, epCap);
+ epCap = NULL;
+ continue;
+ }
+ h2250lcp = olc->forwardLogicalChannelParameters.multiplexParameters.u.h2250LogicalChannelParameters;
+
+ /* Check session is Not already established */
+ if(ooIsSessionEstablished(pCall, olc->forwardLogicalChannelParameters.multiplexParameters.u.h2250LogicalChannelParameters->sessionID, "receive"))
+ {
+
+ OOTRACEINFO4("Receive channel with sessionID %d already "
+ "established.(%s, %s)\n", olc->forwardLogicalChannelParameters.multiplexParameters.u.h2250LogicalChannelParameters->sessionID,
+ pCall->callType, pCall->callToken);
+ memFreePtr(pCall->pctxt, epCap);
+ epCap = NULL;
+ continue;
+ }
+
+ /* Extract mediaControlChannel info, if supplied */
+ if(h2250lcp->m.mediaControlChannelPresent)
+ {
+ if(OO_OK != ooGetIpPortFromH245TransportAddress(pCall,
+ &h2250lcp->mediaControlChannel,
+ remoteMediaControlIP, &remoteMediaControlPort))
+ {
+ OOTRACEERR3("Error: Invalid media control channel address "
+ "(%s, %s)\n", pCall->callType, pCall->callToken);
+ memFreePtr(pCall->pctxt, epCap);
+ epCap = NULL;
+ continue;
+ }
+ } else {
+ continue;
+ }
+ } else {
+ /* Don't check reverse channels */
+ continue;
+ }
+
+ if(dir & OORX) {
+ remoteMediaControlPort--;
+ if(gH323ep.h323Callbacks.onMediaChanged && pCall->callState<OO_CALL_CLEAR)
+ gH323ep.h323Callbacks.onMediaChanged(pCall, remoteMediaControlIP,
+ remoteMediaControlPort);
+ }
+
+
+ }
+
+ }
+ return ASN_OK;
+}
+
+
int ooSetFastStartResponse(OOH323CallData *pCall, Q931Message *pQ931msg,
ASN1UINT *fsCount, ASN1DynOctStr **fsElem)
Modified: team/may/ooh323_ipv6_direct_rtp/addons/ooh323c/src/ooq931.h
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6_direct_rtp/addons/ooh323c/src/ooq931.h?view=diff&rev=346345&r1=346344&r2=346345
==============================================================================
--- team/may/ooh323_ipv6_direct_rtp/addons/ooh323c/src/ooq931.h (original)
+++ team/may/ooh323_ipv6_direct_rtp/addons/ooh323c/src/ooq931.h Mon Nov 28 12:15:02 2011
@@ -773,6 +773,7 @@
EXTERN int ooSendTCSandMSD(struct OOH323CallData *call);
EXTERN int ooSendStartH245Facility(struct OOH323CallData *call);
EXTERN int ooSendFSUpdate(struct OOH323CallData *call);
+EXTERN int ooHandleFastStartChannels(struct OOH323CallData *pCall);
/**
* @}
More information about the asterisk-commits
mailing list