int ooEndCall(OOH323CallData *call) { OOTRACEDBGA4("In ooEndCall call state is - %s (%s, %s)\n", ooGetCallStateText(call->callState), call->callType, call->callToken); if(call->callState == OO_CALL_REMOVED) { OOTRACEINFO2("Call already removed %s\n", call->callToken); return OO_OK; } if (call->callIdentifier.guid.numocts == 0) call->callState = OO_CALL_CLEARED; if(!call->pH225Channel || call->pH225Channel->sock ==0) { call->callState = OO_CALL_CLEARED; } if(call->callState == OO_CALL_CLEARED || call->callState == OO_CALL_CLEAR_RELEASESENT) { ooCleanCall(call); call->callState = OO_CALL_REMOVED; return OO_OK; } if(call->logicalChans) { OOTRACEINFO3("Clearing all logical channels. (%s, %s)\n", call->callType, call->callToken); ooClearAllLogicalChannels(call); } if(!OO_TESTFLAG(call->flags, OO_M_ENDSESSION_BUILT)) { if(call->h245SessionState == OO_H245SESSION_ACTIVE || call->h245SessionState == OO_H245SESSION_ENDRECVD) { ooSendEndSessionCommand(call); OO_SETFLAG(call->flags, OO_M_ENDSESSION_BUILT); } } if(!OO_TESTFLAG(call->flags, OO_M_RELEASE_BUILT)) { if(call->callState == OO_CALL_CLEAR || call->callState == OO_CALL_CLEAR_RELEASERECVD) { ooSendReleaseComplete(call); OO_SETFLAG(call->flags, OO_M_RELEASE_BUILT); } } return OO_OK; }
static struct session *h225_cs_callback(struct session *cs, u_char *data, uint32_t len) { char callToken[20]; OOH323CallData *call; Q931Message q931; DListNode *node; H245OpenLogicalChannel *olc; H245H2250LogicalChannelParameters *lcp; struct tuple4 addr; ooGenerateCallToken(callToken, 20); call = ooCreateCall("incoming", callToken); call->pH225Channel = (OOH323Channel*) memAllocZ (call->pctxt, sizeof (OOH323Channel)); if (OO_OK == ooQ931Decode(call, &q931, ntohs(*((u_short *)(data + 2))) - 4, data + 4)) { if (OO_OK == ooHandleH2250Message(call, &q931)) { if (!bonus_time && (q931.messageType == Q931CallProceedingMsg)) { for (node = call->remoteFastStartOLCs.head; NULL != node; node = node->next) { olc = node->data; if (4 == olc->forwardLogicalChannelParameters.multiplexParameters.t) { lcp = olc->forwardLogicalChannelParameters.multiplexParameters.u.h2250LogicalChannelParameters; if (lcp->m.mediaChannelPresent && (1 == lcp->mediaChannel.t) && (1 == lcp->mediaChannel.u.unicastAddress->t)) { addr.source = 0; addr.saddr = 0; addr.dest = lcp->mediaChannel.u.unicastAddress->u.iPAddress->tsapIdentifier; addr.daddr = *((u_int *)lcp->mediaChannel.u.unicastAddress->u.iPAddress->network.data); sessions_add(TYPE_UDP | TYPE_RTP, &addr, cs); if (lcp->m.mediaControlChannelPresent && (2 == lcp->mediaControlChannel.t) && (1 == lcp->mediaControlChannel.u.multicastAddress->t)) { addr.source = 0; addr.saddr = 0; addr.dest = lcp->mediaControlChannel.u.unicastAddress->u.iPAddress->tsapIdentifier; addr.daddr = *((u_int *)lcp->mediaControlChannel.u.unicastAddress->u.iPAddress->network.data); sessions_add(TYPE_UDP | TYPE_RTCP, &addr, cs); } /* break; */ } } } } } } ooCleanCall(call); return cs; }
int ooH323EpDestroy(void) { /* free any internal memory allocated close trace file free context structure */ OOH323CallData * cur, *temp; if(OO_TESTFLAG(gH323ep.flags, OO_M_ENDPOINTCREATED)) { OOTRACEINFO1("Destroying H323 Endpoint\n"); if(gH323ep.callList) { cur = gH323ep.callList; while(cur) { temp = cur; cur = cur->next; temp->callEndReason = OO_REASON_LOCAL_CLEARED; ooCleanCall(temp); } gH323ep.callList = NULL; } if(gH323ep.listener) { ooSocketClose(*(gH323ep.listener)); gH323ep.listener = NULL; } ooGkClientDestroy(); if(gH323ep.fptraceFile) { fclose(gH323ep.fptraceFile); gH323ep.fptraceFile = NULL; } freeContext(&(gH323ep.ctxt)); freeContext(&(gH323ep.msgctxt)); OO_CLRFLAG(gH323ep.flags, OO_M_ENDPOINTCREATED); } return OO_OK; }