1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
$FreeBSD$
--- sip/b2b/AuthAgent.cxx 2003/01/19 16:15:54 1.1
+++ sip/b2b/AuthAgent.cxx 2003/01/19 18:03:43
@@ -367,6 +367,31 @@
AuthAgent::doCancel()
{
cpLog(LOG_DEBUG, "AuthAgent::doCancel()");
+ Sptr<MultiLegCallData> mData =
+ CallDB::instance().getMultiLegCallData(myInvokee->getCallLeg());
+ assert(mData != 0);
+
+ Sptr<AccountingData> accData = mData->getAccountingData();
+ time_t t;
+ t = time(&t);
+ accData->setEndTime(t);
+
+ if(B2bConfig::instance().getStr(B2bConfig::PP_OPTIONS)
+ != B2bConfig::PP_FREE)
+ {
+ ///Send Stop records to billing
+ int duration = t - accData->getStartTime();
+ Sptr<BillingData> bData;
+ bData.dynamicCast(myAAAData);
+ assert(bData != 0);
+ bData->setDuration(duration);
+
+ Sptr<AAAEvent> aEvent = new AAAEvent(this);
+ cpLog(LOG_DEBUG, "AuthAgent::Sending Acct Stop");
+ B2bUa::instance().getAAATransceiver()->sendAcctStop(aEvent);
+ }
+
+ ///Transit the controller state
myState->cancel(*this);
}
@@ -424,6 +449,31 @@
AuthAgent::callFailed()
{
cpLog(LOG_DEBUG, "AuthAgent::callFailed()");
+ Sptr<MultiLegCallData> mData =
+ CallDB::instance().getMultiLegCallData(myInvokee->getCallLeg());
+ assert(mData != 0);
+
+ Sptr<AccountingData> accData = mData->getAccountingData();
+ time_t t;
+ t = time(&t);
+ accData->setEndTime(t);
+
+ if(B2bConfig::instance().getStr(B2bConfig::PP_OPTIONS)
+ != B2bConfig::PP_FREE)
+ {
+ ///Send Stop records to billing
+ int duration = t - accData->getStartTime();
+ Sptr<BillingData> bData;
+ bData.dynamicCast(myAAAData);
+ assert(bData != 0);
+ bData->setDuration(duration);
+
+ Sptr<AAAEvent> aEvent = new AAAEvent(this);
+ cpLog(LOG_DEBUG, "AuthAgent::Sending Acct Stop");
+ B2bUa::instance().getAAATransceiver()->sendAcctStop(aEvent);
+ }
+
+ ///Transit the controller state
myState->fail(*this);
}
@@ -488,5 +538,37 @@
void
AuthAgent::receivedStatus(UaBase& agent, const Sptr<SipMsg>& msg)
{
+ Sptr<StatusMsg> statusMsg;
+ statusMsg.dynamicCast(msg);
+ assert(statusMsg != 0);
+ int statusCode = statusMsg->getStatusLine().getStatusCode();
+ if(statusCode > 200)
+ {
+ Sptr<MultiLegCallData> mData =
+ CallDB::instance().getMultiLegCallData(myInvokee->getCallLeg());
+ assert(mData != 0);
+
+ Sptr<AccountingData> accData = mData->getAccountingData();
+ time_t t;
+ t = time(&t);
+ accData->setEndTime(t);
+
+ if(B2bConfig::instance().getStr(B2bConfig::PP_OPTIONS)
+ != B2bConfig::PP_FREE)
+ {
+ ///Send Stop records to billing
+ int duration = t - accData->getStartTime();
+ Sptr<BillingData> bData;
+ bData.dynamicCast(myAAAData);
+ assert(bData != 0);
+ bData->setDuration(duration);
+ bData->setTermCause(BT_SERVICE_UNAVAIL);
+
+ Sptr<AAAEvent> aEvent = new AAAEvent(this);
+ cpLog(LOG_DEBUG, "AuthAgent::Sending Acct Stop");
+ B2bUa::instance().getAAATransceiver()->sendAcctStop(aEvent);
+ }
+ }
+
MultiLegCallControl::instance().receivedStatus(agent,msg);
}
|