* Build OSP usage from destination * param transaction OSP transaction handle * param inbound Inbound info * param dest Destination * param lastcode Destination status * return 0 success, others failure */
| 581 | * return 0 success, others failure |
| 582 | */ |
| 583 | static int ospBuildUsageFromDestination( |
| 584 | OSPTTRANHANDLE transaction, |
| 585 | osp_inbound* inbound, |
| 586 | osp_dest* dest, |
| 587 | int lastcode) |
| 588 | { |
| 589 | int errorcode; |
| 590 | char srcdev[OSP_STRBUF_SIZE]; |
| 591 | char source[OSP_STRBUF_SIZE]; |
| 592 | char host[OSP_STRBUF_SIZE]; |
| 593 | char destdev[OSP_STRBUF_SIZE]; |
| 594 | |
| 595 | ospConvertToOutAddress(inbound->srcdev, srcdev, sizeof(srcdev)); |
| 596 | ospConvertToOutAddress(inbound->source, source, sizeof(source)); |
| 597 | ospConvertToOutAddress(dest->host, host, sizeof(host)); |
| 598 | ospConvertToOutAddress(dest->destdev, destdev, sizeof(destdev)); |
| 599 | |
| 600 | /* Must be called before BuildUsageFromScratch */ |
| 601 | OSPPTransactionSetSrcSwitchId(transaction, inbound->swid); |
| 602 | |
| 603 | errorcode = OSPPTransactionBuildUsageFromScratch( |
| 604 | transaction, |
| 605 | dest->transid, |
| 606 | dest->type, |
| 607 | source, |
| 608 | host, |
| 609 | srcdev, |
| 610 | destdev, |
| 611 | dest->calling, |
| 612 | OSPC_NFORMAT_E164, |
| 613 | inbound->called, /* Report original called number */ |
| 614 | OSPC_NFORMAT_E164, |
| 615 | dest->callidsize, |
| 616 | dest->callid, |
| 617 | lastcode, |
| 618 | NULL, |
| 619 | NULL); |
| 620 | |
| 621 | OSPPTransactionSetSrcNetworkId(transaction, inbound->snid); |
| 622 | OSPPTransactionSetDestNetworkId(transaction, dest->dnid); |
| 623 | |
| 624 | OSPPTransactionSetDestSwitchId(transaction, dest->swid); |
| 625 | |
| 626 | OSPPTransactionSetDestAudioAddr(transaction, dest->destmedia); |
| 627 | |
| 628 | OSPPTransactionSetProxyEgressAddr(transaction, dest->egress); |
| 629 | |
| 630 | if (dest->starttime && dest->endtime && (dest->starttime <= dest->endtime)) { |
| 631 | OSPPTransactionSetProviderPDD(transaction, (dest->endtime - dest->starttime) * 1000); |
| 632 | } |
| 633 | |
| 634 | return errorcode; |
| 635 | } |
| 636 | |
| 637 | /* |
| 638 | * Report OSP usage from destination |
no test coverage detected