Esempio n. 1
8
 public static function dialplan($number)
 {
     $xml = Telephony::getDriver()->xml;
     $destination = $number['Destination'];
     if ($id = arr::get($destination, 'queue_id')) {
         $xml->update('/action[@application="callcenter"]{@data="queue_' . $id . '"}');
     }
 }
Esempio n. 2
0
 public static function dialplan($number)
 {
     $xml = Telephony::getDriver()->xml;
     $faxProfile = $number['Destination'];
     $faxpackage = Doctrine::getTable('package')->findOneBy('name', 'fax');
     $dpentry = DOCROOT . $faxpackage->basedir . '/libraries/dispositions/sendasemail.php';
     if (isset($faxProfile['registry']['admin_email']) && $faxProfile['registry']['admin_email'] != '') {
         $dpentry .= ' -s ' . $faxProfile['registry']['admin_email'];
     }
     if (isset($faxProile['registry']['from_address']) && $faxProile['registry']['from_address'] != '') {
         $dpentry .= ' -f ' . $faxProfile['registry']['from_address'];
     }
     if (isset($faxProfile['registry']['from_name']) && $faxProfile['registry']['from_name'] != '') {
         $dpentry .= ' -n \'' . $faxProfile['registry']['from_name'] . '\'';
     }
     if (isset($faxProfile['registry']['email_subject']) && $faxProfile['registry']['email_subject'] != '') {
         $dpentry .= ' -u \'' . $faxProfile['registry']['email_subject'] . '\'';
     }
     if (isset($faxProfile['registry']['email_body']) && $faxProfile['registry']['email_body'] != '') {
         $dpentry .= ' -b \'' . $faxProfile['registry']['email_body'] . '\'';
     }
     if (isset($faxProfile['registry']['dest_email']) && $faxProfile['registry']['dest_email'] != '') {
         $dpentry .= ' -d \'' . $faxProfile['registry']['dest_email'] . '\'';
     } else {
         $dpentry .= ' -d \'${dialedEmail}\'';
     }
     if (isset($faxProfile['registry']['send_status']) && !$faxProfile['registry']['send_status']) {
         $dpentry .= ' -e';
     }
     $dpentry .= ' -ocidname \'${caller_id_name}\' -ocidnum \'${caller_id_number}\' -r \\\\${fax_result_code} -t \'\\\\${fax_result_text}\' -i \'\\\\${fax_remote_station_id}\' -pr \\\\${fax_document_transferred_pages} -pt \\\\${fax_document_total_pages} ' . $faxProfile->fxp_spool_dir . 'infax-${uuid}.tiff';
     Kohana::log('debug', $dpentry);
     $xml->update('/action[@application="set"][@bluebox="settingHangupHook"][@data="api_hangup_hook=' . str_replace(array('\\', '/', '@'), array('\\\\', '\\/', '\\@'), $dpentry) . '"]');
     parent::dialplan($number);
 }
Esempio n. 3
0
 public static function preNumber()
 {
     $number = Event::$data;
     $xml = Telephony::getDriver()->xml;
     if (empty($number['Destination']['plugins']['callerid'])) {
         return;
     }
     if ($number['Destination'] instanceof Device) {
         return;
     }
     if (!empty($number['Destination']['plugins']['callerid']['internal_name'])) {
         $internal_name = $number['Destination']['plugins']['callerid']['internal_name'];
         $xml->update('/action[@application="set"][@bluebox="callerid_internal_name"][@data="effective_caller_id_name=' . $internal_name . '"]');
     } else {
         $xml->deleteNode('/action[@application="set"][@bluebox="callerid_internal_name"]');
     }
     if (!empty($number['Destination']['plugins']['callerid']['internal_number'])) {
         $internal_number = $number['Destination']['plugins']['callerid']['internal_number'];
         $xml->update('/action[@application="set"][@bluebox="callerid_internal_number"][@data="effective_caller_id_number=' . $internal_number . '"]');
     } else {
         $xml->deleteNode('/action[@application="set"][@bluebox="callerid_internal_number"]');
     }
     if (!empty($number['Destination']['plugins']['callerid']['external_name'])) {
         $external_name = $number['Destination']['plugins']['callerid']['external_name'];
         $xml->update('/action[@application="set"][@bluebox="callerid_external_name"][@data="effective_caller_id_name=' . $external_name . '"]');
     } else {
         $xml->deleteNode('/action[@application="set"][@bluebox="callerid_external_name"]');
     }
     if (!empty($number['Destination']['plugins']['callerid']['external_number'])) {
         $external_number = $number['Destination']['plugins']['callerid']['external_number'];
         $xml->update('/action[@application="set"][@bluebox="callerid_external_number"][@data="effective_caller_id_number=' . $external_number . '"]');
     } else {
         $xml->deleteNode('/action[@application="set"][@bluebox="callerid_external_number"]');
     }
 }
