Changeset 6038 for modules

Show
Ignore:
Timestamp:
07/17/08 00:10:51 (5 years ago)
Author:
p_lindheimer
Message:

#2671 move macro-confirm to auto-generate, change to use background to handle compound recordings

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/branches/2.5/core/etc/extensions.conf

    r5917 r6038  
    10391039 
    10401040;------------------------------------------------------------------------ 
    1041 ; [macro-confirm] 
    1042 ;------------------------------------------------------------------------ 
    1043 ; CONTEXT:      macro-confirm                                                                                                               
    1044 ; PURPOSE:      added default message if none supplied 
    1045 ; 
    1046 ; Follom-Me and Ringgroups provide an option to supply a message to be 
    1047 ; played as part of the confirmation. These changes have added a default 
    1048 ; message if none is supplied. 
    1049 ; 
    1050 ;------------------------------------------------------------------------ 
    1051 [macro-confirm] 
    1052 exten => s,1,Set(LOOPCOUNT=0) 
    1053 exten => s,n,Noop(CALLCONFIRMCID: ${CALLCONFIRMCID}) 
    1054  
    1055 ; We set ABORT rather than CONTINUE, as we want the server to forget about this channel  
    1056 ; if it's declined, hung up, or timed out. We don't want it to continue on to the next 
    1057 ; step in the dialplan, which could be anything! 
    1058 exten => s,n,Set(__MACRO_RESULT=ABORT) 
    1059  
    1060 ; ARG1 is the announcement to play to tell the user that they've got a call they need 
    1061 ; to confirm. Something along the lines of 'You have an incoming call. Press 1 to accept, 9 to reject' 
    1062 exten => s,n,Set(MSG1=${IF($["foo${ARG1}" != "foo"]?${ARG1}:"incoming-call-1-accept-2-decline")}) 
    1063 exten => s,n(start),Read(INPUT,${MSG1},1,,1,5) 
    1064  
    1065 ; So. We've now read something, or nothing. We should check to make sure that the call hasn't 
    1066 ; already been answered by someone else. If it has, send this call to toolate 
    1067 exten => s,n,GotoIf(${DB_EXISTS(RG/${ARG3}/${UNIQCHAN})}?check:toolate) 
    1068  
    1069 ; We passed that test, so it means the call hasn't been answered. Has this user pushed 1? If so, 
    1070 ; then go to OK. 
    1071 exten => s,n(check),GotoIf($["${INPUT}"="1"]?ok) 
    1072  
    1073 ; If they've pushed 9, then they definately don't want the call. Just pretend there was no response 
    1074 ; and go to noanswer (or 2 since that will be default for asterisk) 
    1075 exten => s,n,GotoIf($["${INPUT}"="9"]?noanswer) 
    1076 exten => s,n,GotoIf($["${INPUT}"="2"]?noanswer) 
    1077 exten => s,n,GotoIf($["${INPUT}"="3"]?playcid) 
    1078  
    1079 ; Increment LOOPCOUNT, and check to make sure we haven't played it 5 times by now. We assume that 
    1080 ; the person is able to push '1' in a reasonably short time. 
    1081 exten => s,n,Set(LOOPCOUNT=$[ ${LOOPCOUNT} + 1 ]) 
    1082 exten => s,n,GotoIf($[ ${LOOPCOUNT} < 5 ]?start) 
    1083  
    1084 ; If we're here, that means we've played it MORE than 5 times. Set __MACRO_RESULT=ABORT, well, just  
    1085 ; coz, and goto fin, which is the last line, meaning it returns to the previous Dial, and pretends as 
    1086 ; if nothing has happened. 
    1087 exten => s,n(noanswer),Set(__MACRO_RESULT=ABORT) 
    1088 exten => s,n,Goto(fin) 
    1089  
    1090 ; Test play callerid 
    1091 ; 
    1092 exten => s,n(playcid),Noop(Playing CID: ${CALLCONFIRMCID}) 
    1093 exten => s,n,SayDigits(${CALLCONFIRMCID}) 
    1094 exten => s,n,Goto(start) 
    1095  
    1096 ; If we're here, it's because the call was already accepted by someone else. 
    1097 exten => s,n(toolate),Set(MSG2=${IF($["foo${ARG2}" != "foo"]?${ARG2}:"incoming-call-no-longer-avail")}) 
    1098 exten => s,n,Playback(${MSG2}) 
    1099 exten => s,n,Goto(noanswer) 
    1100  
    1101 ; If we made it here, it's because the call _WAS_ accepted, AND it's still ringing. We delete the 
    1102 ; database entry (so that the DB_EXISTS line above will trigger a 'toolate' jump), and set the  
    1103 ; MACRO_RESULT variable to NOTHING. This is the magic string that joins both legs of the call together 
    1104 exten => s,n(ok),DBDel(RG/${ARG3}/${UNIQCHAN}) 
    1105 exten => s,n,DBDel(${BLKVM_OVERRIDE}) 
    1106 exten => s,n,Set(__MACRO_RESULT=) 
    1107  
    1108 ; The end. 
    1109 exten => s,n(fin),NoOp(Finished) 
    1110 exten => h,1,Noop(Hangup Extension in macro-confirm) 
    1111 exten => h,n,Macro(hangupcall) 
    1112  
    1113 ;------------------------------------------------------------------------ 
    1114  
    1115 ;------------------------------------------------------------------------ 
    11161041; [findmefollow-ringallv2] 
    11171042;------------------------------------------------------------------------ 
  • modules/branches/2.5/core/functions.inc.php

    r6028 r6038  
    12001200      } 
    12011201 
     1202      /* 
     1203      ;------------------------------------------------------------------------ 
     1204      ; [macro-confirm] 
     1205      ;------------------------------------------------------------------------ 
     1206      ; CONTEXT:      macro-confirm                                                                                                               
     1207      ; PURPOSE:      added default message if none supplied 
     1208      ; 
     1209      ; Follom-Me and Ringgroups provide an option to supply a message to be 
     1210      ; played as part of the confirmation. These changes have added a default 
     1211      ; message if none is supplied. 
     1212      ; 
     1213      ;------------------------------------------------------------------------ 
     1214      */ 
     1215      $context = 'macro-confirm'; 
     1216      $exten = 's'; 
     1217 
     1218      $ext->add($context, $exten, '', new ext_setvar('LOOPCOUNT','0')); 
     1219      $ext->add($context, $exten, '', new ext_setvar('__MACRO_RESULT','ABORT')); 
     1220      $ext->add($context, $exten, '', new ext_setvar('MSG1','${IF($["foo${ARG1}" != "foo"]?${ARG1}:"incoming-call-1-accept-2-decline")}')); 
     1221      if (version_compare($version, "1.4", "ge")) {  
     1222        $ext->add($context, $exten, 'start', new ext_background('${MSG1},m,${CHANNEL(language)},macro-confirm')); 
     1223      } else { 
     1224        $ext->add($context, $exten, 'start', new ext_background('${MSG1},m,${LANGUAGE},macro-confirm')); 
     1225      } 
     1226      $ext->add($context, $exten, '', new ext_read('INPUT', '', 1, '', '', 4)); 
     1227      $ext->add($context, $exten, '', new ext_gotoif('$[${LEN(${INPUT})} > 0]', '${INPUT},1', 't,1')); 
     1228 
     1229      $exten = '1'; 
     1230      $ext->add($context, $exten, '', new ext_gotoif('$["${DB_EXISTS(RG/${ARG3}/${UNIQCHAN})}" = "0"]', 'toolate,1')); 
     1231      $ext->add($context, $exten, '', new ext_dbdel('RG/${ARG3}/${UNIQCHAN}')); 
     1232      $ext->add($context, $exten, '', new ext_dbdel('${BLKVM_OVERRIDE}')); 
     1233      $ext->add($context, $exten, '', new ext_setvar('__MACRO_RESULT','')); 
     1234      $ext->add($context, $exten, '', new ext_macroexit()); 
     1235 
     1236      $exten = '2'; 
     1237      $ext->add($context, $exten, '', new ext_goto(1, 'noanswer')); 
     1238 
     1239      $exten = '3'; 
     1240      $ext->add($context, $exten, '', new ext_saydigits('${CALLCONFIRMCID}')); 
     1241      $ext->add($context, $exten, '', new ext_gotoif('$["${DB_EXISTS(RG/${ARG3}/${UNIQCHAN})}" = "0"]', 'toolate,1','s,start')); 
     1242 
     1243      $exten = 't'; 
     1244      $ext->add($context, $exten, '', new ext_gotoif('$["${DB_EXISTS(RG/${ARG3}/${UNIQCHAN})}" = "0"]', 'toolate,1')); 
     1245      $ext->add($context, $exten, '', new ext_setvar('LOOPCOUNT','$[ ${LOOPCOUNT} + 1 ]')); 
     1246      $ext->add($context, $exten, '', new ext_gotoif('$[ ${LOOPCOUNT} < 5 ]', 's,start','noanswer,1')); 
     1247 
     1248      $exten = '_X'; 
     1249      if (version_compare($version, "1.4", "ge")) {  
     1250        $ext->add($context, $exten, '', new ext_background('invalid,m,${CHANNEL(language)},macro-confirm')); 
     1251      } else { 
     1252        $ext->add($context, $exten, '', new ext_background('invalid,m,${LANGUAGE},macro-confirm')); 
     1253      } 
     1254      $ext->add($context, $exten, '', new ext_gotoif('$["${DB_EXISTS(RG/${ARG3}/${UNIQCHAN})}" = "0"]', 'toolate,1')); 
     1255      $ext->add($context, $exten, '', new ext_setvar('LOOPCOUNT','$[ ${LOOPCOUNT} + 1 ]')); 
     1256      $ext->add($context, $exten, '', new ext_gotoif('$[ ${LOOPCOUNT} < 5 ]', 's,start','noanswer,1')); 
     1257 
     1258      $exten = 'noanswer'; 
     1259      $ext->add($context, $exten, '', new ext_setvar('__MACRO_RESULT','ABORT')); 
     1260      $ext->add($context, $exten, '', new ext_macroexit()); 
     1261 
     1262      $exten = 'toolate'; 
     1263      $ext->add($context, $exten, '', new ext_setvar('MSG2','${IF($["foo${ARG2}" != "foo"]?${ARG2}:"incoming-call-no-longer-avail")}')); 
     1264      $ext->add($context, $exten, '', new ext_playback('${MSG2}')); 
     1265      $ext->add($context, $exten, '', new ext_setvar('__MACRO_RESULT','ABORT')); 
     1266      $ext->add($context, $exten, '', new ext_macroexit()); 
     1267 
     1268      $exten = 'h'; 
     1269      $ext->add($context, $exten, '', new ext_macro('hangupcall')); 
     1270 
     1271 
     1272 
    12021273      $context = 'macro-dialout-trunk'; 
    12031274      $exten = 's'; 
     
    15521623       
    15531624      $ext->add($context, $exten, '', new ext_playback('beep')); 
    1554       $ext->add($context, $exten, 'dc_start', new ext_background('${RECFILE},m,${CHANNEL(language)},macro-systemrecording')); 
     1625      if (version_compare($version, "1.4", "ge")) {  
     1626        $ext->add($context, $exten, 'dc_start', new ext_background('${RECFILE},m,${CHANNEL(language)},macro-systemrecording')); 
     1627      } else { 
     1628        $ext->add($context, $exten, 'dc_start', new ext_background('${RECFILE},m,${LANGUAGE},macro-systemrecording')); 
     1629      } 
    15551630      $ext->add($context, $exten, '', new ext_wait(1)); 
    15561631      $ext->add($context, $exten, '', new ext_goto(1, 'confmenu'));