MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / ospReportTermSetupUsage

Function ospReportTermSetupUsage

modules/osp/usage.c:768–808  ·  view source on GitHub ↗

* Report terminate call setup usage */

Source from the content-addressed store, hash-verified

766 * Report terminate call setup usage
767 */
768void ospReportTermSetupUsage(void)
769{
770 osp_inbound* inbound = ospGetInboundInfo();
771 osp_dest* dest = ospGetTermDestination();
772 OSPTTRANHANDLE trans = -1;
773 OSPE_ROLE_STATE rstate;
774 int errorcode;
775
776 if (inbound != NULL) {
777 if (dest != NULL) {
778 if (dest->reported == 0) {
779 dest->reported = 1;
780 LM_INFO("report term setup for call_id '%.*s' transaction_id '%llu'\n",
781 dest->callidsize,
782 dest->callid,
783 dest->transid);
784 errorcode = OSPPTransactionNew(_osp_provider, &trans);
785 if (errorcode == OSPC_ERR_NO_ERROR) {
786 if (dest->lastcode == 200) {
787 rstate = OSPC_RSTATE_START;
788 } else if (dest->lastcode == 300) {
789 rstate = OSPC_RSTATE_REDIRECT;
790 } else {
791 rstate = OSPC_RSTATE_STOP;
792 }
793 /* RoleInfo must be set before BuildUsageFromScratch */
794 OSPPTransactionSetRoleInfo(trans, rstate, OSPC_RFORMAT_OSP, OSPC_RVENDOR_OPENSIPS);
795 ospBuildUsageFromDestination(trans, inbound, dest, 0);
796 OSPPTransactionSetProtocol(trans, OSPC_PROTTYPE_DESTINATION, OSPC_PROTNAME_SIP);
797 ospReportUsageFromDestination(trans, inbound, dest);
798 }
799 } else {
800 LM_DBG("term setup already reported\n");
801 }
802 } else {
803 LM_ERR("without term setup to report\n");
804 }
805 } else {
806 LM_ERR("internal error\n");
807 }
808}

Callers 1

ospRecordEventFunction · 0.85

Calls 4

ospGetInboundInfoFunction · 0.85
ospGetTermDestinationFunction · 0.85

Tested by

no test coverage detected