Esempio n. 4
0
 public static function preNumber()
 {
     $number = Event::$data;
     $xml = Telephony::getDriver()->xml;
     if (isset($number['Destination']['plugins']['callrecord'])) {
         $callrecord = $number['Destination']['plugins']['callrecord'];
     } else {
         return;
     }
     if (!$callrecord) {
         return;
     }
     // Is this a trunk? If so, add generic stuff to see if this is a
     if ($number['Destination'] instanceof Device) {
         // Is inbound call recording set? If so, record calls to this user
         if (!empty($callrecord['inbound']) and $callrecord['inbound']) {
             $filename = Kohana::config('freeswitch.audio_root') . '/../recordings/${uuid}.wav';
             $cr_cmd = str_replace('/', '\\/', $filename);
             //Not the prettiest fix, but it works
             $condlog = '${cond(${callrecord_outbound} == 1 ? Already recording - Skipping inbound recording : Currently not recording, starting to record}';
             $cond = '${cond(${callrecord_outbound} == 1 ?  : ' . $cr_cmd . '}';
             $xml->update('/action[@application="log"][@bluebox="callrecord_action"][@data="INFO ' . $condlog . '"]');
             $xml->update('/action[@application="record_session"][@bluebox="callrecord_action"][@data="' . $cond . '"]');
         } else {
             $xml->deleteNode('/action[@application="set"][@bluebox="callrecord_action"]');
         }
     }
 }
Esempio n. 5
0
 public static function dialplan($number)
 {
     $xml = Telephony::getDriver()->xml;
     $destination = $number['Destination'];
     $xml->update('/action[@application="answer"]');
     $xml->update('/action[@application="ivr"]{@data="auto_attendant_' . $destination['auto_attendant_id'] . '"}');
 }
Esempio n. 6
0
 public static function delete($base)
 {
     $xml = Telephony::getDriver()->xml;
     FreeSwitch::setSection('xmlcdr');
     //not sure what to do here
     //        $xml->deleteNode();
 }
Esempio n. 7
0
 public static function delete($base)
 {
     $xml = Telephony::getDriver()->xml;
     $xml_root = '//document/section[@name="configuration"]/configuration[@name="callcenter.conf"][@description="CallCenter"]';
     $xml->setXmlRoot($xml_root . '/agents/agent[@name="agent_' . $base['agent_id'] . '"]');
     $xml->deleteNode();
 }
