| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
function noojee_destinations() |
|---|
| 4 |
{ |
|---|
| 5 |
return array( |
|---|
| 6 |
array( |
|---|
| 7 |
'destination' => 'njr-operator,njr-inbound,1', |
|---|
| 8 |
'description' => 'Send call to Noojee Receptionist 4.x', |
|---|
| 9 |
), |
|---|
| 10 |
array( |
|---|
| 11 |
'destination' => 'reception,njr-inbound,1', |
|---|
| 12 |
'description' => 'Send call to Noojee Receptionist 3.x', |
|---|
| 13 |
), |
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
I've disabled this for now as its not ready for prime time. |
|---|
| 17 |
We need to configure t.38 and change the NJ Fax installer to work with this module. |
|---|
| 18 |
|
|---|
| 19 |
array( |
|---|
| 20 |
'destination' => 'Noojee-Fax-Receive,s,1', |
|---|
| 21 |
'description' => 'Send call to Noojee Fax', |
|---|
| 22 |
), |
|---|
| 23 |
*/ |
|---|
| 24 |
); |
|---|
| 25 |
} |
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 |
function noojee_get_config($engine) |
|---|
| 29 |
{ |
|---|
| 30 |
switch($engine) |
|---|
| 31 |
{ |
|---|
| 32 |
case 'asterisk': |
|---|
| 33 |
|
|---|
| 34 |
generate_receptionist_40_dialplan(); |
|---|
| 35 |
generate_receptionist_30_dialplan(); |
|---|
| 36 |
|
|---|
| 37 |
// generate_fax_40_dialplan(); |
|---|
| 38 |
break; |
|---|
| 39 |
} |
|---|
| 40 |
} |
|---|
| 41 |
|
|---|
| 42 |
function generate_receptionist_40_dialplan() |
|---|
| 43 |
{ |
|---|
| 44 |
global $ext; |
|---|
| 45 |
global $db; |
|---|
| 46 |
|
|---|
| 47 |
|
|---|
| 48 |
$id = 'njr-operator'; |
|---|
| 49 |
$ext->addInclude('from-internal-additional', $id); |
|---|
| 50 |
|
|---|
| 51 |
$ext->add($id, 'njr-inbound', '', new ext_answer('')); |
|---|
| 52 |
$ext->add($id, 'njr-inbound', '', new ext_ringing('')); |
|---|
| 53 |
$ext->add($id, 'njr-inbound', 'start', new ext_wait(3)); |
|---|
| 54 |
$ext->add($id, 'njr-inbound', '', new extension('Verbose("njr-running=${njr-running} channel=${CHANNEL} channel=${UNIQUEID}")')); |
|---|
| 55 |
$ext->add($id, 'njr-inbound', '', new ext_gotoIf('$["${njr-running}" = ""]', 'return')); |
|---|
| 56 |
$ext->add($id, 'njr-inbound', '', new ext_wait(5)); |
|---|
| 57 |
$ext->add($id, 'njr-inbound', '', new ext_goto('start')); |
|---|
| 58 |
$ext->add($id, 'njr-inbound', 'return' ,new ext_setvar('NJRSTATUS','FAILURE')); |
|---|
| 59 |
$ext->add($id, 'njr-inbound', '', new ext_return('')); |
|---|
| 60 |
|
|---|
| 61 |
$ext->add($id, 'njr-transfer', '', new ext_answer('')); |
|---|
| 62 |
$ext->add($id, 'njr-transfer', 'start', new ext_dial('${dest}' ,'60,r')); |
|---|
| 63 |
$ext->add($id, 'njr-transfer', '', new ext_wait(10)); |
|---|
| 64 |
$ext->add($id, 'njr-transfer', '', new ext_goto('start')); |
|---|
| 65 |
|
|---|
| 66 |
$ext->add($id, 'njr-music', '', new ext_answer('')); |
|---|
| 67 |
$ext->add($id, 'njr-music', 'start', new ext_musiconhold('')); |
|---|
| 68 |
$ext->add($id, 'njr-music', '', new ext_wait(30)); |
|---|
| 69 |
$ext->add($id, 'njr-music', '', new ext_goto('start')); |
|---|
| 70 |
|
|---|
| 71 |
$ext->add($id, 'njr-meetme', '', new ext_answer('')); |
|---|
| 72 |
$ext->add($id, 'njr-meetme', '', new ext_meetme('${room}','${options}')); |
|---|
| 73 |
$ext->add($id, 'njr-meetme', '', new ext_hangup('')); |
|---|
| 74 |
|
|---|
| 75 |
$ext->add($id, 'njr-hold', '', new ext_answer('')); |
|---|
| 76 |
$ext->add($id, 'njr-hold', 'start', new ext_ringing('')); |
|---|
| 77 |
$ext->add($id, 'njr-hold', '', new ext_wait(30)); |
|---|
| 78 |
$ext->add($id, 'njr-hold', '', new ext_goto('start')); |
|---|
| 79 |
|
|---|
| 80 |
$ext->add($id, 'njr-acknowledged', '', new ext_answer('')); |
|---|
| 81 |
$ext->add($id, 'njr-acknowledged', 'start', new ext_musiconhold('')); |
|---|
| 82 |
$ext->add($id, 'njr-acknowledged', '', new ext_wait(30)); |
|---|
| 83 |
$ext->add($id, 'njr-acknowledged', '', new ext_goto('start')); |
|---|
| 84 |
|
|---|
| 85 |
$ext->add($id, 'njr-voicemail', '', new ext_answer('')); |
|---|
| 86 |
$ext->add($id, 'njr-voicemail', '', new ext_vm('${mailbox}')); |
|---|
| 87 |
$ext->add($id, 'njr-voicemail', '', new ext_hangup('')); |
|---|
| 88 |
|
|---|
| 89 |
$ext->add($id, 'njr-park', '', new ext_answer('')); |
|---|
| 90 |
$ext->add($id, 'njr-park', '', new extension('ParkAndAnnounce(pbx-transfer:PARKED|60|Console/dsp|' |
|---|
| 91 |
. $id . ',njr-inbound,1')); |
|---|
| 92 |
$ext->add($id, 'njr-park', '', new ext_hangup('')); |
|---|
| 93 |
|
|---|
| 94 |
$ext->add($id, 'njr-connect', '', new ext_dial('${dest}','6,r')); |
|---|
| 95 |
$ext->add($id, 'njr-connect', '', new ext_userevent('NJR','action: connectFailed,channel: ${CHANNEL},uniqueid: ${UNIQUEID}')); |
|---|
| 96 |
$ext->add($id, 'njr-connect', '', new ext_wait(1)); |
|---|
| 97 |
$ext->add($id, 'njr-connect', '', new ext_goto(1, 'njr-connect')); |
|---|
| 98 |
|
|---|
| 99 |
|
|---|
| 100 |
$ext->add($id, 'njr-bridge', '', new ext_wait(3000)); |
|---|
| 101 |
$ext->add($id, 'njr-bridge', '', new ext_hangup('')); |
|---|
| 102 |
} |
|---|
| 103 |
|
|---|
| 104 |
function generate_receptionist_30_dialplan() |
|---|
| 105 |
{ |
|---|
| 106 |
global $ext; |
|---|
| 107 |
global $db; |
|---|
| 108 |
|
|---|
| 109 |
|
|---|
| 110 |
$id = 'reception'; |
|---|
| 111 |
$ext->addInclude('from-internal-additional', $id); |
|---|
| 112 |
|
|---|
| 113 |
$ext->add($id, 'njr-inbound', '', new ext_answer('')); |
|---|
| 114 |
$ext->add($id, 'njr-inbound', '', new ext_ringing('')); |
|---|
| 115 |
$ext->add($id, 'njr-inbound', 'start', new ext_wait(3)); |
|---|
| 116 |
$ext->add($id, 'njr-inbound', '', new extension('Verbose("njr-running=${njr-running} channel=${CHANNEL} channel=${UNIQUEID}")')); |
|---|
| 117 |
$ext->add($id, 'njr-inbound', '', new ext_gotoIf('$["${njr-running}" = ""]', 'return')); |
|---|
| 118 |
$ext->add($id, 'njr-inbound', '', new ext_wait(5)); |
|---|
| 119 |
$ext->add($id, 'njr-inbound', '', new ext_goto('start')); |
|---|
| 120 |
$ext->add($id, 'njr-inbound', 'return' ,new ext_setvar('NJRSTATUS','FAILURE')); |
|---|
| 121 |
$ext->add($id, 'njr-inbound', '', new ext_return('')); |
|---|
| 122 |
|
|---|
| 123 |
$ext->add($id, 'njr-transfer', '', new ext_answer('')); |
|---|
| 124 |
$ext->add($id, 'njr-transfer', 'start', new ext_dial('${dest}' ,'60,r')); |
|---|
| 125 |
$ext->add($id, 'njr-transfer', '', new ext_wait(10)); |
|---|
| 126 |
$ext->add($id, 'njr-transfer', '', new ext_goto('start')); |
|---|
| 127 |
|
|---|
| 128 |
$ext->add($id, 'njr-music', '', new ext_answer('')); |
|---|
| 129 |
$ext->add($id, 'njr-music', 'start', new ext_musiconhold('')); |
|---|
| 130 |
$ext->add($id, 'njr-music', '', new ext_wait(30)); |
|---|
| 131 |
$ext->add($id, 'njr-music', '', new ext_goto('start')); |
|---|
| 132 |
|
|---|
| 133 |
$ext->add($id, 'njr-meetme', '', new ext_answer('')); |
|---|
| 134 |
$ext->add($id, 'njr-meetme', '', new ext_meetme('${room}','${options}')); |
|---|
| 135 |
$ext->add($id, 'njr-meetme', '', new ext_hangup('')); |
|---|
| 136 |
|
|---|
| 137 |
$ext->add($id, 'njr-hold', '', new ext_answer('')); |
|---|
| 138 |
$ext->add($id, 'njr-hold', 'start', new ext_ringing('')); |
|---|
| 139 |
$ext->add($id, 'njr-hold', '', new ext_wait(30)); |
|---|
| 140 |
$ext->add($id, 'njr-hold', '', new ext_goto('start')); |
|---|
| 141 |
|
|---|
| 142 |
$ext->add($id, 'njr-voicemail', '', new ext_answer('')); |
|---|
| 143 |
$ext->add($id, 'njr-voicemail', '', new ext_vm('${mailbox}')); |
|---|
| 144 |
$ext->add($id, 'njr-voicemail', '', new ext_hangup('')); |
|---|
| 145 |
|
|---|
| 146 |
$ext->add($id, 'njr-park', '', new ext_answer('')); |
|---|
| 147 |
$ext->add($id, 'njr-park', '', new extension('ParkAndAnnounce(pbx-transfer:PARKED|60|Console/dsp|' |
|---|
| 148 |
. $id . ',njr-inbound,1')); |
|---|
| 149 |
$ext->add($id, 'njr-park', '', new ext_hangup('')); |
|---|
| 150 |
|
|---|
| 151 |
$ext->add($id, '1', '', new ext_read('dest')); |
|---|
| 152 |
$ext->add($id, '1', '', new ext_userevent('meetmetransfer','data: ${njr-managedChannel}&${dest}')); |
|---|
| 153 |
$ext->add($id, '1', '', new ext_wait(2)); |
|---|
| 154 |
$ext->add($id, '1', '', new ext_hangup('')); |
|---|
| 155 |
|
|---|
| 156 |
$ext->add($id, 't', '', new extension('Verbose("timeout on manual transfer")')); |
|---|
| 157 |
$ext->add($id, 't', '', new extension('Playback(beep)')); |
|---|
| 158 |
$ext->add($id, 't', '', new ext_goto(1,1)); |
|---|
| 159 |
} |
|---|
| 160 |
|
|---|
| 161 |
function generate_fax_40_dialplan() |
|---|
| 162 |
{ |
|---|
| 163 |
global $ext; |
|---|
| 164 |
global $db; |
|---|
| 165 |
|
|---|
| 166 |
|
|---|
| 167 |
* Now the Noojee Fax dialplan |
|---|
| 168 |
*/ |
|---|
| 169 |
$id = 'Noojee-Fax-Receive'; |
|---|
| 170 |
|
|---|
| 171 |
$ext->addInclude('from-internal-additional', $id); |
|---|
| 172 |
|
|---|
| 173 |
$sql = "select FaxReturnNumber, ReceiptSpool from tblNoojeeModule"; |
|---|
| 174 |
$res =& $db->query($sql); |
|---|
| 175 |
|
|---|
| 176 |
if (PEAR::isError($res)) |
|---|
| 177 |
freepbx_log("Noojee", "error", "Attempting to obtain data from SQL tblNoojeeModule" . $res); |
|---|
| 178 |
|
|---|
| 179 |
$res->fetchInto($row); |
|---|
| 180 |
|
|---|
| 181 |
$ext->add($id, 's', '', new ext_wait(1)); |
|---|
| 182 |
$ext->add($id, 's', '', new ext_answer('')); |
|---|
| 183 |
$ext->add($id, 's', '', new ext_wait(1)); |
|---|
| 184 |
$ext->add($id, 's', '' ,new ext_setvar('localstationid',$row['FaxReturnNumber'])); |
|---|
| 185 |
$ext->add($id, 's', '' ,new ext_setvar('FAXFILE',$row['ReceiptSpool'] . '/${UNIQUEID}.tif')); |
|---|
| 186 |
$ext->add($id, 's', '', new ext_wait(1)); |
|---|
| 187 |
$ext->add($id, 's', '' ,new ext_setvar('DID','${DID}${FROM_DID}')); |
|---|
| 188 |
$ext->add($id, 's', '', new extension('Verbose("DID=${DID}")')); |
|---|
| 189 |
$ext->add($id, 's', '', new ext_goto('${DID}',1)); |
|---|
| 190 |
$ext->add($id, 's', '', new extension('Verbose("Oops shouldn\'t get here")')); |
|---|
| 191 |
|
|---|
| 192 |
|
|---|
| 193 |
// being routed to use. The problem is that this context gets included in the |
|---|
| 194 |
// main from-internal (I think that the name) and since _X. matches any number |
|---|
| 195 |
// all inbound calls are routed to the fax. We need to find a way of avoiding this |
|---|
| 196 |
// before we redploy this module. |
|---|
| 197 |
$ext->add($id, '_X.', '', new extension('RxFax(${FAXFILE})')); |
|---|
| 198 |
$ext->add($id, '_X.', '', new extension('Verbose(REMOTESTATIONID ${remotestationid})')); |
|---|
| 199 |
$ext->add($id, '_X.', '', new extension('Verbose(FAXPAGES ${faxpages}')); |
|---|
| 200 |
$ext->add($id, '_X.', '', new extension('Verbose(FAXBITRATE ${faxbitrate}')); |
|---|
| 201 |
$ext->add($id, '_X.', '', new extension('Verbose(FAXRESOLUTION ${faxresolution}')); |
|---|
| 202 |
$ext->add($id, '_X.', '', new ext_hangup('')); |
|---|
| 203 |
|
|---|
| 204 |
$ext->add($id, 'h', '', new ext_gotoIf('$["${phasestatus}" = "SUCCESS"]', 'complete')); |
|---|
| 205 |
$ext->add($id, 'h', '', new ext_userevent('FaxPartial','exten: ${DID},callerId: \'${callerID(num)}\',remoteStationId: \'${remotestationid}\',localStationId: \'${localstationid}\',pagesTransferred: \'${faxpages}\',resolution: \'${faxresolution}\',transferRate: \'${faxrate}\',filename: ${FAXFILE}')); |
|---|
| 206 |
$ext->add($id, 'h', '', new ext_hangup('')); |
|---|
| 207 |
$ext->add($id, 'h', 'complete', new ext_userevent('FaxComplete','exten: ${DID},callerId: \'${callerID(num)}\',remoteStationId: \'${remotestationid}\',localStationId: \'${localstationid}\',pagesTransferred: \'${faxpages}\',resolution: \'${faxresolution}\',transferRate: \'${faxrate}\',filename: ${FAXFILE}')); |
|---|
| 208 |
$ext->add($id, 'h', '', new ext_hangup('')); |
|---|
| 209 |
} |
|---|
| 210 |
?> |
|---|