<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="https://www.m-200.com/base/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>https://www.m-200.com/base/index.php?action=history&amp;feed=atom&amp;title=SIP_%D1%80%D0%B5%D1%88%D0%B5%D0%BD%D0%B8%D1%8F_%D0%BD%D0%B0_%D0%BE%D1%81%D0%BD%D0%BE%D0%B2%D0%B5_%D0%B1%D0%B8%D0%B1%D0%BB%D0%B8%D0%BE%D1%82%D0%B5%D0%BA%D0%B8_PJSIP</id>
		<title>SIP решения на основе библиотеки PJSIP - История изменений</title>
		<link rel="self" type="application/atom+xml" href="https://www.m-200.com/base/index.php?action=history&amp;feed=atom&amp;title=SIP_%D1%80%D0%B5%D1%88%D0%B5%D0%BD%D0%B8%D1%8F_%D0%BD%D0%B0_%D0%BE%D1%81%D0%BD%D0%BE%D0%B2%D0%B5_%D0%B1%D0%B8%D0%B1%D0%BB%D0%B8%D0%BE%D1%82%D0%B5%D0%BA%D0%B8_PJSIP"/>
		<link rel="alternate" type="text/html" href="https://www.m-200.com/base/index.php?title=SIP_%D1%80%D0%B5%D1%88%D0%B5%D0%BD%D0%B8%D1%8F_%D0%BD%D0%B0_%D0%BE%D1%81%D0%BD%D0%BE%D0%B2%D0%B5_%D0%B1%D0%B8%D0%B1%D0%BB%D0%B8%D0%BE%D1%82%D0%B5%D0%BA%D0%B8_PJSIP&amp;action=history"/>
		<updated>2026-05-16T23:33:08Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.19.20</generator>

	<entry>
		<id>https://www.m-200.com/base/index.php?title=SIP_%D1%80%D0%B5%D1%88%D0%B5%D0%BD%D0%B8%D1%8F_%D0%BD%D0%B0_%D0%BE%D1%81%D0%BD%D0%BE%D0%B2%D0%B5_%D0%B1%D0%B8%D0%B1%D0%BB%D0%B8%D0%BE%D1%82%D0%B5%D0%BA%D0%B8_PJSIP&amp;diff=169&amp;oldid=prev</id>
		<title>Pax в 08:38, 24 декабря 2014</title>
		<link rel="alternate" type="text/html" href="https://www.m-200.com/base/index.php?title=SIP_%D1%80%D0%B5%D1%88%D0%B5%D0%BD%D0%B8%D1%8F_%D0%BD%D0%B0_%D0%BE%D1%81%D0%BD%D0%BE%D0%B2%D0%B5_%D0%B1%D0%B8%D0%B1%D0%BB%D0%B8%D0%BE%D1%82%D0%B5%D0%BA%D0%B8_PJSIP&amp;diff=169&amp;oldid=prev"/>
				<updated>2014-12-24T08:38:19Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;a href=&quot;https://www.m-200.com/base/index.php?title=SIP_%D1%80%D0%B5%D1%88%D0%B5%D0%BD%D0%B8%D1%8F_%D0%BD%D0%B0_%D0%BE%D1%81%D0%BD%D0%BE%D0%B2%D0%B5_%D0%B1%D0%B8%D0%B1%D0%BB%D0%B8%D0%BE%D1%82%D0%B5%D0%BA%D0%B8_PJSIP&amp;amp;diff=169&amp;amp;oldid=168&quot;&gt;Внесённые изменения&lt;/a&gt;</summary>
		<author><name>Pax</name></author>	</entry>

	<entry>
		<id>https://www.m-200.com/base/index.php?title=SIP_%D1%80%D0%B5%D1%88%D0%B5%D0%BD%D0%B8%D1%8F_%D0%BD%D0%B0_%D0%BE%D1%81%D0%BD%D0%BE%D0%B2%D0%B5_%D0%B1%D0%B8%D0%B1%D0%BB%D0%B8%D0%BE%D1%82%D0%B5%D0%BA%D0%B8_PJSIP&amp;diff=168&amp;oldid=prev</id>
		<title>Pax в 08:28, 24 декабря 2014</title>
		<link rel="alternate" type="text/html" href="https://www.m-200.com/base/index.php?title=SIP_%D1%80%D0%B5%D1%88%D0%B5%D0%BD%D0%B8%D1%8F_%D0%BD%D0%B0_%D0%BE%D1%81%D0%BD%D0%BE%D0%B2%D0%B5_%D0%B1%D0%B8%D0%B1%D0%BB%D0%B8%D0%BE%D1%82%D0%B5%D0%BA%D0%B8_PJSIP&amp;diff=168&amp;oldid=prev"/>
				<updated>2014-12-24T08:28:55Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr valign='top'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Предыдущая&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Версия 08:28, 24 декабря 2014&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Строка 10:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Строка 10:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Пример сделан из примера к самой библиотеке.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Пример сделан из примера к самой библиотеке.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;code&lt;/del&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;cc&lt;/ins&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;#coding=utf8&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;#coding=utf8&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;# $Id: call.py 2171 2008-07-24 09:01:33Z bennylp $&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;# $Id: call.py 2171 2008-07-24 09:01:33Z bennylp $&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Строка 264:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Строка 264:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; lib = None&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; lib = None&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;/&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;code&lt;/del&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;/&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;cc&lt;/ins&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;[[Категория:SIP]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;[[Категория:SIP]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;[[Категория:М-200. Разработка]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;[[Категория:М-200. Разработка]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Pax</name></author>	</entry>

	<entry>
		<id>https://www.m-200.com/base/index.php?title=SIP_%D1%80%D0%B5%D1%88%D0%B5%D0%BD%D0%B8%D1%8F_%D0%BD%D0%B0_%D0%BE%D1%81%D0%BD%D0%BE%D0%B2%D0%B5_%D0%B1%D0%B8%D0%B1%D0%BB%D0%B8%D0%BE%D1%82%D0%B5%D0%BA%D0%B8_PJSIP&amp;diff=167&amp;oldid=prev</id>
		<title>Pax в 08:28, 24 декабря 2014</title>
		<link rel="alternate" type="text/html" href="https://www.m-200.com/base/index.php?title=SIP_%D1%80%D0%B5%D1%88%D0%B5%D0%BD%D0%B8%D1%8F_%D0%BD%D0%B0_%D0%BE%D1%81%D0%BD%D0%BE%D0%B2%D0%B5_%D0%B1%D0%B8%D0%B1%D0%BB%D0%B8%D0%BE%D1%82%D0%B5%D0%BA%D0%B8_PJSIP&amp;diff=167&amp;oldid=prev"/>
				<updated>2014-12-24T08:28:34Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr valign='top'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Предыдущая&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Версия 08:28, 24 декабря 2014&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Строка 10:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Строка 10:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Пример сделан из примера к самой библиотеке.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Пример сделан из примера к самой библиотеке.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;geshi lang=python lines=0&lt;/del&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;code&lt;/ins&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;#coding=utf8&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;#coding=utf8&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;# $Id: call.py 2171 2008-07-24 09:01:33Z bennylp $&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;# $Id: call.py 2171 2008-07-24 09:01:33Z bennylp $&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Строка 264:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Строка 264:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; lib = None&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; lib = None&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;/&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;geshi&lt;/del&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;/&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;code&lt;/ins&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;[[Категория:SIP]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;[[Категория:SIP]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;[[Категория:М-200. Разработка]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;[[Категория:М-200. Разработка]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Pax</name></author>	</entry>

	<entry>
		<id>https://www.m-200.com/base/index.php?title=SIP_%D1%80%D0%B5%D1%88%D0%B5%D0%BD%D0%B8%D1%8F_%D0%BD%D0%B0_%D0%BE%D1%81%D0%BD%D0%BE%D0%B2%D0%B5_%D0%B1%D0%B8%D0%B1%D0%BB%D0%B8%D0%BE%D1%82%D0%B5%D0%BA%D0%B8_PJSIP&amp;diff=166&amp;oldid=prev</id>
		<title>Pax: Новая страница: «Иногда имеется необходимость реализовать какой нибудь дополнительный функционал для к…»</title>
		<link rel="alternate" type="text/html" href="https://www.m-200.com/base/index.php?title=SIP_%D1%80%D0%B5%D1%88%D0%B5%D0%BD%D0%B8%D1%8F_%D0%BD%D0%B0_%D0%BE%D1%81%D0%BD%D0%BE%D0%B2%D0%B5_%D0%B1%D0%B8%D0%B1%D0%BB%D0%B8%D0%BE%D1%82%D0%B5%D0%BA%D0%B8_PJSIP&amp;diff=166&amp;oldid=prev"/>
				<updated>2014-12-24T08:26:32Z</updated>
		
		<summary type="html">&lt;p&gt;Новая страница: «Иногда имеется необходимость реализовать какой нибудь дополнительный функционал для к…»&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Иногда имеется необходимость реализовать какой нибудь дополнительный функционал для клиентов АТС М-200.С появлением IP телефонии стало возможно доставлять голосовую информацию как от пользователя, так и к пользователю.&lt;br /&gt;