Esempio n. 8
0
    public static function dialplan($number)
    {
        $xml = Telephony::getDriver()->xml;
        $destination = $number['Destination'];
        $xmlText = '        
        <action application="set" data="api_hangup_hook=conference ' . $destination['pgg_id'] . ' kick all"/>
        <action application="answer"/>
        <action application="set" data="conference_auto_outcall_caller_id_name=${effective_caller_id_name}"/>
        <action application="set" data="conference_auto_outcall_caller_id_number=${effective_caller_id_number}"/>
        <action application="set" data="conference_auto_outcall_timeout=3"/>
        <action application="set" data="conference_auto_outcall_prefix={sip_auto_answer=true,sip_h_Alert-Info=Alert-Info:sip://127.0.0.1\\;info=Ring_Answer,sip_h_Call-Info=Call-Info:sip://127.0.0.1\\;answer-after=0}"/>
        <action application="set" data="sip_exclude_contact=${network_addr}"/>
';
        if ($destination['pgg_type'] === 'page') {
            $xmlText .= '        <action application="set" data="conference_auto_outcall_flags=mute"/>
        	';
        } else {
            $xmlText .= '        <action application="set" data="conference_auto_outcall_flags=none"/>
';
        }
        foreach ($destination['pgg_device_ids'] as $deviceid) {
            $deviceobj = Doctrine::getTable('Device')->FindOneBy('device_id', $deviceid);
            Kohana::log('debug', print_r($deviceobj['registry'], true));
            $xmlText .= '        <action application="conference_set_auto_outcall" data="user/' . $deviceobj->plugins['sip']['username'] . '@$${location_' . $deviceobj->User->location_id . '}"/>
';
        }
        $conftype = $destination['pgg_type'] == 'page' ? 'Paging' : 'Intercom';
        $confobj = Doctrine::getTable('Conference')->findOneByName($conftype);
        $xmlText .= '        <action application="conference" data="' . $destination['pgg_id'] . '@conference_' . $confobj['conference_id'] . '"/>
        <action application="conference" data="' . $destination['pgg_id'] . ' kick all"/>
';
        $xml->replaceWithXml($xmlText);
    }
Esempio n. 9
0
 public static function dialplan($number)
 {
     $xml = Telephony::getDriver()->xml;
     $destination = $number['Destination'];
     if ($destination instanceof ExternalXfer) {
         $numberOptions = fs::getNumberOptions($number);
         switch ($destination['route_type']) {
             case ExternalXfer::TYPE_SIP:
                 if (empty($destination['route_details']['interface']) or empty($destination['route_details']['sipuri'])) {
                 }
                 $dialstring = 'sofia/sipinterface_' . $destination['route_details']['interface'] . '/' . $destination['route_details']['sipuri'];
                 break;
             case ExternalXfer::TYPE_TRUNK:
                 if (empty($destination['route_details']['trunk']) or empty($destination['route_details']['number'])) {
                 }
                 $dialstring = 'sofia/gateway/trunk_' . $destination['route_details']['trunk'] . '/' . $destination['route_details']['number'];
                 break;
         }
         $dialstring = str_replace(array('/', '@'), array('\\/', '\\@'), $dialstring);
         if (empty($dialstring)) {
             return;
         }
         $xml->update('/action[@application="set"][@bluebox="settingTimeout"]{@data="call_timeout=' . $numberOptions['timeout'] . '"}');
         $xml->update('/action[@application="set"][@bluebox="settingRing"]{@data="ringback=' . $numberOptions['ringtype'] . '"}');
         $xml->update('/action[@application="set"][@bluebox="settingRingXfer"]{@data="transfer_ringback=' . $numberOptions['ringtype'] . '"}');
         if (!empty($destination['plugins']['callerid']['internal_name'])) {
             $xml->update('/action[@application="export"][@bluebox="sipCalleeIdName"]{@data="sip_callee_id_name=' . $destination['plugins']['callerid']['internal_name'] . '"}');
         } else {
             $xml->update('/action[@application="export"][@bluebox="sipCalleeIdName"]{@data="sip_callee_id_name=' . $destination['name'] . '"}');
         }
         $xml->update('/action[@application="export"][@bluebox="sipCalleeIdNumber"]{@data="sip_callee_id_number=' . $number['number'] . '"}');
         $options = array();
         if (arr::get($destination, 'registry', 'ignore_early_media')) {
             $options[] = 'ignore_early_media=true';
         }
         if (arr::get($destination, 'registry', 'require_confirmation')) {
             $options[] = 'group_confirm_file=ivr\\/ivr-accept_reject_voicemail.wav,group_confirm_key=1,leg_timeout=' . arr::get($destination, 'registry', 'require_confirmation_timeout');
         }
         if (count($options) > 0) {
             $options = '{' . implode(',', $options) . '}';
         } else {
             $options = '';
         }
         if (($type = arr::get($destination, 'plugins', 'activefeaturecode', 'type')) && arr::get($destination, 'plugins', 'activefeaturecode', 'type') != '0') {
             switch ($type) {
                 case 'transfer':
                     $fc = arr::get($destination, 'plugins', 'activefeaturecode', 'number');
                     $ext = arr::get($destination, 'plugins', 'activefeaturecode', 'exten');
                     $transfer = fs::getTransferToNumber($ext);
                     $leg = arr::get($destination, 'plugins', 'activefeaturecode', 'leg');
                     $xml->update('/action[@application="set"][@bluebox="afc_app"]{@data="bridge_pre_execute_' . $leg . 'leg_app=bind_digit_action"}');
                     $xml->update('/action[@application="set"][@bluebox="afc_data"]{@data="bridge_pre_execute_' . $leg . 'leg_data=transfer_back,' . $fc . ',exec:transfer,-bleg ' . $transfer . '"}');
                     break;
                 default:
                     break;
             }
         }
         $xml->update('/action[@application="bridge"]{@data="' . $options . $dialstring . '"}');
     }
 }
