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="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
<?xml version="1.0" encoding="UTF-8"?> <in xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="sip_user_declare.xsd"> <request context="ctx_from_local" domain="biysk.local" group="loc.gr" iface="240800@biysk.local" force="true" login="240800" password="auto-generation" /> </in>
Ответ:
<?xml version="1.0"?> <out xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="sip_user_declare.xsd"> <result> <success> <alias domain="biysk.local" interface="59d44ea274c7c38c" address="240800" active="true"/> </success> <warnings/> </result> </out>
В некоторых случаях при декларации может прийти код ответа 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="disable_remote_port_control" type="xs:boolean" use="optional"/> <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: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="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="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="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>
Пример 1
Запрос: 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="false" auth="ds" contact="" group="loc.gr" iface="240001@biysk.local" login="240001" password="e304c384" user_agent=""/> <user active="false" auth="ds" contact="" group="loc.gr" iface="240003@biysk.local" login="240003" password="soft_003-test" user_agent=""/> <user active="false" auth="ds" contact="" group="loc.gr" iface="240006@biysk.local" login="240006" password="Bsk_006-test" user_agent=""/> <user active="false" auth="ds" contact="" group="loc.gr" iface="240100@biysk.local" login="240100" password="ooM7eiXi" user_agent=""/> <user active="true" auth="ds" contact="q: 1.0; ip-set: ipset1; on port: 5060; sip <sip:240244@192.168.2.6:5060;transport=UDP;line=45980>;expires=785" group="loc.gr" iface="240244@biysk.local" login="240244" password="ZexeihuP" user_agent="user-agent: Yealink SIP-T28P 2.73.14.3"/> <user active="false" auth="ds" contact="" group="loc.gr" iface="240462@biysk.local" login="240462" password="wooGGooz" user_agent=""/> <user active="false" auth="ds" contact="" group="loc.gr" iface="240464@biysk.local" login="240464" password="zoakoSh8" user_agent=""/> <user active="false" auth="ds" contact="" group="loc.gr" iface="240465@biysk.local" login="240465" password="uica1oeN" user_agent=""/> <user active="false" auth="ds" contact="" group="loc.gr" iface="240469@biysk.local" login="240469" password="Edukae7m" user_agent=""/> <user active="false" auth="ds" contact="" group="loc.gr" iface="240470@biysk.local" login="240470" password="eGhohxie" user_agent=""/> <user active="false" auth="ds" contact="" group="loc.gr" iface="240474@biysk.local" login="240474" password="ssw2rg1404" user_agent=""/> <user active="false" auth="ds" contact="" group="loc.gr" iface="240316@biysk.local" login="240316" password="test2403" user_agent=""/> <user active="false" auth="ds" contact="" group="loc.gr" iface="240467@biysk.local" login="240467" password="ext_467" user_agent=""/> <user active="false" auth="ds" contact="" group="loc.gr" iface="240471@biysk.local" login="240471" password="testnat" user_agent=""/> <user active="false" auth="ds" contact="" group="loc.gr" iface="240473@biysk.local" login="240473" password="ext_073_ssw" user_agent=""/> <user active="false" auth="ds" contact="" group="loc.gr" iface="240475@biysk.local" login="240475" password="jndtn-00" user_agent=""/> </users> </out>
Пример 2
Запрос: http://192.168.1.21:9999/commands/sip_user_show
Показать все данные об SIP абоненте 240475@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="240475@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="240475" auth="ds" auth_qop="true" auto_answer_version="default" contact="q: 1.0; ip-set: ipset1; on port: 5060; sip <sip:240475@192.168.2.6:5060;transport=UDP;line=11697>;expires=627" digest="true" display_encoding="default" domain="biysk.local" dtmf_relay="false" fork_mode="all-contacts" group="loc.gr" id="56089554a52e2f44" iface="240475@biysk.local" last_via="SIP/2.0/UDP 192.168.2.6 branch=z9hG4bKPjp9usYN4gTQLhWsJ-S4llfpMzuBkrLboi, received=192.168.2.6, rport=5060;SIP/2.0/UDP 194.150.140.77 rport=5071, received=194.150.140.77, branch=z9hG4bKv5NNF9FUmtDyD" login="240475" my_from="biysk.local" nat_traversal="false" owner="sip1" password="jndtn-00" referred_by_as_cgpn="false" reg_expire_max="3600" reg_expire_min="90" 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: RG-1402G/1.8.1 SN/VI0C000069 sofia-sip/1.12.10"/> </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; sipsip transport: system (udp_prefer)user-agent: Yealink SIP-T28P 2.73.14.3<sip:240101@192.168.2.6:5060;line=20457>;expires=1121" 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.6:5060;received=192.168.2.6;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; sipsip transport: system (udp_prefer)user-agent: Asterisk PBX 13.1.0~dfsg-1.1ubuntu4.1<sip:240318@192.168.2.6:5060;line=10041>;expires=124" 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.6:5060;received=192.168.2.6;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="240318@biysk.local"/> <registration contact="q: 1.0; ip-set: ipset1; on port: 5060; sipsip transport: system (udp_prefer)user-agent: Brcm-Callctrl/v1.10.3 M5T SIP Stack/4.1.2.2<sip:240462@192.168.2.6:5060;line=27889>;expires=150" 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.6:5060;received=192.168.2.6;rport=5060 SIP/2.0/UDP 10.25.42.31;received=10.25.42.31 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; sipsip transport: system (udp_prefer)user-agent: Brcm-Callctrl/v1.10.3 M5T SIP Stack/4.1.2.2<sip:240469@192.168.2.6:5060;line=63558>;expires=151" 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.6:5060;received=192.168.2.6;rport=5060 SIP/2.0/UDP 10.25.42.31;received=10.25.42.31 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; sipsip transport: system (udp_prefer)user-agent: RG-1404GF-W/1.9.0 SN/VI25002012 sofia-sip/1.12.10<sip:240470@192.168.2.6:5060;line=32114>;expires=1515" 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.6:5060;received=192.168.2.6;rport=5060 SIP/2.0/UDP 10.25.1.23;received=10.25.1.23;rport=5060 last user agent: RG-1404GF-W/1.9.0 SN/VI25002012 sofia-sip/1.12.10 " iface="240470@biysk.local"/> <registration contact="q: 1.0; ip-set: ipset1; on port: 5060; sipsip transport: system (udp_prefer)user-agent: RG-1402G/1.8.1 SN/VI0C000069 sofia-sip/1.12.10<sip:240471@192.168.2.6:5060;line=8035>;expires=731" 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.6:5060;received=192.168.2.6;rport=5060 SIP/2.0/UDP 194.150.140.77:5071;received=194.150.140.77;rport=5071 last user agent: RG-1402G/1.8.1 SN/VI0C000069 sofia-sip/1.12.10 " iface="240471@biysk.local"/> <registration contact="q: 1.0; ip-set: ipset1; on port: 5060; sipsip transport: system (udp_prefer)user-agent: RG-1404GF-W/1.9.0 SN/VI25002012 sofia-sip/1.12.10<sip:240474@192.168.2.6:5060;line=60527>;expires=1515" 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.6:5060;received=192.168.2.6;rport=5060 SIP/2.0/UDP 10.25.1.23;received=10.25.1.23;rport=5060 last user agent: RG-1404GF-W/1.9.0 SN/VI25002012 sofia-sip/1.12.10 " iface="240474@biysk.local"/> <registration contact="q: 1.0; ip-set: ipset1; on port: 5060; sipsip transport: system (udp_prefer)user-agent: RG-1402G/1.8.1 SN/VI0C000069 sofia-sip/1.12.10<sip:240475@192.168.2.6:5060;line=11697>;expires=709" 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.6:5060;received=192.168.2.6;rport=5060 SIP/2.0/UDP 194.150.140.77:5071;received=194.150.140.77;rport=5071 last user agent: RG-1402G/1.8.1 SN/VI0C000069 sofia-sip/1.12.10 " iface="240475@biysk.local"/> <registration contact="q: 1.0; ip-set: ipset1; on port: 5060; sipsip transport: system (udp_prefer)user-agent: Asterisk PBX 13.1.0~dfsg-1.1ubuntu4.1<sip:240500@192.168.2.6:5060;line=30684>;expires=123" 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.6:5060;received=192.168.2.6;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"/> <registration contact="q: 1.0; ip-set: ipset1; on port: 5060; sipsip transport: system (udp_prefer)user-agent: Asterisk PBX 13.1.0~dfsg-1.1ubuntu4.1<sip:240502@192.168.2.6:5060;line=376>;expires=121" 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.6:5060;received=192.168.2.6;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="240502@biysk.local"/> <registration contact="q: 1.0; ip-set: ipset1; on port: 5060; sipsip transport: system (udp_prefer)user-agent: Asterisk PBX 13.1.0~dfsg-1.1ubuntu4.1<sip:240506@192.168.2.6:5060;line=7097>;expires=122" 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.6:5060;received=192.168.2.6;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="240506@biysk.local"/> <registration contact="q: 1.0; ip-set: ipset1; on port: 5060; sipsip transport: system (udp_prefer)user-agent: Asterisk PBX 13.1.0~dfsg-1.1ubuntu4.1<sip:240507@192.168.2.6:5060;line=7072>;expires=123" 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.6:5060;received=192.168.2.6;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="240507@biysk.local"/> <registration contact="q: 1.0; ip-set: ipset1; on port: 5060; sipsip transport: system (udp_prefer)user-agent: Asterisk PBX 13.1.0~dfsg-1.1ubuntu4.1<sip:240512@192.168.2.6:5060;line=24760>;expires=121" 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.6:5060;received=192.168.2.6;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="240512@biysk.local"/> <registration contact="q: 1.0; ip-set: ipset1; on port: 5060; sipsip transport: system (udp_prefer)user-agent: Asterisk PBX 13.1.0~dfsg-1.1ubuntu4.1<sip:240514@192.168.2.6:5060;line=56788>;expires=121" 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.6:5060;received=192.168.2.6;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="240514@biysk.local"/> <registration contact="q: 1.0; ip-set: ipset1; on port: 5060; sipsip transport: system (udp_prefer)user-agent: Asterisk PBX 13.1.0~dfsg-1.1ubuntu4.1<sip:240517@192.168.2.6:5060;line=23163>;expires=121" 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.6:5060;received=192.168.2.6;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="240517@biysk.local"/> <registration contact="q: 1.0; ip-set: ipset1; on port: 5060; sipsip transport: system (udp_prefer)user-agent: Asterisk PBX 13.1.0~dfsg-1.1ubuntu4.1<sip:240519@192.168.2.6:5060;line=4925>;expires=124" 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.6:5060;received=192.168.2.6;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="240519@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="240475@biysk.local"/> </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; sipsip transport: system (udp_prefer)user-agent: RG-1402G/1.8.1 SN/VI0C000069 sofia-sip/1.12.10<sip:240475@192.168.2.6:5060;line=11697>;expires=525" 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.6:5060;received=192.168.2.6;rport=5060 SIP/2.0/UDP 194.150.140.77:5071;received=194.150.140.77;rport=5071 last user agent: RG-1402G/1.8.1 SN/VI0C000069 sofia-sip/1.12.10 " iface="240475@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" use="required"/> </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="disable_remote_port_control" type="booleanType"/> <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="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="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: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="240800@biysk.local" domain="biysk.local"> <login login="login_as_number" password="auto-generation" /> </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>
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="false" info="User isn't registered now"/> <user iface="240502@biysk.local" accessible="true" info="OPTIONS to <sip:240502@192.168.2.6>: 403 Forbidden, cseq: 763070 OPTIONS"/> <user iface="240471@biysk.local" accessible="true" info="OPTIONS to <sip:240471@192.168.2.6>: 200 OK, cseq: 876753 OPTIONS"/> </users> </response> </out>