&lt;br /&gt;
Так как М-200 поддерживает протокол SIP есть интересная библиотека реализации SIP стека и Media интерфейса http://www.pjsip.org/. &lt;br /&gt;
По мимо реализации библиотеки на классическом С, есть обертка для языка Python. PJSIP может работать по Linux, MAC, Linux платформами. Библиотека распространяется под лицензией GPLv2.&lt;br /&gt;
&lt;br /&gt;
На сколько это просто, покажет следующий пример. Данный пример регистрируется на станции 192.168.5.48, под номером 7000 с паролем 7000. При входящем на себя вызове проигрывает мелодию из файла /ATS/SOUND/music0.wav, в предответном состоянии в разговорном играется мелодия из файла /ATS/SOUND/music1.wav. При исходящем вызове при ответе играет мелодию из файла /ATS/SOUND/music4.wav&lt;br /&gt;
&lt;br /&gt;
Клавиша a - ответ, с - звонок на номер 100, h - положить трубку.&lt;br /&gt;
&lt;br /&gt;
Пример сделан из примера к самой библиотеке.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;geshi lang=python lines=0&amp;gt;&lt;br /&gt;
#coding=utf8&lt;br /&gt;
# $Id: call.py 2171 2008-07-24 09:01:33Z bennylp $&lt;br /&gt;
#&lt;br /&gt;
# SIP call sample.&lt;br /&gt;
#&lt;br /&gt;
# Copyright (C) 2003-2008 Benny Prijono &amp;lt;benny@prijono.org&amp;gt;&lt;br /&gt;
#&lt;br /&gt;
# This program is free software; you can redistribute it and/or modify&lt;br /&gt;
# it under the terms of the GNU General Public License as published by&lt;br /&gt;
# the Free Software Foundation; either version 2 of the License, or&lt;br /&gt;
# (at your option) any later version.&lt;br /&gt;
#&lt;br /&gt;
# This program is distributed in the hope that it will be useful,&lt;br /&gt;
# but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
# GNU General Public License for more details.&lt;br /&gt;
#&lt;br /&gt;
# You should have received a copy of the GNU General Public License&lt;br /&gt;
# along with this program; if not, write to the Free Software&lt;br /&gt;
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA &lt;br /&gt;
#&lt;br /&gt;
import sys&lt;br /&gt;
import pjsua as pj&lt;br /&gt;
import threading&lt;br /&gt;
&lt;br /&gt;
LOG_LEVEL=0&lt;br /&gt;
current_call = None&lt;br /&gt;
&lt;br /&gt;
# Logging callback&lt;br /&gt;
def log_cb(level, str, len):&lt;br /&gt;
    print str,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Callback to receive events from account&lt;br /&gt;
