126
126
<variable name="ACTS_RESULT">
127
127
<para>This is the result of the call.</para>
128
128
<value name="CALLER_HANGUP">
129
- Caller hung up
129
+ Call was answered and caller hung up
130
+ </value>
131
+ <value name="CALLER_ABORT">
132
+ Caller hung up before call was answered
130
133
</value>
131
134
<value name="CALLEE_HANGUP">
132
- Callee hung up
135
+ Call was answered and callee hung up
133
136
</value>
134
137
<value name="NOANSWER">
135
138
Callee hung up without far end supervision
156
159
Invalid arguments.
157
160
</value>
158
161
</variable>
162
+ <variable name="ACTS_FINAL_DISPOSITION">
163
+ <para>This indicates whether any coins in the hopper at call completition should be collected or returned.</para>
164
+ <para>This is intended as a convenience variable - <literal>ACTS_RESULT</literal> provides more granularity.</para>
165
+ <value name="COLLECT">
166
+ Any coins in the hopper should be collected
167
+ </value>
168
+ <value name="RETURN">
169
+ Any coins in the hopper should be returned
170
+ </value>
171
+ </variable>
159
172
<variable name="ACTS_COLLECTED">
160
173
<para>The total amount of money, in cents, collected into the coin vault for this call.</para>
161
174
<para>This variable is only set if <literal>ACTS_RESULT</literal> is not <literal>INVALID</literal>.</para>
180
193
</variablelist>
181
194
</description>
182
195
<see-also>
196
+ <ref type="application">CoinCall</ref>
197
+ <ref type="application">LocalCoinDisposition</ref>
183
198
<ref type="application">CoinDisposition</ref>
184
199
<ref type="application">WaitForDeposit</ref>
185
200
<ref type="function">COIN_DETECT</ref>
@@ -230,6 +245,7 @@ struct acts_call {
230
245
unsigned int postpaid :1 ; /* Collect overtime deposits after call */
231
246
unsigned int postpaidended :1 ; /* Postpaid session ended */
232
247
const char * result ;
248
+ const char * finaldisp ;
233
249
pthread_t opthread ;
234
250
ast_mutex_t lock ;
235
251
AST_RWLIST_ENTRY (acts_call ) entry ;
@@ -751,6 +767,7 @@ static int initial_deposit_helper(struct acts_call *acts, int required, int over
751
767
ast_verb (4 , "Insufficient deposit, disconnecting...\n" );
752
768
res = 1 ;
753
769
acts -> result = "INSUFFICIENT_INITIAL" ;
770
+ acts -> finaldisp = "RETURN" ;
754
771
}
755
772
}
756
773
@@ -888,7 +905,6 @@ static void *async_signal_announcements(void *varg)
888
905
889
906
static int set_gains (struct acts_call * acts , int lopsided )
890
907
{
891
- /* XXX Should probably get/ref the channel rather than using directly */
892
908
ast_channel_lock (acts -> ochan );
893
909
ast_func_write (acts -> ochan , "VOLUME(RX)" , lopsided ? "-3" : "0" );
894
910
ast_channel_unlock (acts -> ochan );
@@ -1079,6 +1095,7 @@ static int wait_for_answer(struct acts_call *acts)
1079
1095
DISCONNECT_FAR_END ();
1080
1096
ast_verb (4 , "Outgoing channel disconnected before answer\n" );
1081
1097
acts -> result = "NOANSWER" ;
1098
+ acts -> finaldisp = "RETURN" ;
1082
1099
return 1 ;
1083
1100
}
1084
1101
switch (f -> frametype ) {
@@ -1095,12 +1112,14 @@ static int wait_for_answer(struct acts_call *acts)
1095
1112
DISCONNECT_FAR_END ();
1096
1113
res = 1 ;
1097
1114
acts -> result = "BUSY" ;
1115
+ acts -> finaldisp = "RETURN" ;
1098
1116
break ;
1099
1117
case AST_CONTROL_CONGESTION :
1100
1118
ast_verb (3 , "%s is circuit-busy\n" , ast_channel_name (acts -> ochan ));
1101
1119
DISCONNECT_FAR_END ();
1102
1120
res = 1 ;
1103
1121
acts -> result = "CONGESTION" ;
1122
+ acts -> finaldisp = "RETURN" ;
1104
1123
break ;
1105
1124
case AST_CONTROL_PROGRESS :
1106
1125
case AST_CONTROL_PROCEEDING :
@@ -1158,8 +1177,9 @@ static int wait_for_answer(struct acts_call *acts)
1158
1177
struct ast_frame * f = ast_read (acts -> chan );
1159
1178
if (!f || (f -> frametype == AST_FRAME_CONTROL && f -> subclass .integer == AST_CONTROL_HANGUP )) {
1160
1179
/* Caller cancelled call */
1161
- ast_verb (4 , "Caller %s hung up\n" , ast_channel_name (acts -> chan ));
1162
- acts -> result = "CALLER_HANGUP" ;
1180
+ ast_verb (4 , "Caller %s hung up prior to answer\n" , ast_channel_name (acts -> chan ));
1181
+ acts -> result = "CALLER_ABORT" ;
1182
+ acts -> finaldisp = "RETURN" ;
1163
1183
if (f ) {
1164
1184
ast_frfree (f );
1165
1185
}
@@ -1803,6 +1823,7 @@ static int acts_run(struct acts_call *acts)
1803
1823
acts -> callerdisconnected = 1 ;
1804
1824
ast_mutex_unlock (& acts -> lock );
1805
1825
acts -> result = "OVERTIME_EXPIRED" ;
1826
+ acts -> result = "RETURN" ; /* Return deposit call is being cut off */
1806
1827
1807
1828
if (acts -> hopper ) {
1808
1829
res = coin_disposition (acts , COIN_RETURN );
@@ -1847,6 +1868,17 @@ static int acts_run(struct acts_call *acts)
1847
1868
}
1848
1869
1849
1870
cleanup :
1871
+ if (!acts -> finaldisp ) {
1872
+ /* Defaults, if not overridden.
1873
+ * If time is up, then we already collected what we're owed,
1874
+ * and more time hasn't been granted yet, so return any partial deposit.
1875
+ * Otherwise, collect, before we release (or instruct the Class 5 office to). */
1876
+ if (time (NULL ) >= acts -> expiretime ) {
1877
+ acts -> finaldisp = "RETURN" ;
1878
+ } else {
1879
+ acts -> finaldisp = "COLLECT" ;
1880
+ }
1881
+ }
1850
1882
ast_mutex_lock (& acts -> lock );
1851
1883
if (framehook_id >= 0 && ast_framehook_detach (acts -> chan , framehook_id )) {
1852
1884
ast_log (LOG_WARNING , "Failed to remove framehook from channel %s\n" , ast_channel_name (acts -> chan ));
@@ -1906,6 +1938,7 @@ static int acts_run(struct acts_call *acts)
1906
1938
snprintf (buf , sizeof (buf ), "%d" , - acts -> credit );
1907
1939
pbx_builtin_setvar_helper (acts -> chan , "ACTS_OVERTIME_SHORTAGE_AMOUNT" , buf );
1908
1940
acts -> result = "OVERTIME_SHORTAGE" ;
1941
+ acts -> finaldisp = "COLLECT" ;
1909
1942
ast_verb (3 , "Caller hung up without paying overtime shortage and will need to be rung back...\n" );
1910
1943
}
1911
1944
}
@@ -2024,9 +2057,11 @@ static int acts_exec(struct ast_channel *chan, const char *data)
2024
2057
2025
2058
if (acts .result ) {
2026
2059
pbx_builtin_setvar_helper (chan , "ACTS_RESULT" , acts .result );
2060
+ pbx_builtin_setvar_helper (chan , "ACTS_FINAL_DISPOSITION" , acts .finaldisp );
2027
2061
} else {
2028
2062
ast_log (LOG_WARNING , "Missing internal result disposition... assuming failure\n" );
2029
2063
pbx_builtin_setvar_helper (chan , "ACTS_RESULT" , "FAILURE" );
2064
+ pbx_builtin_setvar_helper (chan , "ACTS_FINAL_DISPOSITION" , "RETURN" ); /* Fail safe to return, but this shouldn't happen */
2030
2065
}
2031
2066
2032
2067
if (res > 0 ) {
0 commit comments