MCPcopy Create free account
hub / github.com/RangeNetworks/openbts / handleInvite

Method handleInvite

SIP/SIP2Interface.cpp:465–616  ·  view source on GitHub ↗

Return true if the message was handled here.

Source from the content-addressed store, hash-verified

463
464// Return true if the message was handled here.
465void SipInterface::handleInvite(SipMessage *msg, bool isINVITE)
466{
467 // Get request username (IMSI) from invite request-uri, which is in the first line.
468 string toIMSIDigits = msg->smGetInviteImsi(); // This is just the numbers.
469 if (toIMSIDigits.length() == 0) {
470 // FIXME -- Send appropriate error (404) on SIP interface.
471 LOG(WARNING) << "Incoming INVITE/MESSAGE with no IMSI:"<<msg;
472 newSendEarlyError(msg,404,"Not Found");
473 return; // Message has been handled as much as it ever will be.
474 }
475
476 // pat TODO: Convert all this stuff to methods of SipMessage
477 // Get the SIP call ID.
478 string outboundCallIdNum = msg->smGetCallId();
479 if (outboundCallIdNum.empty()) {
480 // FIXME -- Send appropriate error on SIP interface.
481 LOG(WARNING) << "Incoming INVITE/MESSAGE with no call ID";
482 newSendEarlyError(msg,400,"Bad Request");
483 return; // Message has been handled as much as it ever will be.
484 }
485
486 SipPreposition from = msg->msmFrom; // from(msg->msmFromValue);
487
488 // Get the caller ID if it's available.
489 string callerId = from.uriUsername(), callerHost = from.uriHostAndPort();
490 LOG(DEBUG) << "callerId " << callerId << "@" << callerHost;
491
492
493 // Check SIP map. Repeated entry? Page again.
494 //string inboundCallIdNum = outboundCallIdNum;
495 // (pat) TODO: This must be locked so we can delete dialogs sometime.
496 SipDialog *existing = findDialogByMsg(msg);
497#if PAT_TEST_SIP_DIRECT
498 // This is no longer needed...
499 //const char *callIdHost = osip_call_id_get_host(msg->omsg()->call_id);
500 //if (isINVITE && sipGetDirectMode() && existing) {
501 // // TODO: Check the invite to see if it comes directly from another Range BTS.
502 // // If it does, the MOC and MTC may be on the same BTS, in which case we need to create
503 // // an extra fifo for the MTC. The INVITE and the ACK will use this separate fifo.
504 // // TODO: Temporarily assume same BTS:
505 // const char *callerIMSI = extractIMSI(callerId.c_str());
506 // if (callerIMSI && *callerIMSI) {
507 // LOG(DEBUG) << "Calling L3MobileIdentity " << callerIMSI;
508 // L3MobileIdentity callerMobileID(callerIMSI);
509 // LOG(DEBUG) << "after";
510 // //if (TranEntry* transactionOC = gNewTransactionTable.ttFindBySIPCallId(callerMobileID,outboundCallIdNum))
511 // if (TranEntry* transactionOC = existing->findTranEntry()) {
512 // inboundCallIdNum = outboundCallIdNum + string("_TC");
513 // LOG(DEBUG) << "Changing"<<LOGVAR(inboundCallIdNum);
514 // //if (asprintf(&newCallIdNum,"%s_TC",callIDNum)) {} // The useless 'if' shuts up gcc.
515 // // Set outbound SIP header of OC transaction to the TC SIPEngine.
516 // transactionOC->getDialog()->setOutboundCallid(callIdHost,inboundCallIdNum.c_str());
517 // }
518 // }
519 //}
520#endif
521
522 // (pat) Looks for a pending invite still in the queue. I didnt write this.

Callers

nothing calls this directly

Calls 15

smGetInviteImsiMethod · 0.80
smGetCallIdMethod · 0.80
sameInviteOrMessageMethod · 0.80
MTWriteHighSideMethod · 0.80
findTranEntryMethod · 0.80
mmMTRepageMethod · 0.80
smGetPrecisMethod · 0.80
mmIsBusyMethod · 0.80
dialogCancelMethod · 0.80
createMTTransactionMethod · 0.80
smGetMessageBodyMethod · 0.80

Tested by

no test coverage detected