class MyAccountCallback(pj.AccountCallback):&lt;br /&gt;
&lt;br /&gt;
    def __init__(self, account=None):&lt;br /&gt;
        pj.AccountCallback.__init__(self, account)&lt;br /&gt;
&lt;br /&gt;
    # уведомление о входящем вызове&lt;br /&gt;
    def on_incoming_call(self, call):&lt;br /&gt;
        global current_call &lt;br /&gt;
        if current_call:&lt;br /&gt;
            call.answer(486, &amp;quot;Busy&amp;quot;)&lt;br /&gt;
            return&lt;br /&gt;
            &lt;br /&gt;
        print &amp;quot;Incoming call from &amp;quot;, call.info().remote_uri&lt;br /&gt;
        print &amp;quot;Press 'a' to answer&amp;quot;&lt;br /&gt;
&lt;br /&gt;
        current_call = call&lt;br /&gt;
&lt;br /&gt;
        call_cb = callCallbackIn(current_call)&lt;br /&gt;
        current_call.set_callback(call_cb)&lt;br /&gt;
&lt;br /&gt;
        # отвечаем call progressом&lt;br /&gt;
        current_call.answer(183)&lt;br /&gt;
&lt;br /&gt;
    def wait(self):&lt;br /&gt;
        self.sem = threading.Semaphore(0)&lt;br /&gt;
        self.sem.acquire()&lt;br /&gt;