Esempio n. 10
0
 /**
  * Indicate we support FreeSWITCH with this SIP Device and provide code to save SIP device specific settings
  */
 public static function set($obj)
 {
     // Get the asterisk driver
     $driver = Telephony::getDriver();
     // Get the asterisk manager
     $ami = $driver->ami;
     // Sanity check, ensure we have a connected manager
     if (!$ami->connected()) {
         return false;
     }
     // Get the base of this configure object
     $base = Bluebox_Record::getBaseTransactionObject();
     // Get the username of this sip device
     $username = $base->Sip->username;
     // Get the domain of this user or set it to default
     if ($base->User->Location->domain == '') {
         $domain = 'default';
     } else {
         $domain = $base->User->Location->domain;
     }
     /* TODO: This is temporary to push everything into the default context */
     $domain = 'default';
     if ($base instanceof Conference) {
         /* TODO: I expect this will have to be handled in the dialplan */
     } elseif ($base instanceof Device) {
         $ami->queueConfigUpdate('sip.conf', 'Append', $username, 'callerid', '"' . $obj['internal_name'] . '" <' . $obj['internal_number'] . '>');
         $ami->queueConfigUpdate('sip.conf', 'Append', $username, 'setvar', 'external_cid = "' . $obj['external_name'] . '" <' . $obj['external_number'] . '>');
     }
 }
Esempio n. 11
0
 /**
  * This function should be called when you want to end a context in a dialplan
  * @param string $context Context to end
  */
 public static function end($context = FALSE, $obj = NULL)
 {
     $driver = Telephony::getDriver();
     // 7. Any final things to do? Play a goodbye message? A survey? Write a special log? etc.
     $driver->postExecute($context, $obj);
     $driver->catchAll($context, $obj);
 }
Esempio n. 12
0
 public static function delete($ccData)
 {
     $xml = Telephony::getDriver()->xml;
     $root = '//document/section[@name="configuration"]/configuration[@name="callcenter.conf"][@description="CallCenter"]';
     $xml->setXmlRoot($root);
     $xml->deleteNode();
 }
