Работа с правилами переадресации — различия между версиями
Материал из Oktell
(Новая страница: «Наверх ===Методы для работы с прави...») |
(нет различий)
|
Версия 06:59, 24 марта 2014
Методы для работы с правилами переадресации
- string Redirect_GetUserRules ( ). Возвращает XML-строку с набором существующих для текущего авторизованного пользователя правил переадресации. В случае ошибки возвращается NULL.
Формат возвращаемого xml (на примере):
<?xml version="1.0" encoding="utf-16"?> <oktellcommapper version="80710"> <property_set name="redirectrule" id="86c7eeb5-a805-493a-a557-6675b884885c"> <property_simple key="id" value="86c7eeb5-a805-493a-a557-6675b884885c" /> <property_cdata key="caption"><![CDATA[тест субботы]]></property_cdata> <property_cdata key="description"><![CDATA[]]></property_cdata> <property_simple key="priority" value="1" /> <property_simple key="enabled" value="1" /> <property_simple key="onlyforredirectstate" value="0" /> <property_simple key="cascaderedirect" value="0" /> <property_simple key="numberdestination" value="89050215951" /> <property_simple key="userid" value="da803f01-ea77-40fa-bc9d-e2efb36fd5a8" /> <property_simple key="currentstate" value="1" name="Enabled" /> <property_collection name="extra" count="2"> <property_set name="abonents" /> <property_set name="time"> <property_collection name="time" count="1"> <property_set name="periodinfo"> <property_simple key="format" value="HH:mm" /> <property_simple key="weekday" value="6" name="Saturday" /> <property_simple key="begin" value="10:00" /> <property_simple key="end" value="13:00" /> </property_set> </property_collection> </property_set> </property_collection> </property_set> <property_set name="redirectrule" id="6bbe38b3-094c-4424-b938-539d7e6382c5"> <property_simple key="id" value="6bbe38b3-094c-4424-b938-539d7e6382c5" /> <property_cdata key="caption"><![CDATA[Общая переадресация]]></property_cdata> <property_cdata key="description"><![CDATA[]]></property_cdata> <property_simple key="priority" value="2" /> <property_simple key="enabled" value="1" /> <property_simple key="onlyforredirectstate" value="0" /> <property_simple key="cascaderedirect" value="0" /> <property_simple key="numberdestination" value="31" /> <property_simple key="userid" value="da803f01-ea77-40fa-bc9d-e2efb36fd5a8" /> <property_simple key="currentstate" value="1" name="Enabled" /> <property_collection name="extra" count="2"> <property_set name="abonents"> <property_collection name="abonents" count="2"> <property_set name="abonent"> <property_simple key="type" name="1" value="ExtNumber" /> <property_simple key="id" name="00000000-0000-0000-0000-000000000000" /> <property_simple key="number" name="4952778419" /> <property_cdata key="description"><![CDATA[Теща]]></property_cdata> </property_set> <property_set name="abonent"> <property_simple key="type" name="1" value="User" /> <property_simple key="id" name="837afb4a-2be1-5ad3-9bba-1422f2dae0c7" /> <property_simple key="number" name="" /> <property_cdata key="description"><![CDATA[Иван Петрович]]></property_cdata> </property_set> </property_collection> </property_set> <property_set name="time"> <property_collection name="time" count="4"> <property_set name="periodinfo"> <property_simple key="format" value="HH:mm" /> <property_simple key="weekday" value="3" name="Wednesday" /> <property_simple key="begin" value="04:00" /> <property_simple key="end" value="08:00" /> </property_set> <property_set name="periodinfo"> <property_simple key="format" value="HH:mm" /> <property_simple key="weekday" value="4" name="Thursday" /> <property_simple key="begin" value="04:00" /> <property_simple key="end" value="08:00" /> </property_set> <property_set name="periodinfo"> <property_simple key="format" value="HH:mm" /> <property_simple key="weekday" value="5" name="Friday" /> <property_simple key="begin" value="09:00" /> <property_simple key="end" value="16:00" /> </property_set> <property_set name="periodinfo"> <property_simple key="format" value="HH:mm" /> <property_simple key="weekday" value="6" name="Saturday" /> <property_simple key="begin" value="09:00" /> <property_simple key="end" value="16:00" /> </property_set> </property_collection> </property_set> </property_collection> </property_set> <property_set name="redirectrule" id="bcd09c4c-9b41-41e8-a62f-abfa01f3f668"> <property_simple key="id" value="bcd09c4c-9b41-41e8-a62f-abfa01f3f668" /> <property_cdata key="caption"><![CDATA[t3]]></property_cdata> <property_cdata key="description"><![CDATA[]]></property_cdata> <property_simple key="priority" value="3" /> <property_simple key="enabled" value="1" /> <property_simple key="onlyforredirectstate" value="0" /> <property_simple key="cascaderedirect" value="0" /> <property_simple key="numberdestination" value="" /> <property_simple key="userid" value="da803f01-ea77-40fa-bc9d-e2efb36fd5a8" /> <property_simple key="currentstate" value="1" name="Enabled" /> <property_collection name="extra" count="2"> <property_set name="abonents" /> <property_set name="time"> <property_collection name="time" count="4"> <property_set name="periodinfo"> <property_simple key="format" value="HH:mm" /> <property_simple key="weekday" value="4" name="Thursday" /> <property_simple key="begin" value="06:00" /> <property_simple key="end" value="17:00" /> </property_set> <property_set name="periodinfo"> <property_simple key="format" value="HH:mm" /> <property_simple key="weekday" value="5" name="Friday" /> <property_simple key="begin" value="06:00" /> <property_simple key="end" value="17:00" /> </property_set> <property_set name="periodinfo"> <property_simple key="format" value="HH:mm" /> <property_simple key="weekday" value="6" name="Saturday" /> <property_simple key="begin" value="06:00" /> <property_simple key="end" value="17:00" /> </property_set> <property_set name="periodinfo"> <property_simple key="format" value="HH:mm" /> <property_simple key="weekday" value="7" name="7" /> <property_simple key="begin" value="06:00" /> <property_simple key="end" value="17:00" /> </property_set> </property_collection> </property_set> </property_collection> </property_set> <property_set name="redirectrule" id="8cbb1c0f-f900-41a0-a455-c6b24dac336d"> <property_simple key="id" value="8cbb1c0f-f900-41a0-a455-c6b24dac336d" /> <property_cdata key="caption"><![CDATA[Неинтересные люди]]></property_cdata> <property_cdata key="description"><![CDATA[]]></property_cdata> <property_simple key="priority" value="2" /> <property_simple key="enabled" value="1" /> <property_simple key="onlyforredirectstate" value="0" /> <property_simple key="cascaderedirect" value="0" /> <property_simple key="numberdestination" value="31" /> <property_simple key="userid" value="da803f01-ea77-40fa-bc9d-e2efb36fd5a8" /> <property_simple key="currentstate" value="1" name="Enabled" /> <property_collection name="extra" count="2"> <property_set name="abonents" /> <property_set name="time"> <property_collection name="time" count="2"> <property_set name="periodinfo"> <property_simple key="format" value="HH:mm" /> <property_simple key="weekday" value="6" name="Saturday" /> <property_simple key="begin" value="03:00" /> <property_simple key="end" value="13:00" /> </property_set> <property_set name="periodinfo"> <property_simple key="format" value="HH:mm" /> <property_simple key="weekday" value="7" name="7" /> <property_simple key="begin" value="03:00" /> <property_simple key="end" value="13:00" /> </property_set> </property_collection> </property_set> </property_collection> </property_set> </oktellcommapper>
В случае, если раздел abonents пуст, это означает что правило применимо для всех вызовов.
Типы возможных дней недели (поле weekday):
public enum ECommType { Sunday = 0, //Воскресенье Monday = 1, //Понедельник Tuesday = 2, //Вторник Wednesday = 3, //Среда Thirsday = 4, //Четверг Friday = 5, //Пятница Saturday = 6 //Суббота }
Типы возможных состояний правил переадресации (поле currentstate):
public enum ERedirectState { Disabled = 0, //Отключенное Enabled = 1, //Включено Active = 2 //Активно }
Типы возможных абонентов, на которых назначено правило переадресации (поле type ветки abonent):
public enum ERedirectAbonentType { ExtNumber = 0, //Внешний номер User = 1, //Пользователь UserDepartment = 2, //Отдел Client = 3, //Клиент ClientGroup = 4 //Группа клиентов }
- void Redirect_SaveRule ( string xml ). Сохраняет на сервере и применяет передаваемое через XML-строку правило переадресации. В случае существования осуществляет горячую замену правила.
Формат передаваемого xml (на примере):
<?xml version="1.0" encoding="utf-16"?> <oktellcommapper version="80710"> <property_set name="redirectrule"> <property_simple key="id" value="8cbb1c0f-f900-41a0-a455-c6b24dac336d" /> <property_cdata key="caption"><![CDATA[Неинтересные люди]]></property_cdata> <property_cdata key="description"><![CDATA[]]></property_cdata> <property_simple key="priority" value="2" /> <property_simple key="enabled" value="1" /> <property_simple key="onlyforredirectstate" value="0" /> <property_simple key="cascaderedirect" value="0" /> <property_simple key="numberdestination" value="31" /> <property_simple key="userid" value="da803f01-ea77-40fa-bc9d-e2efb36fd5a8" /> <property_simple key="currentstate" value="1" name="Enabled" /> <property_collection name="extra" count="2"> <property_set name="abonents"> <property_collection name="abonents" count="2"> <property_set name="abonent"> <property_simple key="type" value="1" name="usReady" /> <property_simple key="number" value="4952778419" /> <property_cdata key="description"><![CDATA[Теща]]></property_cdata> </property_set> <property_set name="abonent"> <property_simple key="type" value="1" name="usReady" /> <property_simple key="id" value="837afb4a-2be1-5ad3-9bba-1422f2dae0c7" /> <property_cdata key="description"><![CDATA[Иван Петрович]]></property_cdata> </property_set> </property_collection> </property_set> <property_set name="time"> <property_collection name="time" count="5"> <property_set name="periodinfo"> <property_simple key="format" value="HH:mm" /> <property_simple key="weekday" value="1" name="Monday" /> <property_simple key="begin" value="00:00" /> <property_simple key="end" value="08:00" /> </property_set> <property_set name="periodinfo"> <property_simple key="format" value="HH:mm" /> <property_simple key="weekday" value="1" name="Monday" /> <property_simple key="begin" value="18:00" /> <property_simple key="end" value="23:59" /> </property_set> <property_set name="periodinfo"> <property_simple key="format" value="HH:mm" /> <property_simple key="weekday" value="2" name="Tuesday" /> <property_simple key="begin" value="00:00" /> <property_simple key="end" value="08:00" /> </property_set> <property_set name="periodinfo"> <property_simple key="format" value="HH:mm" /> <property_simple key="weekday" value="2" name="Tuesday" /> <property_simple key="begin" value="18:00" /> <property_simple key="end" value="23:59" /> </property_set> <property_set name="periodinfo"> <property_simple key="format" value="HH:mm" /> <property_simple key="weekday" value="0" name="Sunday" /> <property_simple key="begin" value="00:00" /> <property_simple key="end" value="23:59" /> </property_set> </property_collection> </property_set> </property_collection> </property_set> </oktellcommapper>
- void Redirect_SetEnabled ( string xml ). Меняет состояние активности для указанного в теле XML-строки правила переадресации.
Формат передаваемого xml (на примере):
<?xml version="1.0" encoding="utf-16"?> <oktellcommapper version="80710"> <property_set> <property_simple key="id" value="3145962b-2141-4b63-960e-9fb7142e0c7b" /> <property_simple key="enabled" value="1" /> </property_set> </oktellcommapper>
- void Redirect_DeleteRules ( string xml ). Удаляет указанные в теле XML-строки правила переадресации.
Формат передаваемого xml (на примере):
<?xml version="1.0" encoding="utf-16"?> <oktellcommapper version="80710"> <property_set> <property_simple key="id" value="3145962b-2141-4b63-960e-9fb7142e0c7b" /> <property_simple key="id" value="cf8330f4-a0bf-4779-9539-ab8ea6c49df7" /> </property_set> </oktellcommapper>