&lt;br /&gt;
    def on_reg_state(self):&lt;br /&gt;
        if self.sem:&lt;br /&gt;
            if self.account.info().reg_status &amp;gt;= 200:&lt;br /&gt;
                self.sem.release()&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
# Сообщение от входящего вызова&lt;br /&gt;
class callCallbackIn(pj.CallCallback):&lt;br /&gt;
&lt;br /&gt;
    def __init__(self, call=None):&lt;br /&gt;
        pj.CallCallback.__init__(self, call)&lt;br /&gt;
&lt;br /&gt;
    # уведомление об изменении состояния&lt;br /&gt;
    def on_state(self):&lt;br /&gt;
        global current_call&lt;br /&gt;
        print &amp;quot;Call with&amp;quot;, self.call.info().remote_uri,&lt;br /&gt;
        print &amp;quot;is&amp;quot;, self.call.info().state_text,&lt;br /&gt;
        print &amp;quot;last code =&amp;quot;, self.call.info().last_code, &lt;br /&gt;
        print &amp;quot;(&amp;quot; + self.call.info().last_reason + &amp;quot;)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
        # в предответном проключаем одну мелодию&lt;br /&gt;
        if self.call.info().state == pj.CallState.EARLY:&lt;br /&gt;
            call_slot = self.call.info().conf_slot&lt;br /&gt;
            # создаем плеер wav файла&lt;br /&gt;
            self.wav_player_id = pj.Lib.instance().create_player('/ATS/SOUND/music0.wav', loop=False)&lt;br /&gt;
            self.wav_slot = pj.Lib.instance().player_get_slot(self.wav_player_id)&lt;br /&gt;
            # проключаем канал плеера на разговор&lt;br /&gt;
            pj.Lib.instance().conf_connect(self.wav_slot, call_slot)&lt;br /&gt;
&lt;br /&gt;
        # в разговорном подаем другую&lt;br /&gt;
        if self.call.info().state == pj.CallState.CONFIRMED:&lt;br /&gt;
            call_slot = self.call.info().conf_slot&lt;br /&gt;
            # отключаем от музыки&lt;br /&gt;
            pj.Lib.instance().conf_disconnect(self.wav_slot, call_slot)&lt;br /&gt;
            # удаляем плеер&lt;br /&gt;
            pj.Lib.instance().player_destroy(self.wav_player_id)&lt;br /&gt;
            # создаем новый&lt;br /&gt;
            self.wav_player_id = pj.Lib.instance().create_player('/ATS/SOUND/music1.wav', loop=False)&lt;br /&gt;
            self.wav_slot = pj.Lib.instance().player_get_slot(self.wav_player_id)&lt;br /&gt;
            # проключаем канал плеера на разговор&lt;br /&gt;
            pj.Lib.instance().conf_connect(self.wav_slot, call_slot)&lt;br /&gt;
            &lt;br /&gt;
        if self.call.info().state == pj.CallState.DISCONNECTED:&lt;br /&gt;
            current_call = None&lt;br /&gt;
            print 'Current call is', current_call&lt;br /&gt;
&lt;br /&gt;
    # уведомление об изменении состояния системы коммутации&lt;br /&gt;
    def on_media_state(self):           &lt;br /&gt;
        if self.call.info().media_state == pj.MediaState.ACTIVE:&lt;br /&gt;
            print &amp;quot;Media is now active&amp;quot;&lt;br /&gt;
        else:&lt;br /&gt;
            print &amp;quot;Media is inactive&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Сообщение от исходящего вызова&lt;br /&gt;
