<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jan 12, 2022 at 12:08 PM bala murugan <<a href="mailto:fightwithme@gmail.com">fightwithme@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Thanks jonathan ,<div><br><div>I am ok in modifying the source and trying . I looked at the source audiohook.c:audio_audiohook_write_list() and i did see the below order <br>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Menlo;color:rgb(24,24,24)"><span style="font-kerning:none;background-color:rgb(255,255,254)">1)AST_LIST_TRAVERSE_SAFE_BEGIN</span><span style="font-kerning:none;color:rgb(0,0,0);background-color:rgb(255,255,254)">(&</span><span style="font-kerning:none;background-color:rgb(255,255,254)">audiohook_list</span><span style="font-kerning:none;color:rgb(0,0,0);background-color:rgb(255,255,254)">-></span><span style="font-kerning:none;background-color:rgb(255,255,254)">spy_list</span><span style="font-kerning:none;color:rgb(0,0,0);background-color:rgb(255,255,254)">, </span><span style="font-kerning:none;background-color:rgb(255,255,254)">audiohook</span><span style="font-kerning:none;color:rgb(0,0,0);background-color:rgb(255,255,254)">, </span><span style="font-kerning:none;background-color:rgb(255,255,254)">list</span><span style="font-kerning:none;color:rgb(0,0,0);background-color:rgb(255,255,254)">) {</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Menlo;color:rgb(24,24,24)"><span style="font-kerning:none;color:rgb(10,22,51);background-color:rgb(255,255,254)"><b>2) if</b></span><span style="font-kerning:none;color:rgb(0,0,0);background-color:rgb(255,255,254)"> (!</span><span style="font-kerning:none;background-color:rgb(255,255,254)">AST_LIST_EMPTY</span><span style="font-kerning:none;color:rgb(0,0,0);background-color:rgb(255,255,254)">(&</span><span style="font-kerning:none;background-color:rgb(255,255,254)">audiohook_list</span><span style="font-kerning:none;color:rgb(0,0,0);background-color:rgb(255,255,254)">-></span><span style="font-kerning:none;background-color:rgb(255,255,254)">whisper_list</span><span style="font-kerning:none;color:rgb(0,0,0);background-color:rgb(255,255,254)">)) {</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Menlo;color:rgb(24,24,24);background-color:rgb(255,255,254)"><span style="font-kerning:none;color:rgb(10,22,51)"><b>3) if</b></span><span style="font-kerning:none;color:rgb(0,0,0)"> (!</span><span style="font-kerning:none">AST_LIST_EMPTY</span><span style="font-kerning:none;color:rgb(0,0,0)">(&</span><span style="font-kerning:none">audiohook_list</span><span style="font-kerning:none;color:rgb(0,0,0)">-></span><span style="font-kerning:none">manipulate_list</span><span style="font-kerning:none;color:rgb(0,0,0)">)) {</span></p></div><div><br></div><div>Are you saying moving this around as below will help or what is the recommended move to try ?<br>1) <span style="font-size:13px;font-family:Menlo;font-kerning:none;color:rgb(10,22,51)"><b>if</b></span><span style="font-size:13px;font-family:Menlo;font-kerning:none;color:rgb(0,0,0)"> (!</span><span style="font-size:13px;color:rgb(24,24,24);font-family:Menlo;font-kerning:none">AST_LIST_EMPTY</span><span style="font-size:13px;font-family:Menlo;font-kerning:none;color:rgb(0,0,0)">(&</span><span style="font-size:13px;color:rgb(24,24,24);font-family:Menlo;font-kerning:none">audiohook_list</span><span style="font-size:13px;font-family:Menlo;font-kerning:none;color:rgb(0,0,0)">-></span><span style="font-size:13px;color:rgb(24,24,24);font-family:Menlo;font-kerning:none">manipulate_list</span><span style="font-size:13px;font-family:Menlo;font-kerning:none;color:rgb(0,0,0)">)) {</span></div><div><span style="font-size:13px;font-family:Menlo;font-kerning:none;color:rgb(0,0,0)">2)</span><span style="font-size:13px;font-family:Menlo;font-kerning:none;color:rgb(10,22,51);background-color:rgb(255,255,254)"><b>if</b></span><span style="font-size:13px;font-family:Menlo;font-kerning:none;color:rgb(0,0,0);background-color:rgb(255,255,254)"> (!</span><span style="font-size:13px;color:rgb(24,24,24);font-family:Menlo;font-kerning:none;background-color:rgb(255,255,254)">AST_LIST_EMPTY</span><span style="font-size:13px;font-family:Menlo;font-kerning:none;color:rgb(0,0,0);background-color:rgb(255,255,254)">(&</span><span style="font-size:13px;color:rgb(24,24,24);font-family:Menlo;font-kerning:none;background-color:rgb(255,255,254)">audiohook_list</span><span style="font-size:13px;font-family:Menlo;font-kerning:none;color:rgb(0,0,0);background-color:rgb(255,255,254)">-></span><span style="font-size:13px;color:rgb(24,24,24);font-family:Menlo;font-kerning:none;background-color:rgb(255,255,254)">whisper_list</span><span style="font-size:13px;font-family:Menlo;font-kerning:none;color:rgb(0,0,0);background-color:rgb(255,255,254)">)) {</span></div><div><span style="font-size:13px;font-family:Menlo;font-kerning:none;color:rgb(0,0,0);background-color:rgb(255,255,254)">3)</span><span style="font-size:13px;color:rgb(24,24,24);font-family:Menlo;font-kerning:none;background-color:rgb(255,255,254)">AST_LIST_TRAVERSE_SAFE_BEGIN</span><span style="font-size:13px;font-family:Menlo;font-kerning:none;color:rgb(0,0,0);background-color:rgb(255,255,254)">(&</span><span style="font-size:13px;color:rgb(24,24,24);font-family:Menlo;font-kerning:none;background-color:rgb(255,255,254)">audiohook_list</span><span style="font-size:13px;font-family:Menlo;font-kerning:none;color:rgb(0,0,0);background-color:rgb(255,255,254)">-></span><span style="font-size:13px;color:rgb(24,24,24);font-family:Menlo;font-kerning:none;background-color:rgb(255,255,254)">spy_list</span><span style="font-size:13px;font-family:Menlo;font-kerning:none;color:rgb(0,0,0);background-color:rgb(255,255,254)">, </span><span style="font-size:13px;color:rgb(24,24,24);font-family:Menlo;font-kerning:none;background-color:rgb(255,255,254)">audiohook</span><span style="font-size:13px;font-family:Menlo;font-kerning:none;color:rgb(0,0,0);background-color:rgb(255,255,254)">, </span><span style="font-size:13px;color:rgb(24,24,24);font-family:Menlo;font-kerning:none;background-color:rgb(255,255,254)">list</span><span style="font-size:13px;font-family:Menlo;font-kerning:none;color:rgb(0,0,0);background-color:rgb(255,255,254)">) {</span><span style="background-color:rgb(255,255,254);color:rgb(0,0,0);font-family:Menlo;font-size:13px"> </span></div><div><span style="background-color:rgb(255,255,254);color:rgb(0,0,0);font-family:Menlo;font-size:13px"><br></span></div><div><span style="background-color:rgb(255,255,254);color:rgb(0,0,0);font-family:Menlo;font-size:13px">Also you have mentioned </span>unexpected consequences from moving these around , any idea what it would be? , will it mess the recording ?</div><div>affect the call quality ? If you know the specific then it will help to see will it be worth trying .</div><div><br></div><div>Also is there an existing patch available for the changes you mentioned?</div></div></div></blockquote><div><br></div><div>Well, I have a patch that I've written in the past to do such a thing at some point, but it was against Asterisk 1.6.2 so that probably isn't something you want.</div><div><br></div><div>Assuming you are looking at master from <a href="https://gerrit.asterisk.org.">https://gerrit.asterisk.org.</a>..</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> /* ---Part_2: Send middle_frame to spy and manipulator lists. middle_frame is guaranteed to be SLINEAR here.*/<br> /* Queue up signed linear frame to each spy */<br> AST_LIST_TRAVERSE_SAFE_BEGIN(&audiohook_list->spy_list, audiohook, list) {<br> ast_audiohook_lock(audiohook);<br> if (audiohook->status != AST_AUDIOHOOK_STATUS_RUNNING) {<br> AST_LIST_REMOVE_CURRENT(list);<br> removed = 1;<br> ast_audiohook_update_status(audiohook, AST_AUDIOHOOK_STATUS_DONE);<br> ast_audiohook_unlock(audiohook);<br> if (ast_channel_is_bridged(chan)) {<br> ast_channel_set_unbridged_nolock(chan, 1);<br> }<br> continue;<br> }<br> audiohook_list_set_hook_rate(audiohook_list, audiohook, &internal_sample_rate);<br> ast_audiohook_write_frame(audiohook, direction, middle_frame);<br> ast_audiohook_unlock(audiohook);<br> }<br> AST_LIST_TRAVERSE_SAFE_END;</blockquote></div><div><br></div><div>This is the spy block. We're going to swap this whole block for the manipulate block</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> /* Pass off frame to manipulate audiohooks */<br> if (!AST_LIST_EMPTY(&audiohook_list->manipulate_list)) {<br> AST_LIST_TRAVERSE_SAFE_BEGIN(&audiohook_list->manipulate_list, audiohook, list) {<br> ast_audiohook_lock(audiohook);<br> if (audiohook->status != AST_AUDIOHOOK_STATUS_RUNNING) {<br> AST_LIST_REMOVE_CURRENT(list);<br> removed = 1;<br> ast_audiohook_update_status(audiohook, AST_AUDIOHOOK_STATUS_DONE);<br> ast_audiohook_unlock(audiohook);<br> /* We basically drop all of our links to the manipulate audiohook and prod it to do it's own destructive things */<br> audiohook->manipulate_callback(audiohook, chan, NULL, direction);<br> if (ast_channel_is_bridged(chan)) {<br> ast_channel_set_unbridged_nolock(chan, 1);<br> }<br> continue;<br> }<br> audiohook_list_set_hook_rate(audiohook_list, audiohook, &internal_sample_rate);<br> /*<br> * Feed in frame to manipulation.<br> */<br> if (!audiohook->manipulate_callback(audiohook, chan, middle_frame, direction)) {<br> /*<br> * XXX FAILURES ARE IGNORED XXX<br> * If the manipulation fails then the frame will be returned in its original state.<br> * Since there are potentially more manipulator callbacks in the list, no action should<br> * be taken here to exit early.<br> */<br> middle_frame_manipulated = 1;<br> }<br> ast_audiohook_unlock(audiohook);<br> }<br> AST_LIST_TRAVERSE_SAFE_END;<br> }</blockquote><div><br></div><div>Just flip them and you should be golden.</div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div><b>Jonathan R. Rose<br></b><span><span>Senior Systems Engineer<br></span></span>Emergency Call Handling<span><span><br></span></span></div></div>Motorola Solutions<br><br></div><div>email: <a href="mailto:jonathan.rose@motorolasolutions.com" target="_blank">jonathan.rose@motorolasolutions.com</a><br></div></div></div></div></div>
<br>
<p dir="ltr" style="line-height:1.8;margin-top:0pt;margin-bottom:0pt"><font size="2"><i><span style="background-color:rgb(255,255,255);font-family:Arial;white-space:pre-wrap">For more information on how and why we collect your personal information, please visit our </span><span style="white-space:pre-wrap;color:rgb(38,50,56);font-family:Roboto,sans-serif"><a href="https://www.motorolasolutions.com/en_us/about/privacy-policy.html?elqTrackId=8980d888905940e39a2613a7a3dcb0a7&elqaid=2786&elqat=2#privacystatement" target="_blank">Privacy Policy</a>.</span></i></font></p>