Пример #1
0
 $DEVICE_TEMPLATE['sip'] = array('method' => 'password', 'invite_format' => 'username', 'username' => $USER_TEMPLATE['username'], 'password' => substr(sha1($USER_TEMPLATE['username']), 0, 31), 'expire_seconds' => 300, 'registration_expiration' => 360);
 printf("{$bldblu}TEST: Create Device.{$txtrst}\n");
 $DEVICE_TEMPLATE['owner_id'] = $USER_ID;
 $resp = $XBAR->put_device($DEVICE_TEMPLATE, $ACCOUNT_ID);
 if ($resp['status'] == 'success') {
     printf("{$bldgrn}PASS: Create Device.{$txtrst}\n\n");
     $DEVICE_ID = $resp['data']['id'];
     printf("{$bldblu}TEST: Get Device by ID:{$bldred}{$DEVICE_ID}.{$txtrst}\n");
     $device = $XBAR->get_device($DEVICE_ID, $ACCOUNT_ID);
     if (isset($device['id'])) {
         printf("{$bldgrn}PASS: Get Device.{$txtrst}\n\n");
     } else {
         printf("{$bldred}FAIL: Get Device.{$txtrst}\n\n");
     }
     printf("{$bldblu}TEST: Delete Device{$txtrst}\n");
     $resp = $XBAR->del_device($DEVICE_ID, $ACCOUNT_ID);
     if ($resp['status'] == "success") {
         printf("{$bldgrn}PASS: Delete Device.{$txtrst}\n\n");
     } else {
         printf("{$bldred}FAIL: Delete Device.{$txtrst}\n\n");
     }
 } else {
     printf("{$bldred}FAIL: Create Device.{$txtrst}\n\n");
 }
 $VMB_TEMPLATE = array();
 //$VMB_TEMPLATE['name'] = $_REQUEST['first_name']." ".$_REQUEST['last_name']." ( {$_REQUEST['extension_number']} )";
 $VMB_TEMPLATE['name'] = $USER_TEMPLATE['usernmae'] . " VMB";
 $VMB_TEMPLATE['mailbox'] = '1234';
 $VMB_TEMPLATE['pin'] = '1234';
 $VMB_TEMPLATE['timezone'] = 'America/Los_Angles';
 $VMB_TEMPLATE['check_if_owner'] = true;