class callCallbackOut(pj.CallCallback):&lt;br /&gt;
&lt;br /&gt;
    def __init__(self, call=None):&lt;br /&gt;
        pj.CallCallback.__init__(self, call)&lt;br /&gt;
&lt;br /&gt;
    # уведомление об изменении состояния&lt;br /&gt;
    def on_state(self):&lt;br /&gt;
        global current_call&lt;br /&gt;
        print &amp;quot;Call with&amp;quot;, self.call.info().remote_uri,&lt;br /&gt;
        print &amp;quot;is&amp;quot;, self.call.info().state_text,&lt;br /&gt;
        print &amp;quot;last code =&amp;quot;, self.call.info().last_code, &lt;br /&gt;
        print &amp;quot;(&amp;quot; + self.call.info().last_reason + &amp;quot;)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
        # в разговорном подаем другую&lt;br /&gt;
        if self.call.info().state == pj.CallState.CONFIRMED:&lt;br /&gt;
            call_slot = self.call.info().conf_slot&lt;br /&gt;
            # создаем новый&lt;br /&gt;
            self.wav_player_id = pj.Lib.instance().create_player('/ATS/SOUND/music4.wav', loop=False)&lt;br /&gt;
            self.wav_slot = pj.Lib.instance().player_get_slot(self.wav_player_id)&lt;br /&gt;
            # проключаем канал плеера на разговор&lt;br /&gt;
            pj.Lib.instance().conf_connect(self.wav_slot, call_slot)&lt;br /&gt;
           &lt;br /&gt;
&lt;br /&gt;
        if self.call.info().state == pj.CallState.DISCONNECTED:&lt;br /&gt;
            current_call = None&lt;br /&gt;
            print 'Current call is', current_call&lt;br /&gt;
&lt;br /&gt;
    # уведомление об изменении состояния системы коммутации&lt;br /&gt;
    def on_media_state(self):           &lt;br /&gt;
        if self.call.info().media_state == pj.MediaState.ACTIVE:&lt;br /&gt;
            print &amp;quot;Media is now active&amp;quot;&lt;br /&gt;
        else:&lt;br /&gt;
            print &amp;quot;Media is inactive&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Function to make call&lt;br /&gt;
def make_call(uri):&lt;br /&gt;
    try:&lt;br /&gt;
        print &amp;quot;Making call to&amp;quot;, uri&lt;br /&gt;
        return acc.make_call(uri, cb=callCallbackOut())&lt;br /&gt;
    except pj.Error, e:&lt;br /&gt;
        print &amp;quot;Exception: &amp;quot; + str(e)&lt;br /&gt;
        return None&lt;br /&gt;
        &lt;br /&gt;
&lt;br /&gt;
# Create library instance&lt;br /&gt;
lib = pj.Lib()&lt;br /&gt;
&lt;br /&gt;
try:&lt;br /&gt;
    my_media_cfg = pj.MediaConfig()&lt;br /&gt;
    my_media_cfg.clock_rate = 8000&lt;br /&gt;
    my_media_cfg.snd_clock_rate = 44100&lt;br /&gt;
    my_media_cfg.no_vad = True&lt;br /&gt;
    my_media_cfg.quality = 10&lt;br /&gt;
    my_media_cfg.ptime = 0&lt;br /&gt;
    my_media_cfg.max_media_ports = 4&lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
    # Init library with default config and some customized&lt;br /&gt;
    # logging config.&lt;br /&gt;
    lib.init(log_cfg = pj.LogConfig(level=LOG_LEVEL, callback=log_cb), media_cfg = my_media_cfg)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    # Create UDP transport which listens to any available port&lt;br /&gt;
    transport = lib.create_transport(pj.TransportType.UDP, pj.TransportConfig(5060))&lt;br /&gt;
    print &amp;quot;\nListening on&amp;quot;, transport.info().host, &lt;br /&gt;
    print &amp;quot;port&amp;quot;, transport.info().port, &amp;quot;\n&amp;quot;&lt;br /&gt;
    &lt;br /&gt;
    # Start the library&lt;br /&gt;
    lib.start()&lt;br /&gt;
