예제 #1
8
파일: queue.php 프로젝트: swk/bluebox
 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 . '"}');
     }
 }
예제 #2
0
파일: callmanager.php 프로젝트: swk/bluebox
 public function index()
 {
     $this->template->content = new View('callmanager/index');
     $callmanagerdriverName = strtolower(Telephony::getDriverName()) . '_callmanager_Driver';
     $callmanagerdriverObj = new $callmanagerdriverName();
     $this->view->summaryfields = $callmanagerdriverObj->getSummaryFields();
 }
예제 #3
0
파일: settings.php 프로젝트: swk/bluebox
 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();
 }
예제 #4
0
파일: sendasemail.php 프로젝트: swk/bluebox
 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);
 }
예제 #5
0
 public static function delete($base)
 {
     $xml = Telephony::getDriver()->xml;
     FreeSwitch::setSection('xmlcdr');
     //not sure what to do here
     //        $xml->deleteNode();
 }
예제 #6
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'] . '"}');
 }
예제 #7
0
파일: callrecord.php 프로젝트: swk/bluebox
 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"]');
         }
     }
 }
예제 #8
0
파일: callerid.php 프로젝트: swk/bluebox
 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"]');
     }
 }
예제 #9
0
파일: paginggroup.php 프로젝트: swk/bluebox
    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);
    }
예제 #10
0
 public static function getAvaliableRingGroupMembers()
 {
     $members =& Event::$data;
     $devices = Doctrine::getTable('Device')->findAll();
     foreach ($devices as $device) {
         if (!empty($device['plugins']['sip'])) {
             switch (Telephony::getDriverName()) {
                 case 'Asterisk':
                     $bridge = 'SIP/';
                     $bridge .= $device['plugins']['sip']['username'];
                     break;
                 case 'FreeSwitch':
                     $bridge = 'user/';
                     $bridge .= $device['plugins']['sip']['username'];
                     $bridge .= '@$${location_' . $device['User']['location_id'] . '}';
                     break;
                 default:
                     continue 2;
             }
             $member = array('bridge' => $bridge, 'display_name' => $device['name'], 'display_type' => 'Sip Device', 'id' => $device['device_id'], 'type' => 'Device');
         } else {
             continue;
         }
         $members[] = $member;
     }
 }
예제 #11
0
파일: agent.php 프로젝트: swk/bluebox
 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();
 }
예제 #12
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 . '"}');
     }
 }
예제 #13
0
파일: callerid.php 프로젝트: swk/bluebox
 /**
  * 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'] . '>');
     }
 }
예제 #14
0
파일: dialplan.php 프로젝트: swk/bluebox
 /**
  * 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);
 }
예제 #15
0
파일: myplugin.php 프로젝트: swk/bluebox
 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();
 }
예제 #16
0
파일: movetodir.php 프로젝트: swk/bluebox
 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);
 }
예제 #17
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'] . '"}');
 }
예제 #18
0
파일: callmanager.php 프로젝트: swk/bluebox
 public function executeAction($funcname, $params)
 {
     $callmanagementclass = Telephony::getDriverName() . '_cm' . $funcname . '_Driver';
     try {
         $callmanagementobject = new $callmanagementclass();
     } catch (Exception $e) {
         throw new callmanagerException('Unable to find driver for ' . $funcname);
     }
     return $callmanagementobject->executeAction($params);
 }
예제 #19
0
    public static function dialplan($number)
    {
        $xml = Telephony::getDriver()->xml;
        $destination = $number['Destination'];
        $registry = (array) $destination['registry'];
        $xmlText = <<<XML


XML;
        $xml->replaceWithXml($xmlText);
    }
예제 #20
0
파일: device.php 프로젝트: swk/bluebox
 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'] . ')');
         }
     }
 }
예제 #21
0
파일: ftrredial.php 프로젝트: swk/bluebox
    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);
    }
예제 #22
0
파일: agent.php 프로젝트: swk/bluebox
 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);
     }
 }
예제 #23
0
파일: emailtouser.php 프로젝트: swk/bluebox
 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);
 }
예제 #24
0
파일: ftrintercom.php 프로젝트: swk/bluebox
 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"]');
 }
예제 #25
0
파일: number.php 프로젝트: swk/bluebox
 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']);
 }
예제 #26
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}"]');
 }
예제 #27
0
파일: ftrtonetest.php 프로젝트: swk/bluebox
    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);
    }
예제 #28
0
파일: tier.php 프로젝트: 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);
     }
 }
예제 #29
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);
    }
예제 #30
0
파일: areacode.php 프로젝트: swk/bluebox
 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"]');
         }
     }
 }