Hc_sip_user - Управление SIP-абонентами
Hc_sip_user_declare
Команда позволяет создать SIP-абонента.
Аналог команды в CoCon:
domain/<DOMAIN>/sip/user/declare
Метод HTTP-запроса:
POST
Шаблон HTTP-запроса:
http://host:port/commands/sip_user_declare
Код HTTP-ответа:
При выполнении команды HTTP-терминал может ответить следующими сообщениями:
- 201 – в случае успеха;
- 206 - в случае прогресса;
- 300 - в случае модала;
- 404 – в случае ошибки.
XSD-схема XML-файла c ответом:
<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:include schemaLocation="error.xsd" />
<!-- causeType-->
<xs:simpleType name="causeType">
<xs:restriction base="xs:string">
<xs:enumeration value="already_exists"/>
<xs:enumeration value="licence_limit"/>
<xs:enumeration value="domain_limit"/>
<xs:enumeration value="no_such_iface"/>
<xs:enumeration value="bad_owner"/>
<xs:enumeration value="bad_group"/>
<xs:enumeration value="cannot_get_iface"/>
</xs:restriction>
</xs:simpleType>
<!-- warningType-->
<xs:complexType name="warningType">
<xs:attribute name="cause" type="causeType"/>
<xs:attribute name="domain" type="xs:string" use="required"/>
<xs:attribute name="interface" type="xs:string" use="required"/>
<xs:attribute name="address" type="xs:string" use="required"/>
</xs:complexType>
<!-- aliasType-->
<xs:complexType name="aliasType">
<xs:attribute name="domain" type="xs:string" use="required"/>
<xs:attribute name="interface" type="xs:string" use="required"/>
<xs:attribute name="address" type="xs:string" use="required"/>
<xs:attribute name="active" type="xs:boolean" use="required"/>
</xs:complexType>
<!-- successType-->
<xs:complexType name="successType">
<xs:sequence>
<xs:element name="alias" type="aliasType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<!-- warningsType-->
<xs:complexType name="warningsType">
<xs:sequence>
<xs:element name="warning" type="warningType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<!-- resultType-->
<xs:complexType name="resultType">
<xs:sequence>
<xs:element name="success" type="successType"/>
<xs:element name="warnings" type="warningsType"/>
</xs:sequence>
</xs:complexType>
<xs:simpleType name = "yesnoType">
<xs:restriction base="xs:string">
<xs:enumeration value="yes" />
<xs:enumeration value="no" />
</xs:restriction>
</xs:simpleType>
<xs:complexType name="valueType">
<xs:attribute name="value" type="xs:string" use="required"/>
</xs:complexType>
<xs:simpleType name="nonEmptyString">
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
</xs:restriction>
</xs:simpleType>
<xs:element name="in">
<xs:complexType>
<xs:all>
<xs:element name="request" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="domain" type="nonEmptyString" use="required" />
<xs:attribute name="context" type="nonEmptyString" use="required" />
<xs:attribute name="modificator" type="nonEmptyString" use="optional" />
<xs:attribute name="group" type="nonEmptyString" use="required" />
<xs:attribute name="iface" type="nonEmptyString" use="required" />
<xs:attribute name="force" type="xs:boolean" use="optional" />
<xs:attribute name="auth_qop" type="yesnoType" use="optional" />
<xs:attribute name="login" type="xs:string" use="optional" /> <!-- login_as_number -->
<xs:attribute name="password" type="xs:string" use="optional" /> <!-- auto_generation -->
<xs:attribute name="address" type="xs:string" use="optional" />
</xs:complexType>
</xs:element>
</xs:all>
</xs:complexType>
</xs:element>
<xs:element name="progress">
<xs:complexType>
<xs:sequence>
<xs:element name="ref" minOccurs="1" maxOccurs="1" type="valueType" />
<xs:element name="text" minOccurs="1" maxOccurs="1" type="valueType" />
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- out -->
<xs:element name="out">
<xs:complexType>
<xs:choice>
<xs:element name="result" type="resultType" />
<xs:element name="error" type="errorType">
<xs:annotation>
<xs:documentation xml:lang="en">
Available error reasons:
- name_is_busy
- context_not_found
- alias_declaration_error
- context_validation_error
- invalid_user_name
- invalid_alias_digits
- cancelled
</xs:documentation>
</xs:annotation>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
Если password равен auto-generation, то пароль будет сгенерирован автоматически.
Пример:
Запрос: http://192.168.1.21:9999/commands/sip_user_declare
<in
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance">
<request domain="biysk.local" context="ctx_from_local" group="loc.gr" iface="240901" address="alias-as-user" auth_qop="yes" login="240901" password="auto-generation"/>
</in>
Ответ: 206
<?xml version="1.0"?>
<progress
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="sip_user_declare.xsd">
<ref value="md1@ecss1:1218"/>
<text value="Declaration for range: 240901@biysk.local..240901@biysk.local (1)"/>
</progress>
В некоторых случаях при декларации может прийти код ответа 300 и xml с описанием модала, например, при декларации уже существующего абонента.
Также может слать код ответа 300 и xml с описанием прогресса.
Hc_sip_user_show
Команда для просмотра настроек SIP-абонента. Позволяет просматривать всю информацию об абоненте (complete="true"), краткую информацию об абоненте (complete="false"), аутентификационную информацию об абоненте (auth="true"). Если аутентификационной информации нет, поля "login", "password" не заполняются.
Аналог команды в CoCon:
domain/<DOMAIN>/sip/user/info
Метод HTTP-запроса:
POST
Шаблон HTTP-запроса:
http://host:port/commands/sip_user_show
Код HTTP-ответа:
При выполнении команды HTTP-терминал может ответить следующими сообщениями:
- 200 – в случае успеха;
- 404 – в случае ошибки.
XSD-схема XML-файла c ответом:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- rfc4028ControlType -->
<xs:simpleType name="rfc4028ControlType">
<xs:restriction base="xs:string">
<xs:enumeration value="true" />
<xs:enumeration value="false" />
<xs:enumeration value="force" />
</xs:restriction>
</xs:simpleType>
<!-- authTypeType -->
<xs:simpleType name="authTypeType">
<xs:restriction base="xs:string">
<xs:enumeration value="none"/>
<xs:enumeration value="always"/>
<xs:enumeration value="register"/>
<xs:enumeration value="ldap"/>
<xs:enumeration value="ds"/>
</xs:restriction>
</xs:simpleType>
<!-- displayEncodingType -->
<xs:simpleType name="displayEncodingType">
<xs:restriction base="xs:string">
<xs:enumeration value="default"/>
<xs:enumeration value="win1251"/>
</xs:restriction>
</xs:simpleType>
<!-- remoteCtrIndicationType -->
<xs:simpleType name="remoteCtrIndicationType">
<xs:restriction base="xs:string">
<xs:enumeration value="pai"/>
<xs:enumeration value="rpi"/>
<xs:enumeration value="none"/>
</xs:restriction>
</xs:simpleType>
<!-- userType -->
<xs:complexType name="userType">
<xs:attribute name="active" type="xs:boolean" use="required"/>
<xs:attribute name="alarm_enable" type="xs:boolean" use="optional"/>
<xs:attribute name="aliases_list" type="xs:string" use="optional"/>
<xs:attribute name="auth" type="authTypeType" use="optional"/>
<xs:attribute name="auth_qop" type="xs:string" use="optional"/>
<xs:attribute name="digest" type="xs:boolean" use="optional"/>
<xs:attribute name="contact" type="xs:string" use="required"/>
<xs:attribute name="domain" type="xs:string" use="optional"/>
<xs:attribute name="fork_mode" type="xs:string" use="optional"/>
<xs:attribute name="fixed_contact" type="xs:string" use="optional"/>
<xs:attribute name="id" type="xs:string" use="optional"/>
<xs:attribute name="group" type="xs:string" use="required"/>
<xs:attribute name="iface" type="xs:string" use="required"/>
<xs:attribute name="login" type="xs:string" use="optional"/>
<xs:attribute name="last_via" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation xml:lang="en">
Format:PROTO_1 HOST_1 PARAM_11=VALUE_11, PARAM_22=VALUE_22,...;PROTO_2 HOST_2 PARAM_21=VALUE_21, PARAM_22=VALUE_22,...;...
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="nat_traversal" type="xs:boolean" use="optional"/>
<xs:attribute name="owner" type="xs:string" use="optional"/>
<xs:attribute name="password" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation xml:lang="en">
In case of strong security restrictions password may be shown as ********
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="referred_by_as_cgpn" type="xs:boolean" use="optional"/>
<xs:attribute name="reg_expire_min" type="xs:integer" use="optional"/>
<xs:attribute name="reg_expire_max" type="xs:integer" use="optional"/>
<xs:attribute name="rfc4028_control" type="rfc4028ControlType" use="optional"/>
<xs:attribute name="routing_context" type="xs:string" use="optional"/>
<xs:attribute name="modificator" type="xs:string" use="optional"/>
<xs:attribute name="symbol_hash_as_is" type="xs:boolean" use="optional"/>
<xs:attribute name="tel_uri_in_diversion" type="xs:boolean" use="optional"/>
<xs:attribute name="tel_uri_using" type="xs:boolean" use="optional"/>
<xs:attribute name="sip_domain" type="xs:string" use="optional"/>
<xs:attribute name="sip_modifications" type="xs:string" use="optional"/>
<xs:attribute name="req100rel" type="xs:boolean" use="optional"/>
<xs:attribute name="dtmf_relay" type="xs:boolean" use="optional"/>
<xs:attribute name="original_cdpn_to" type="xs:boolean" use="optional"/>
<xs:attribute name="my_from" type="xs:string" use="optional"/>
<xs:attribute name="transit" type="xs:string" use="optional"/>
<xs:attribute name="auto_answer_version" type="xs:string" use="optional"/>
<xs:attribute name="display_encoding" type="displayEncodingType" use="optional"/>
<xs:attribute name="remote_ctr_indication" type="remoteCtrIndicationType" use="optional"/>
<xs:attribute name="category_to_sip" type="xs:string" use="optional"/>
<xs:attribute name="registered_domain_to_invite" type="xs:boolean" use="optional"/>
<xs:attribute name="trusted_ip" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation xml:lang="en">
Format:STRICT;IP:PORT;IP1-IP2:PORT_1-PORT2;IP3;...
Sample:false;192.168.23.87:9988;192.168.23.181:9900-9910;192.168.23.0
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="user_agent" type="xs:string" use="optional"/>
</xs:complexType>
<!-- usersType -->
<xs:complexType name="usersType">
<xs:sequence>
<xs:element name="user" type="userType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<!-- in -->
<xs:element name="in">
<xs:complexType>
<xs:all>
<xs:element name="sip" minOccurs="0">
<xs:complexType>
<xs:attribute name="domain" type="xs:string" use="required"/>
<xs:attribute name="group" type="xs:string" use="required"/>
<xs:attribute name="id" type="xs:string" use="optional"/>
<xs:attribute name="complete" type="xs:boolean" use="optional"/>
<xs:attribute name="auth" type="xs:boolean" use="optional"/>
</xs:complexType>
</xs:element>
</xs:all>
</xs:complexType>
</xs:element>
<!-- out -->
<xs:element name="out">
<xs:complexType>
<xs:all>
<xs:element name="users" type="usersType"/>
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
Запрос: http://192.168.1.21:9999/commands/sip_user_show
Показать авторизационные данные всех SIP абонентов в группе loc.gr.
<?xml version="1.0" encoding="UTF-8"?>
<in
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="sip_user_show.xsd">
<sip group="loc.gr" domain="biysk.local" complete="false" auth="true"/>
</in>
Ответ:
<?xml version="1.0"?>
<out
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="sip_user_show.xsd">
<users>
<user active="true" auth="ds" contact="q: 1.0; ip-set: ipset1; on port: 5060; sip <sip:240101@192.168.2.26:5060;transport=UDP;line=20457>;expires=459" group="loc.gr" id="063015220171e7f3" iface="240101@biysk.local" login="240101" password="********" user_agent="user-agent: Yealink SIP-T28P 2.73.14.3"/>
<user active="true" auth="ds" contact="q: 1.0; ip-set: ipset1; on port: 5060; sip <sip:240699@192.168.2.26:5060;transport=UDP;line=42859>;expires=301" group="loc.gr" id="06301521c46e49a6" iface="240699@biysk.local" login="240699" password="********" user_agent="user-agent: Asterisk PBX 13.1.0~dfsg-1.1ubuntu4.1"/>
<user active="true" auth="ds" contact="q: 1.0; ip-set: ipset1; on port: 5060; sip <sip:240462@192.168.2.26:5060;transport=UDP;line=18472>;expires=110" group="loc.gr" id="06301521a9200f53" iface="240462@biysk.local" login="240462" password="********" user_agent="user-agent: Brcm-Callctrl/v1.10.3 M5T SIP Stack/4.1.2.2"/>
<user active="true" auth="ds" contact="q: 1.0; ip-set: ipset1; on port: 5060; sip <sip:240244@192.168.2.26:5060;transport=UDP;line=45980>;expires=892" group="loc.gr" id="06301521a7a2c0aa" iface="240244@biysk.local" login="240244" password="********" user_agent="user-agent: Yealink SIP-T28P 2.73.14.3"/>
...
<user active="false" auth="ds" contact="" group="loc.gr" id="06301521a5b333b6" iface="240100@biysk.local" login="240100" password="********" user_agent=""/>
<user active="false" auth="ds" contact="" group="loc.gr" id="06301521a48b1b0e" iface="240006@biysk.local" login="240006" password="********" user_agent=""/>
<user active="false" auth="ds" contact="" group="loc.gr" id="06301521a182c308" iface="240002@biysk.local" login="240002" password="********" user_agent=""/>
<user active="false" auth="ds" contact="" group="loc.gr" id="063015219eda555a" iface="240001@biysk.local" login="240001" password="********" user_agent=""/>
</users>
</out>
Пример 2
Запрос: http://192.168.1.21:9999/commands/sip_user_show
Показать все данные об SIP абоненте 240501@biysk.local в группе loc.gr.
<?xml version="1.0" encoding="UTF-8"?>
<in xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="sip_user_show.xsd">
<sip group="loc.gr" id="240501@biysk.local" domain="biysk.local" complete="true"/>
</in>
Ответ:
<?xml version="1.0"?>
<out
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="sip_user_show.xsd">
<users>
<user active="true" alarm_enable="false" aliases_list="240501" auth="ds" auth_qop="true" auto_answer_version="default" category_to_sip="default" contact="q: 1.0; ip-set: ipset1; on port: 5060; sip <sip:240501@192.168.2.26:5060;transport=UDP;line=42098>;expires=328" digest="true" display_encoding="default" domain="biysk.local" dtmf_relay="false" fork_mode="all-contacts" group="loc.gr" id="06301521b463510a" iface="240501@biysk.local" last_via="SIP/2.0/UDP 192.168.2.26 branch=z9hG4bKPjzAaAU5198fMYk7vFLjbjDNk4AP.GBS6T, received=192.168.2.26, rport=5060;SIP/2.0/UDP 10.22.128.19 received=10.22.128.19, branch=z9hG4bK53e6dedd" login="240501" my_from="biysk.local" nat_traversal="false" original_cdpn_to="true" owner="sip1" password="********" referred_by_as_cgpn="false" reg_expire_max="3600" reg_expire_min="90" registered_domain_to_invite="true" remote_ctr_indication="rpi" req100rel="false" rfc4028_control="force" routing_context="ctx_from_local" sip_domain="biysk.local" sip_modifications="" symbol_hash_as_is="false" tel_uri_in_diversion="false" transit="" trusted_ip="false" user_agent="user-agent: Asterisk PBX 13.1.0~dfsg-1.1ubuntu4.1"/>
</users>
</out>
Hc_sip_user_registered
Команда выводит список зарегистрированных SIP-абонентов.
Аналог команды в CoCon:
domain/<DOMAIN>/sip/user/registered
Метод HTTP-запроса:
POST
Шаблон HTTP-запроса:
http://host:port/commands/sip_user_registered
Код HTTP-ответа:
При выполнении команды HTTP-терминал может ответить следующими сообщениями:
- 200 – в случае успеха;
- 404 – в случае ошибки.
XSD-схема XML-файла c ответом:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- registrationType -->
<xs:complexType name="registrationType">
<xs:attribute name="iface" type="xs:string" use="required"/>
<xs:attribute name="active" type="xs:boolean" use="required"/>
<xs:attribute name="dynamic" type="xs:boolean" use="required"/>
<xs:attribute name="user" type="xs:string" use="required"/>
<xs:attribute name="sip_domain" type="xs:string" use="required"/>
<xs:attribute name="reg_on" type="xs:string" use="required"/>
<xs:attribute name="contact" type="xs:string" use="required"/>
</xs:complexType>
<!-- registrationsType -->
<xs:complexType name="registrationsType">
<xs:sequence>
<xs:element name="registration" type="registrationType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<!-- in -->
<xs:element name="in">
<xs:complexType>
<xs:all>
<xs:element name="sip" minOccurs="0">
<xs:complexType>
<xs:attribute name="domain" type="xs:string" use="required"/>
<xs:attribute name="group" type="xs:string" use="required"/>
<xs:attribute name="id" type="xs:string" use="optional"/>
</xs:complexType>
</xs:element>
</xs:all>
</xs:complexType>
</xs:element>
<!-- out -->
<xs:element name="out">
<xs:complexType>
<xs:all>
<xs:element name="registrations" type="registrationsType" minOccurs="1" maxOccurs="1"/>
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
Пример 1:
Запрос: http://192.168.1.21:9999/commands/sip_user_registered
<?xml version="1.0" encoding="UTF-8"?>
<in xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="sip_user_registered.xsd">
<sip domain="biysk.local" group="loc.gr"/>
</in>
Ответ:
<?xml version="1.0"?>
<out
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="sip_user_registered.xsd">
<registrations>
<registration contact="q: 1.0; ip-set: ipset1; on port: 5060; sipregistred by node: sip1@ecss1sip transport: system (udp_only)user-agent: Twinkle/1.10.1<sip:240100@192.168.2.14>;expires=555" dynamic="false" reg_on="registered on: node: sip1@ecss1 port: udp 192.168.2.61:5060 last via list: SIP/2.0/UDP 192.168.2.14;received=192.168.2.14;rport=5060 last user agent: Twinkle/1.10.1 " iface="240100@biysk.local"/>
<registration contact="q: 1.0; ip-set: ipset1; on port: 5060; sipregistred by node: sip1@ecss1sip transport: udpuser-agent: Yealink SIP-T28P 2.73.14.3<sip:240101@192.168.2.26:5060;transport=UDP;line=20457>;expires=737" dynamic="false" reg_on="registered on: node: sip1@ecss1 port: udp 192.168.2.62:5060 last via list: SIP/2.0/UDP 192.168.2.26:5060;received=192.168.2.26;rport=5060 SIP/2.0/UDP 192.168.1.201:5062;received=194.150.142.251 last user agent: Yealink SIP-T28P 2.73.14.3 " iface="240101@biysk.local"/>
<registration contact="q: 1.0; ip-set: ipset1; on port: 5060; sipregistred by node: sip1@ecss1sip transport: udpuser-agent: Yealink SIP-T28P 2.73.14.3<sip:240244@192.168.2.26:5060;transport=UDP;line=39810>;expires=734" dynamic="false" reg_on="registered on: node: sip1@ecss1 port: udp 192.168.2.62:5060 last via list: SIP/2.0/UDP 192.168.2.26:5060;received=192.168.2.26;rport=5060 SIP/2.0/UDP 192.168.1.201:5067;received=194.150.142.251 last user agent: Yealink SIP-T28P 2.73.14.3 " iface="240244@biysk.local"/>
<registration contact="q: 1.0; ip-set: ipset1; on port: 5060; sipregistred by node: sip1@ecss1sip transport: udpuser-agent: Brcm-Callctrl/v1.10.3 M5T SIP Stack/4.1.2.2<sip:240462@192.168.2.26:5060;transport=UDP;line=20445>;expires=573" dynamic="false" reg_on="registered on: node: sip1@ecss1 port: udp 192.168.2.62:5060 last via list: SIP/2.0/UDP 192.168.2.26:5060;received=192.168.2.26;rport=5060 SIP/2.0/UDP 10.28.32.131;received=10.28.32.131 last user agent: Brcm-Callctrl/v1.10.3 M5T SIP Stack/4.1.2.2 " iface="240462@biysk.local"/>
<registration contact="q: 1.0; ip-set: ipset1; on port: 5060; sipregistred by node: sip1@ecss1sip transport: system (udp_only)user-agent: TAU-2M.IP/2.0.0.229 SN/VI39005419 sofia-sip/1.12.10<sip:240464@192.168.2.200:5064>;expires=937" dynamic="false" reg_on="registered on: node: sip1@ecss1 port: udp 192.168.2.61:5060 last via list: SIP/2.0/UDP 192.168.2.200:5064;received=192.168.2.200;rport=5064 last user agent: TAU-2M.IP/2.0.0.229 SN/VI39005419 sofia-sip/1.12.10 " iface="240464@biysk.local"/>
<registration contact="q: 1.0; ip-set: ipset1; on port: 5060; sipregistred by node: sip1@ecss1sip transport: system (udp_only)user-agent: TAU-2M.IP/2.0.0.229 SN/VI39005419 sofia-sip/1.12.10<sip:240465@192.168.2.200:5064>;expires=1242" dynamic="false" reg_on="registered on: node: sip1@ecss1 port: udp 192.168.2.61:5060 last via list: SIP/2.0/UDP 192.168.2.200:5064;received=192.168.2.200;rport=5064 last user agent: TAU-2M.IP/2.0.0.229 SN/VI39005419 sofia-sip/1.12.10 " iface="240465@biysk.local"/>
<registration contact="q: 1.0; ip-set: ipset1; on port: 5060; sipregistred by node: sip1@ecss1sip transport: udpuser-agent: TAU-8.IP/2.6.2 SN/VI33023289 sofia-sip/1.12.10<sip:240466@192.168.2.26:5060;transport=UDP;line=26482>;expires=882" dynamic="false" reg_on="registered on: node: sip1@ecss1 port: udp 192.168.2.62:5060 last via list: SIP/2.0/UDP 192.168.2.26:5060;received=192.168.2.26;rport=5060 SIP/2.0/UDP 10.25.20.62;received=10.25.20.62;rport=5060 last user agent: TAU-8.IP/2.6.2 SN/VI33023289 sofia-sip/1.12.10 " iface="240466@biysk.local"/>
<registration contact="q: 1.0; ip-set: ipset1; on port: 5060; sipregistred by node: sip1@ecss1sip transport: udpuser-agent: Brcm-Callctrl/v1.10.3 M5T SIP Stack/4.1.2.2<sip:240469@192.168.2.26:5060;transport=UDP;line=58471>;expires=515" dynamic="false" reg_on="registered on: node: sip1@ecss1 port: udp 192.168.2.62:5060 last via list: SIP/2.0/UDP 192.168.2.26:5060;received=192.168.2.26;rport=5060 SIP/2.0/UDP 10.28.32.131;received=10.28.32.131 last user agent: Brcm-Callctrl/v1.10.3 M5T SIP Stack/4.1.2.2 " iface="240469@biysk.local"/>
<registration contact="q: 1.0; ip-set: ipset1; on port: 5060; sipregistred by node: sip1@ecss1sip transport: udpuser-agent: RG-1404GF-W/1.11.0 SN/VI25002012 sofia-sip/1.12.10<sip:240470@192.168.2.26:5060;transport=UDP;line=1311>;expires=737" dynamic="false" reg_on="registered on: node: sip1@ecss1 port: udp 192.168.2.62:5060 last via list: SIP/2.0/UDP 192.168.2.26:5060;received=192.168.2.26;rport=5060 SIP/2.0/UDP 10.25.1.23:5069;received=10.25.1.23;rport=5069 last user agent: RG-1404GF-W/1.11.0 SN/VI25002012 sofia-sip/1.12.10 " iface="240470@biysk.local"/>
<registration contact="q: 1.0; ip-set: ipset1; on port: 5060; sipregistred by node: sip1@ecss1sip transport: udpuser-agent: RG-1404GF-W/1.11.0 SN/VI25002012 sofia-sip/1.12.10<sip:240474@192.168.2.26:5060;transport=UDP;line=25653>;expires=1595" dynamic="false" reg_on="registered on: node: sip1@ecss1 port: udp 192.168.2.62:5060 last via list: SIP/2.0/UDP 192.168.2.26:5060;received=192.168.2.26;rport=5060 SIP/2.0/UDP 10.25.1.23:5074;received=10.25.1.23;rport=5074 last user agent: RG-1404GF-W/1.11.0 SN/VI25002012 sofia-sip/1.12.10 " iface="240474@biysk.local"/>
<registration contact="q: 1.0; ip-set: ipset1; on port: 5060; sipregistred by node: sip1@ecss1sip transport: udpuser-agent: Asterisk PBX 13.1.0~dfsg-1.1ubuntu4.1<sip:240500@192.168.2.26:5060;transport=UDP;line=30684>;expires=360" dynamic="false" reg_on="registered on: node: sip1@ecss1 port: udp 192.168.2.62:5060 last via list: SIP/2.0/UDP 192.168.2.26:5060;received=192.168.2.26;rport=5060 SIP/2.0/UDP 10.22.128.19:5060;received=10.22.128.19 last user agent: Asterisk PBX 13.1.0~dfsg-1.1ubuntu4.1 " iface="240500@biysk.local"/>
</registrations>
</out>
Если абонент не зарегистрирован, он не будет показан в списке.
Пример 2:
Запрос: http://192.168.1.21:9999/commands/sip_user_registered
<?xml version="1.0" encoding="UTF-8"?>
<in xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="sip_user_registered.xsd">
<sip domain="biysk.local" group="loc.gr" id="240466@biysk.local"/>
</in>
Ответ:200
<?xml version="1.0"?>
<out
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="sip_user_registered.xsd">
<registrations>
<registration contact="q: 1.0; ip-set: ipset1; on port: 5060; sipregistred by node: sip1@ecss1sip transport: udpuser-agent: TAU-8.IP/2.6.2 SN/VI33023289 sofia-sip/1.12.10<sip:240466@192.168.2.26:5060;transport=UDP;line=26482>;expires=1805" dynamic="false" reg_on="registered on: node: sip1@ecss1 port: udp 192.168.2.61:5060 last via list: SIP/2.0/UDP 192.168.2.26:5060;received=192.168.2.26;rport=5060 SIP/2.0/UDP 10.25.20.62;received=10.25.20.62;rport=5060 last user agent: TAU-8.IP/2.6.2 SN/VI33023289 sofia-sip/1.12.10 " iface="240466@biysk.local"/>
</registrations>
</out>
Hc_sip_user_set
Команда позволяет установить или изменить параметры SIP-абонента.
Аналог команды в CoCon:
domain/<DOMAIN>/sip/user/set
Метод HTTP-запроса:
POST
Шаблон HTTP-запроса:
http://host:port/commands/sip_user_set
Код HTTP-ответа:
При выполнении команды HTTP-терминал может ответить следующими сообщениями:
- 201 – в случае успеха;
- 404 – в случае ошибки.
XSD-схема XML-файла c ответом:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- rfc4028ControlType -->
<xs:simpleType name="rfc4028ControlTypeType">
<xs:restriction base="xs:string">
<xs:enumeration value="true" />
<xs:enumeration value="false" />
<xs:enumeration value="force" />
</xs:restriction>
</xs:simpleType>
<!-- authTypeType -->
<xs:simpleType name="authTypeType">
<xs:restriction base="xs:string">
<xs:enumeration value="none"/>
<xs:enumeration value="always"/>
<xs:enumeration value="register"/>
<xs:enumeration value="ldap"/>
<xs:enumeration value="ds"/>
</xs:restriction>
</xs:simpleType>
<!-- displayEncodingValueType -->
<xs:simpleType name="displayEncodingValueType">
<xs:restriction base="xs:string">
<xs:enumeration value="default"/>
<xs:enumeration value="win1251"/>
</xs:restriction>
</xs:simpleType>
<!-- remoteCtrIndicationValueType -->
<xs:simpleType name="remoteCtrIndicationValueType">
<xs:restriction base="xs:string">
<xs:enumeration value="pai"/>
<xs:enumeration value="rpi"/>
<xs:enumeration value="none"/>
</xs:restriction>
</xs:simpleType>
<!-- authType -->
<xs:complexType name="authType">
<xs:attribute name="value" type="authTypeType" use="required"/>
</xs:complexType>
<!-- rfc4028ControlType -->
<xs:complexType name="rfc4028ControlType">
<xs:attribute name="value" type="rfc4028ControlTypeType" use="required"/>
</xs:complexType>
<!-- qopType -->
<xs:complexType name="qopType">
<xs:attribute name="value" type="xs:boolean" use="required"/>
</xs:complexType>
<!-- loginType -->
<xs:complexType name="loginType">
<xs:attribute name="login" type="xs:string" use="required"/>
<xs:attribute name="password" type="xs:string"/>
</xs:complexType>
<!-- stringType -->
<xs:complexType name="stringType">
<xs:attribute name="value" type="xs:string" use="required"/>
</xs:complexType>
<!-- integerType -->
<xs:complexType name="integerType">
<xs:attribute name="value" type="xs:integer" use="required"/>
</xs:complexType>
<!-- booleanType -->
<xs:complexType name="booleanType">
<xs:attribute name="value" type="xs:boolean" use="required"/>
</xs:complexType>
<!-- displayEncodingType -->
<xs:complexType name="displayEncodingType">
<xs:attribute name="value" type="displayEncodingValueType" use="required"/>
</xs:complexType>
<!-- displayEncodingType -->
<xs:complexType name="remoteCtrIndicationType">
<xs:attribute name="value" type="remoteCtrIndicationValueType" use="required"/>
</xs:complexType>
<!-- sipType -->
<xs:complexType name="sipType">
<xs:choice>
<xs:element name="active" type="booleanType"/>
<xs:element name="alarm_enable" type="booleanType"/>
<xs:element name="aliases_list" type="stringType"/>
<xs:element name="auth" type="authType"/>
<xs:element name="auth_qop" type="qopType"/>
<xs:element name="digest" type="booleanType"/>
<xs:element name="contact" type="stringType"/>
<xs:element name="domain" type="stringType"/>
<xs:element name="fork_mode" type="stringType"/>
<xs:element name="fixed_contact" type="stringType"/>
<xs:element name="group" type="stringType"/>
<xs:element name="iface" type="stringType"/>
<xs:element name="login" type="loginType"/>
<xs:element name="nat_traversal" type="booleanType"/>
<xs:element name="owner" type="stringType"/>
<xs:element name="referred_by_as_cgpn" type="booleanType"/>
<xs:element name="reg_expire_min" type="integerType"/>
<xs:element name="reg_expire_max" type="integerType"/>
<xs:element name="rfc4028_control" type="rfc4028ControlType"/>
<xs:element name="routing_context" type="stringType"/>
<xs:element name="modificator" type="stringType"/>
<xs:element name="symbol_hash_as_is" type="booleanType"/>
<xs:element name="trusted_ip" type="stringType">
<xs:annotation>
<xs:documentation xml:lang="en">
Format:STRICT;IP:PORT;IP1-IP2:PORT_1-PORT2;IP3;...
Sample:false;192.168.23.87:9988;192.168.23.181:9900-9910;192.168.23.0
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="tel_uri_in_diversion" type="booleanType"/>
<xs:element name="tel_uri_using" type="booleanType"/>
<xs:element name="sip_domain" type="stringType"/>
<xs:element name="sip_modifications" type="stringType"/>
<xs:element name="req100rel" type="booleanType"/>
<xs:element name="dtmf_relay" type="booleanType"/>
<xs:element name="original_cdpn_to" type="booleanType"/>
<xs:element name="my_from" type="stringType"/>
<xs:element name="transit" type="stringType"/>
<xs:element name="auto_answer_version" type="stringType"/>
<xs:element name="display_encoding" type="displayEncodingType"/>
<xs:element name="remote_ctr_indication" type="remoteCtrIndicationType"/>
<xs:element name="registered_domain_to_invite" type="booleanType"/>
<xs:element name="category_to_sip" type="stringType"/>
</xs:choice>
<xs:attribute name="domain" type="xs:string" use="required"/>
<xs:attribute name="group" type="xs:string" use="required"/>
<xs:attribute name="id" type="xs:string" use="optional"/>
</xs:complexType>
<!-- in -->
<xs:element name="in">
<xs:complexType>
<xs:all>
<xs:element name="sip" type="sipType" minOccurs="0"/>
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
Пример:
Запрос: http://192.168.1.21:9999/commands/sip_user_set
Пример 1:
<?xml version="1.0" encoding="UTF-8"?>
<in
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="sip_user_set.xsd">
<sip group="auth_user" id="240901@biysk.local" domain="biysk.local">
<login login="login_as_number" password="gt6_yrb45" />
</sip>
</in>
Ответ: 201
Пример 2:
<?xml version="1.0" encoding="UTF-8"?>
<in
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="sip_user_set.xsd">
<sip group="auth_user" id="240462@biysk.local" domain="biysk.local">
<reg_expire_max value="850"/>
</sip>
</in>
Ответ: 201
Пример 3:
<?xml version="1.0" encoding="UTF-8"?>
<in
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="sip_user_set.xsd">
<sip group="auth_user" id="240462@biysk.local" domain="biysk.local">
<routing_context value="ctx_from_ewsd"/>
</sip>
</in>
Ответ: 201
Hc_sip_user_remove
Команда позволяет удалить SIP-абонента.
Аналог команды в CoCon:
domain/<DOMAIN>/sip/user/remove
Метод HTTP-запроса:
POST
Шаблон HTTP-запроса:
http://host:port/commands/sip_user_remove
Код HTTP-ответа:
При выполнении команды HTTP-терминал может ответить следующими сообщениями:
- 204 – в случае успеха;
- 300 - в случае запроса подтверждения на удаления SIP-пользователя;
- 404 – в случае ошибки.
XSD-схема XML-файла c ответом:
<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="valueType">
<xs:attribute name="value" type="xs:string" use="required"/>
</xs:complexType>
<!-- nonEmptyString -->
<xs:simpleType name="nonEmptyString">
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
</xs:restriction>
</xs:simpleType>
<!-- aliasType-->
<xs:complexType name="aliasType">
<xs:attribute name="domain" type="nonEmptyString" use="required" />
<xs:attribute name="iface" type="nonEmptyString" use="optional" />
<xs:attribute name="group" type="nonEmptyString" use="required" />
<xs:attribute name="force" type="xs:boolean" use="optional">
<xs:annotation>
<xs:documentation xml:lang="en">
Obsolete attribute. Use force attribute at request element
</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
<!-- aliasesType-->
<xs:complexType name="aliasesType">
<xs:sequence>
<xs:element name="alias" type="aliasType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<!-- in-->
<xs:element name="in">
<xs:complexType>
<xs:sequence>
<xs:element name="request">
<xs:complexType>
<xs:sequence>
<xs:element name="aliases" type="aliasesType"/>
</xs:sequence>
<xs:attribute name="force" type="xs:boolean" use="optional" default="true"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="progress">
<xs:complexType>
<xs:sequence>
<xs:element name="ref" minOccurs="1" maxOccurs="1" type="valueType" />
<xs:element name="text" minOccurs="1" maxOccurs="1" type="valueType" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Пример:
Запрос: http://192.168.1.21:9999/commands/sip_user_remove
Чтобы не отвечать на дополнительные вопросы, необходимо указать параметр force="true".
<?xml version="1.0" encoding="UTF-8"?>
<in xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="sip_user_remove.xsd">
<request>
<aliases>
<alias domain="biysk.local" group="loc.gr" iface="240600@biysk.local" force="true" />
<alias domain="biysk.local" group="loc.gr" iface="240601@biysk.local" force="true" />
</aliases>
</request>
</in>
Ответ: 204
Hc_sip_user_check
Команда позволяет проверить доступность SIP-абонента(ов) посылкой SIP-запроса OPTIONS.
Аналог команды в CoCon:
domain/<DOMAIN>/sip/user/check
Метод HTTP-запроса:
POST
Шаблон HTTP-запроса:
http://host:port/commands/sip_user_check
Код HTTP-ответа:
При выполнении команды HTTP-терминал может ответить следующими сообщениями:
- 204 – в случае успеха;
- 404 – в случае ошибки.
XSD-схема XML-файла c ответом:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- userType -->
<xs:complexType name="userType">
<xs:attribute name="accessible" type="xs:boolean" use="required"/>
<xs:attribute name="iface" type="xs:string" use="required"/>
<xs:attribute name="info" type="xs:string" use="required"/>
</xs:complexType>
<!-- nonEmptyString -->
<xs:simpleType name="nonEmptyString">
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
</xs:restriction>
</xs:simpleType>
<!-- usersType -->
<xs:complexType name="usersType">
<xs:sequence>
<xs:element name="user" type="userType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<!-- requestType -->
<xs:complexType name="requestType">
<xs:sequence>
<xs:element name="user" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="group" type="nonEmptyString" use="required"/>
<xs:attribute name="iface" type="nonEmptyString" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="domain" type="xs:string" use="required"/>
</xs:complexType>
<!-- responseType -->
<xs:complexType name="responseType">
<xs:all>
<xs:element name="users" type="usersType" minOccurs="0" maxOccurs="1"/>
</xs:all>
</xs:complexType>
<!-- in -->
<xs:element name="in">
<xs:complexType>
<xs:all>
<xs:element name="request" type="requestType" minOccurs="1" maxOccurs="1"/>
</xs:all>
</xs:complexType>
</xs:element>
<!-- out -->
<xs:element name="out">
<xs:complexType>
<xs:all>
<xs:element name="response" type="responseType" minOccurs="0" maxOccurs="1"/>
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
Пример
Запрос:
http://192.168.1.21:9999/commands/sip_user_check
<in xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="hc_sip_user_check.xsd">
<request domain="biysk.local">
<user group="loc.gr" iface="240501@biysk.local"/>
<user group="loc.gr" iface="240502@biysk.local"/>
<user group="loc.gr" iface="240471@biysk.local"/>
</request>
</in>
Код ответа:
200
Ответ:
<?xml version="1.0"?>
<out
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="sip_user_check.xsd">
<response>
<users>
<user iface="240501@biysk.local" accessible="true" info="OPTIONS to <sip:240501@192.168.2.26>: 403 Forbidden, cseq: 202973 OPTIONS. Request by node: sip1@ecss1"/>
<user iface="240502@biysk.local" accessible="true" info="OPTIONS to <sip:240502@192.168.2.26>: 403 Forbidden, cseq: 526893 OPTIONS. Request by node: sip1@ecss1"/>
<user iface="240471@biysk.local" accessible="false" info="User isn't registered now"/>
</users>
</response>
</out>