&lt;br /&gt;
    # Create local account&lt;br /&gt;
    acc = lib.create_account(pj.AccountConfig(&amp;quot;192.168.5.48&amp;quot;, &amp;quot;7000&amp;quot;, &amp;quot;7000&amp;quot;))&lt;br /&gt;
&lt;br /&gt;
    acc_cb = MyAccountCallback(acc)&lt;br /&gt;
    acc.set_callback(acc_cb)&lt;br /&gt;
    acc_cb.wait()&lt;br /&gt;
&lt;br /&gt;
    print &amp;quot;\n&amp;quot;&lt;br /&gt;
    print &amp;quot;Registration complete, status=&amp;quot;, acc.info().reg_status, \&lt;br /&gt;
          &amp;quot;(&amp;quot; + acc.info().reg_reason + &amp;quot;)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    my_sip_uri = &amp;quot;sip:&amp;quot; + transport.info().host + \&lt;br /&gt;
                 &amp;quot;:&amp;quot; + str(transport.info().port)&lt;br /&gt;
&lt;br /&gt;
    # Menu loop&lt;br /&gt;
    while True:&lt;br /&gt;
        print &amp;quot;My SIP URI is&amp;quot;, my_sip_uri&lt;br /&gt;
        print &amp;quot;Menu:  m=make call, h=hangup call, a=answer call, c=call 407, q=quit&amp;quot;&lt;br /&gt;
&lt;br /&gt;
        input = sys.stdin.readline().rstrip(&amp;quot;\r\n&amp;quot;)&lt;br /&gt;
        if input == &amp;quot;m&amp;quot;:&lt;br /&gt;
            if current_call:&lt;br /&gt;
                print &amp;quot;Already have another call&amp;quot;&lt;br /&gt;
                continue&lt;br /&gt;
            print &amp;quot;Enter destination URI to call: &amp;quot;, &lt;br /&gt;
            input = sys.stdin.readline().rstrip(&amp;quot;\r\n&amp;quot;)&lt;br /&gt;
            if input == &amp;quot;&amp;quot;:&lt;br /&gt;
                continue&lt;br /&gt;
            lck = lib.auto_lock()&lt;br /&gt;
            current_call = make_call(input)&lt;br /&gt;
            del lck&lt;br /&gt;
&lt;br /&gt;
        elif input == &amp;quot;h&amp;quot;:&lt;br /&gt;
            if not current_call:&lt;br /&gt;
                print &amp;quot;There is no call&amp;quot;&lt;br /&gt;
                continue&lt;br /&gt;
            current_call.hangup()&lt;br /&gt;
&lt;br /&gt;
        elif input == &amp;quot;a&amp;quot;:&lt;br /&gt;
            if not current_call:&lt;br /&gt;
                print &amp;quot;There is no call&amp;quot;&lt;br /&gt;
                continue&lt;br /&gt;
            current_call.answer(200)&lt;br /&gt;
&lt;br /&gt;
        elif input == &amp;quot;c&amp;quot;:&lt;br /&gt;
            lck = lib.auto_lock()&lt;br /&gt;
            current_call = make_call(&amp;quot;sip:100@192.168.5.48&amp;quot;)&lt;br /&gt;
            del lck&lt;br /&gt;
&lt;br /&gt;
        elif input == &amp;quot;q&amp;quot;:&lt;br /&gt;
            break&lt;br /&gt;
&lt;br /&gt;
    # Shutdown the library&lt;br /&gt;
    transport = None&lt;br /&gt;
    acc.delete()&lt;br /&gt;
    acc = None&lt;br /&gt;
    lib.destroy()&lt;br /&gt;
    lib = None&lt;br /&gt;
&lt;br /&gt;
except pj.Error, e:&lt;br /&gt;
    print &amp;quot;Exception: &amp;quot; + str(e)&lt;br /&gt;
    lib.destroy()&lt;br /&gt;
    lib = None&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/geshi&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Категория:SIP]]&lt;br /&gt;
[[Категория:М-200. Разработка]]&lt;/div&gt;</summary>
		<author><name>Pax</name></author>	</entry>

	</feed>