Esempio n. 13
0
 public static function dialplan($number)
 {
     $xml = Telephony::getDriver()->xml;
     $faxProfile = $number['Destination'];
     $faxpackage = Doctrine::getTable('package')->findOneBy('name', 'fax');
     $xml->update('/action[@application="set"][@bluebox="settingHangupHook"][@data="api_hangup_hook=' . str_replace('/', '\\/', DOCROOT . '/' . $faxpackage->basedir . '/libraries/dispositions/movetodir.php ' . $faxProfile->fxp_spool_dir . '/${uuid}.rxfax.tif ' . $faxProfile['registry']['destination_dir'] . '/infax-${uuid}.tif"]'));
     parent::dialplan($number);
 }
Esempio n. 14
0
 public static function delete($myPluginData)
 {
     // Reference to our XML document
     $xml = Telephony::getDriver()->xml;
     $xml->setXmlRoot('//document/section[@name="myplugin"]');
     // Delete everything at this node
     $xml->deleteNode();
 }
Esempio n. 15
0
 public static function dialplan($number)
 {
     $xml = Telephony::getDriver()->xml;
     $destination = $number['Destination'];
     $xml->update('/action[@application="answer"]');
     $xml->update('/action[@application="set"][@data="ivr_path=${ivr_path}-${destination_number} XML ${context}"]');
     $xml->update('/action[@application="ivr"]{@data="auto_attendant_' . $destination['auto_attendant_id'] . '"}');
 }
Esempio n. 16
0
    public static function dialplan($number)
    {
        $xml = Telephony::getDriver()->xml;
        $destination = $number['Destination'];
        $registry = (array) $destination['registry'];
        $xmlText = <<<XML


XML;
        $xml->replaceWithXml($xmlText);
    }
Esempio n. 17
0
 public static function dialplan($number)
 {
     $doc = Telephony::getDriver()->doc;
     $destination = $number['Destination'];
     $numberOptions = astrsk::getNumberOptions($number);
     if ($destination instanceof Device) {
         if (!empty($destination['plugins']['sip']['username'])) {
             $doc->add('Dial(SIP/' . $destination['plugins']['sip']['username'] . ',' . $numberOptions['timeout'] . ')');
         }
     }
 }
Esempio n. 18
0
    public static function dialplan($number)
    {
        $xml = Telephony::getDriver()->xml;
        $destination = $number['Destination'];
        $registry = (array) $destination['registry'];
        $xmlText = <<<XML

<action application="transfer" data="\${hash(select/\${domain_name}-last_dial/\${caller_id_number})}"/>

XML;
        $xml->replaceWithXml($xmlText);
    }
Esempio n. 19
0
 public static function delete($ccData)
 {
     $xml = Telephony::getDriver()->xml;
     $locationRec = Doctrine::getTable('Location')->find($ccData->cca_locationid);
     $root = '//document/section[@name="configuration"]/configuration[@name="callcenter.conf"][@description="CallCenter"]/agents/agent[@bluebox="' . $ccData->cca_id . '"]';
     $xml->setXmlRoot($root);
     $xml->deleteNode();
     if (CallCenterManager::updateRealtime() == 'realtime') {
         $agentname = $ccData->cca_loginid . '@' . $ccData->agentLocation->domain;
         self::removeRunning($agentname);
     }
 }
Esempio n. 20
0
 public static function dialplan($number)
 {
     $xml = Telephony::getDriver()->xml;
     $destination = $number['Destination'];
     $xml->setXmlRoot($xml->getExtensionRoot());
     $condition = '/condition[@field="destination_number"]{@expression="^' . str_replace(array('*', '+'), array('\\*', '\\+'), $number['number']) . '(.+)$"}';
     $xml->update($condition);
     $condition = '/condition[@field="destination_number"][@expression="^' . str_replace(array('*', '+'), array('\\*', '\\+'), $number['number']) . '(.+)$"]';
     $xml->setXmlRoot($xml->getExtensionRoot() . $condition);
     $xml->update('/action[@application="export"][@data="sip_auto_answer=true"]');
     $xml->update('/action[@application="bridge"][@data="loopback\\/$1"]');
 }
