<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="https://docs.yate.ro/wiki/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://docs.yate.ro/wiki/index.php?action=history&amp;feed=atom&amp;title=YAYPM%3ASimple_IVR_with_Inline_Callbacks</id>
		<title>YAYPM:Simple IVR with Inline Callbacks - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://docs.yate.ro/wiki/index.php?action=history&amp;feed=atom&amp;title=YAYPM%3ASimple_IVR_with_Inline_Callbacks"/>
		<link rel="alternate" type="text/html" href="https://docs.yate.ro/wiki/index.php?title=YAYPM:Simple_IVR_with_Inline_Callbacks&amp;action=history"/>
		<updated>2026-05-21T18:59:10Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.19.1</generator>

	<entry>
		<id>https://docs.yate.ro/wiki/index.php?title=YAYPM:Simple_IVR_with_Inline_Callbacks&amp;diff=7426&amp;oldid=prev</id>
		<title>Monica at 11:58, 4 November 2013</title>
		<link rel="alternate" type="text/html" href="https://docs.yate.ro/wiki/index.php?title=YAYPM:Simple_IVR_with_Inline_Callbacks&amp;diff=7426&amp;oldid=prev"/>
				<updated>2013-11-04T11:58:16Z</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;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 11:58, 4 November 2013&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 58:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 58:&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;* [[YAYPM:Bridge and then unbridge]]&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;* [[YAYPM:Bridge and then unbridge]]&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;* [[YAYPM:Bridge and then redirect after a hangup]]&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;* [[YAYPM:Bridge and then redirect after a hangup]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&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;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&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;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;[[Category:IVR]] [[Category:YAYPM]] [[Category:Programmers]] [[Category:Scripting]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Monica</name></author>	</entry>

	<entry>
		<id>https://docs.yate.ro/wiki/index.php?title=YAYPM:Simple_IVR_with_Inline_Callbacks&amp;diff=2224&amp;oldid=prev</id>
		<title>Dana at 13:23, 19 November 2012</title>
		<link rel="alternate" type="text/html" href="https://docs.yate.ro/wiki/index.php?title=YAYPM:Simple_IVR_with_Inline_Callbacks&amp;diff=2224&amp;oldid=prev"/>
				<updated>2012-11-19T13:23:23Z</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;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 13:23, 19 November 2012&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&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;Same example as above, this time with Inline Callbacks. Notice how readablity has improved over bare deferreds version:&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;Same example as above, this time with Inline Callbacks. Notice how readablity has improved over bare deferreds version:&lt;/div&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;&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&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;&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;&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;&amp;#160; #!/usr/bin/python&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; #!/usr/bin/python&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 54:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 53:&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;  logger.setLevel(logging.DEBUG)&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;  logger.setLevel(logging.DEBUG)&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;&amp;#160;&amp;#160; &amp;#160;  yaypm.utils.setup(lambda yate: route(yate))&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;  yaypm.utils.setup(lambda yate: route(yate))&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&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;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&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;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;'''See also'''&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&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;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&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;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;* [[YAYPM:Bridge and then unbridge]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&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;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;* [[YAYPM:Bridge and then redirect after a hangup]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Dana</name></author>	</entry>

	<entry>
		<id>https://docs.yate.ro/wiki/index.php?title=YAYPM:Simple_IVR_with_Inline_Callbacks&amp;diff=1335&amp;oldid=prev</id>
		<title>Dana: Created page with &quot; Same example as above, this time with Inline Callbacks. Notice how readablity has improved over bare deferreds version:     #!/usr/bin/python  from twisted.internet import de...&quot;</title>
		<link rel="alternate" type="text/html" href="https://docs.yate.ro/wiki/index.php?title=YAYPM:Simple_IVR_with_Inline_Callbacks&amp;diff=1335&amp;oldid=prev"/>
				<updated>2012-11-01T10:34:50Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot; Same example as above, this time with Inline Callbacks. Notice how readablity has improved over bare deferreds version:     #!/usr/bin/python  from twisted.internet import de...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&lt;br /&gt;
Same example as above, this time with Inline Callbacks. Notice how readablity has improved over bare deferreds version:&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
 #!/usr/bin/python&lt;br /&gt;
 from twisted.internet import defer&lt;br /&gt;
 from yaypm import AbandonedException&lt;br /&gt;
 import logging, yaypm.utils&lt;br /&gt;
 &lt;br /&gt;
 logger = logging.getLogger('yaypm.examples')&lt;br /&gt;
 &lt;br /&gt;
 @defer.inlineCallbacks&lt;br /&gt;
 def ivr(yate, callid):&lt;br /&gt;
     try:&lt;br /&gt;
         end = yate.onwatch(&amp;quot;chan.hangup&amp;quot;, lambda m : m[&amp;quot;id&amp;quot;] == callid)&lt;br /&gt;
 &lt;br /&gt;
         execute = yield yate.onwatch(&amp;quot;call.execute&amp;quot;,&lt;br /&gt;
                                      lambda m : m[&amp;quot;id&amp;quot;] == callid,&lt;br /&gt;
                                      until = end)&lt;br /&gt;
         targetid = execute[&amp;quot;targetid&amp;quot;]&lt;br /&gt;
 &lt;br /&gt;
         yate.msg(&amp;quot;call.answered&amp;quot;,&lt;br /&gt;
                  {&amp;quot;id&amp;quot;: targetid,&lt;br /&gt;
                   &amp;quot;targetid&amp;quot;: callid}).enqueue()&lt;br /&gt;
 &lt;br /&gt;
         logger.debug(&amp;quot;Call %s answered.&amp;quot; % callid)&lt;br /&gt;
 &lt;br /&gt;
         while True:&lt;br /&gt;
             dtmf = yield yate.onmsg(&amp;quot;chan.dtmf&amp;quot;,&lt;br /&gt;
                                     lambda m : m[&amp;quot;id&amp;quot;] == callid,&lt;br /&gt;
                                     end)&lt;br /&gt;
 &lt;br /&gt;
             logger.debug(&amp;quot;Dtmf %s received.&amp;quot; % dtmf[&amp;quot;text&amp;quot;])&lt;br /&gt;
 &lt;br /&gt;
             yate.msg(&amp;quot;chan.masquerade&amp;quot;,&lt;br /&gt;
                 {&amp;quot;message&amp;quot; : &amp;quot;chan.attach&amp;quot;,&lt;br /&gt;
                  &amp;quot;id&amp;quot;: targetid,&lt;br /&gt;
                  &amp;quot;source&amp;quot;: &amp;quot;wave/play/./sounds/digits/pl/%s.gsm&amp;quot; % \&lt;br /&gt;
                  dtmf[&amp;quot;text&amp;quot;]}).enqueue()&lt;br /&gt;
 &lt;br /&gt;
             dtmf.ret(True)&lt;br /&gt;
 &lt;br /&gt;
     except AbandonedException, e:&lt;br /&gt;
         logger.debug(&amp;quot;Call %s abandoned.&amp;quot; % callid)&lt;br /&gt;
 &lt;br /&gt;
 @defer.inlineCallbacks&lt;br /&gt;
 def route(yate):&lt;br /&gt;
     while True:&lt;br /&gt;
         route = yield yate.onmsg(&amp;quot;call.route&amp;quot;, lambda m : m[&amp;quot;called&amp;quot;] == &amp;quot;ivr&amp;quot;)&lt;br /&gt;
         ivr(yate, route[&amp;quot;id&amp;quot;])&lt;br /&gt;
         route.ret(True, &amp;quot;dumb/&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
 if __name__ in [&amp;quot;__main__&amp;quot;, &amp;quot;__embedded_yaypm_module__&amp;quot;]:&lt;br /&gt;
     logger.setLevel(logging.DEBUG)&lt;br /&gt;
     yaypm.utils.setup(lambda yate: route(yate))&lt;/div&gt;</summary>
		<author><name>Dana</name></author>	</entry>

	</feed>