Esempio n. 21
0
 public static function prenumber($number)
 {
     $xml = Telephony::getDriver()->xml;
     $number = Event::$data;
     $destination = $number['Destination'];
     if (!$destination instanceof FaxProfile) {
         $domain = '$${location_' . $destination['User']['location_id'] . '}';
         $dialeduser = $destination['plugins']['sip']['username'] . '@' . $domain;
         $xml->update('/action[@application="set"][@bluebox="settingDialeduser"]{@data="dialedUser='******'"}');
     }
     parent::prenumber($number);
 }
Esempio n. 22
0
 public static function dialplan($number)
 {
     $dialstring = '';
     $memberSeperator = '&';
     $destination = $number['Destination'];
     $doc = Telephony::getDriver()->doc;
     $numberOptions = astrsk::getNumberOptions($number);
     foreach ($destination['members'] as $member) {
         $dialstring .= $member['bridge'] . $memberSeperator;
     }
     $dialstring = rtrim($dialstring, $memberSeperator);
     $doc->add('Dial(' . $dialstring . ',' . $numberOptions['timeout'] . ')');
 }
Esempio n. 23
0
    public static function dialplan($number)
    {
        $xml = Telephony::getDriver()->xml;
        $destination = $number['Destination'];
        $registry = (array) $destination['registry'];
        $xmlText = <<<XML

<action application="answer"/>
<action application="playback" data="tone_stream://%(1000,0,2600);loops=-1"/>

XML;
        $xml->replaceWithXml($xmlText);
    }
Esempio n. 24
0
 public static function delete($obj)
 {
     $doc = Telephony::getDriver()->doc;
     // Go remove any references to this number
     if ($obj->NumberContext) {
         foreach ($obj->NumberContext as $context) {
             Asterisk_NumberContext_Driver::delete($context);
             //$doc->deleteDialplanExtension($context->context_id, $obj->number);
         }
     }
     // Remove the destination itself, fully. Despite this being called create, an empty context gets deleted automagically at save time
     $doc->deleteContext('extensions.conf', 'number_' . $obj['number_id']);
 }
Esempio n. 25
0
 public static function dialplan($number)
 {
     $xml = Telephony::getDriver()->xml;
     $destination = $number['Destination'];
     $registry = (array) $destination['registry'];
     $xml->deleteChildren();
     $condition = '/condition[@field="${ivr_path}"][@expression="(.*)-(.*)-.*+$"][@break="never"]';
     $xml->setXmlRoot($xml->getExtensionRoot() . $condition);
     $xml->update('/action[@application="set"][@data="ivr_path=$1"]');
     $xml->update('/action[@application="transfer"][@data="$2"]');
     $xml->update('/anti-action[@application="set"][@data="ivr_path="]');
     $xml->update('/anti-action[@application="transfer"][@data="${vm-operator-extension}"]');
 }
Esempio n. 26
0
File: tier.php Progetto: swk/bluebox
 public static function delete($ccData)
 {
     $xml = Telephony::getDriver()->xml;
     $agentRec = Doctrine::getTable('callcenter_agent')->find($ccData->cct_cca_id);
     $queueRec = Doctrine::getTable('callcenter_queue')->find($ccData->cct_ccq_id);
     $locationRec = Doctrine::getTable('Location')->find($agentRec->cca_location_id);
     $root = '//document/section[@name="configuration"]/configuration[@name="callcenter.conf"][@description="CallCenter"]/tiers/tier[@agent="' . $agentRec->cca_loginid . '\\@' . $locationRec->domain . '"][@queue="' . $queueRec->ccq_name . '\\@' . $locationRec->domain . '"]';
     $xml->setXmlRoot($root);
     $xml->deleteNode();
     if (CallCenterManager::updateRealtime()) {
         self::removeRunning($ccData);
     }
 }
Esempio n. 27
0
    public static function dialplan($number)
    {
        $xml = Telephony::getDriver()->xml;
        $destination = $number['Destination'];
        $registry = (array) $destination['registry'];
        $xmlText = <<<XML

<action application="answer"/>
<action application="delay_echo" data="1000"/>

XML;
        $xml->replaceWithXml($xmlText);
    }
Esempio n. 28
0
 public static function set($base)
 {
     if ($base instanceof Device and $location_id = arr::get($base['User'], 'location_id')) {
         $domain = '$${location_' . $location_id . '}';
         $xml = Telephony::getDriver()->xml;
         FreeSwitch::setSection('user', $domain, $base['device_id']);
         if ($areacode = arr::get($base, 'registry', 'areacode')) {
             $xml->update('/variables/variable[@name="areacode"]{@value="' . $areacode . '"}');
         } else {
             $xml->deleteNode('/variables/variable[@name="areacode"]');
         }
     }
 }
Esempio n. 29
0
 public static function dialplan($number)
 {
     $xml = Telephony::getDriver()->xml;
     $destination = $number['Destination'];
     if ($destination['timezone'] == '') {
         $timezone = Kohana::config('locale.timezone');
     } else {
         $timezone = $destination['timezone'];
     }
     if (!empty($destination['time'])) {
         $parts = explode(';', $destination['time']);
         if (count($parts) != 2) {
             kohana::log('error', 'Time was not comprised of two parts');
             return FALSE;
         }
         $time = FreeSwitch_TimeOfDay_Driver::make_range_regex(sprintf("%02d%02d", $parts[0] / 60, $parts[0] % 60), sprintf("%02d%02d", $parts[1] / 60, $parts[1] % 60));
     } else {
         kohana::log('error', 'Time of day route had no time');
         return FALSE;
     }
     $weekDayColumns = array('mon', 'tue', 'wen', 'thur', 'fri', 'sat', 'sun');
     $wday = '';
     $comment = '';
     foreach ($weekDayColumns as $pos => $weekDayColumn) {
         if (!empty($destination[$weekDayColumn])) {
             $wday .= $pos + 1;
             $comment .= $weekDayColumn . ", ";
         }
     }
     // TODO: This makes no sense....
     if (empty($wday)) {
         $wday = '1-7';
         $comment = 'any day, ';
     }
     $comment .= sprintf("%02d:%02d - %02d:%02d", $parts[0] / 60, $parts[0] % 60, $parts[1] / 60, $parts[1] % 60);
     $xml->setXmlRoot($xml->getExtensionRoot());
     $cond = '/condition[@field="${strftime_tz(' . str_replace('/', '\\/', $timezone) . ' %u%H%M)}"]';
     $xml->update($cond . '{@blueboxcomment="' . $comment . '"}{@expression="^[' . "{$wday}]{$time}" . '"}');
     if ($action = fs::getTransferToNumber($destination['during_number_id'])) {
         $action = str_replace('transfer ', '', $action);
         $xml->update($cond . '/action[@application="transfer"]{@data="' . $action . '"}');
     } else {
         $xml->update($cond . '/action[@application="hangup"]');
     }
     if ($antiAction = fs::getTransferToNumber($destination['outside_number_id'])) {
         $antiAction = str_replace('transfer ', '', $antiAction);
         $xml->update($cond . '/anti-action[@application="transfer"]{@data="' . $antiAction . '"}');
     } else {
         $xml->update($cond . '/anti-action[@application="hangup"]');
     }
 }
Esempio n. 30
0
   public static function dialplan($number)
   {
       $xml = Telephony::getDriver()->xml;
       $destination = $number['Destination'];
       $registry = (array) $destination['registry'];
       $xmlText = '
   <action application="set" data="res=${callcenter_config(agent set status ${caller_id_number}@${domain_name} \'Available\')}" />
   <action application="answer" data=""/>
   <action application="sleep" data="500"/>
   <action application="playback" data="ivr/ivr-you_are_now_logged_in.wav"/>
   <action application="hangup" data=""/>
 ';
       $xml->replaceWithXml($xmlText);
   }