<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p>Hi,</p>
<p>It seems that you are not a C language developer...</p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">static int sendfile_exec(struct
ast_channel *chan, const char *data)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">{<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US"> size_t fnameLength=
strlen(pbx_builtin_getvar_helper(chan, "MIXMONITOR_FILENAME"));<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US"> char fileName[fnameLength];<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US"> strcpy(fileName,
pbx_builtin_getvar_helper(chan, "MIXMONITOR_FILENAME"));<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US"> char fullCommand[1]= "\0";<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US"> strcat(fullCommand, ID3V2_COMMAND);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US"> strcat(fullCommand, fileName);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US"> system(fullCommand);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US"> return 1;<o:p></o:p></span></p>
<span style="font-family:"Courier New"" lang="EN-US">}</span>
<p>replace by</p>
<span style="font-family:"Courier New"" lang="EN-US">static
int sendfile_exec(struct ast_channel *chan, const char *data)<o:p></o:p></span>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">{</span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US"> char fileName[1024];<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US"> strcpy(fileName,
pbx_builtin_getvar_helper(chan, "MIXMONITOR_FILENAME"));<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US"> char fullCommand[1024+100] = "\0";<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US"> strcat(fullCommand, ID3V2_COMMAND);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US"> strcat(fullCommand, fileName);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US"> system(fullCommand);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US"> return 1;<o:p></o:p></span></p>
<span style="font-family:"Courier New"" lang="EN-US">}<br>
<br>
</span>
<div class="moz-cite-prefix">To catch the coredump file and identify
the C code line, use the option "-g" of the asterisk (you can set
ulimit -c 0, if necessary)<br>
<br>
To make this kind of process with the Asterisk it is better to use
the Dialplan (command System()), use an AGI, or use Voximal
(VoiceXML interpreter for Asterisk).<br>
<br>
Regards,<br>
<br>
<br>
Borja SIXTO from ulex.fr<br>
<br>
<br>
Le 18/08/2017 à 09:38, Yukio Tanaka a écrit :<br>
</div>
<blockquote
cite="mid:0B12E6F2ED56AA428CEFC582E66D80FDD11BE6@mbx025-e1-nj-2.exch025.domain.local"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<meta name="Generator" content="Microsoft Word 14 (filtered
medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{mso-style-priority:34;
margin-top:0cm;
margin-right:0cm;
margin-bottom:0cm;
margin-left:36.0pt;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-fareast-language:EN-US;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
@list l0
{mso-list-id:417945112;
mso-list-type:hybrid;
mso-list-template-ids:570557304 -808388558 269221891 269221893 269221889 269221891 269221893 269221889 269221891 269221893;}
@list l0:level1
{mso-level-start-at:0;
mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:24.75pt;
text-indent:-18.0pt;
font-family:Symbol;
mso-fareast-font-family:Calibri;
mso-bidi-font-family:"Courier New";}
@list l0:level2
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:60.75pt;
text-indent:-18.0pt;
font-family:"Courier New";}
@list l0:level3
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:96.75pt;
text-indent:-18.0pt;
font-family:Wingdings;}
@list l0:level4
{mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:132.75pt;
text-indent:-18.0pt;
font-family:Symbol;}
@list l0:level5
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:168.75pt;
text-indent:-18.0pt;
font-family:"Courier New";}
@list l0:level6
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:204.75pt;
text-indent:-18.0pt;
font-family:Wingdings;}
@list l0:level7
{mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:240.75pt;
text-indent:-18.0pt;
font-family:Symbol;}
@list l0:level8
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:276.75pt;
text-indent:-18.0pt;
font-family:"Courier New";}
@list l0:level9
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:312.75pt;
text-indent:-18.0pt;
font-family:Wingdings;}
ol
{margin-bottom:0cm;}
ul
{margin-bottom:0cm;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal">Hello,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span lang="EN-US">I am in the process of
writing an application for my server. Compilation and
installation run without a hitch. However at runtime the
application provokes a “Segmentation fault (core dumped)”
which shuts down my server. I am clueless as to what sends
the error and even more so on how to fix it so any help
would be appreciated. Below is a copy of my code.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Thanks in advance for
any help.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Yukio<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">/***<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">* Send File (app_sendfile.c) by
Yukio Tanaka (<a class="moz-txt-link-abbreviated" href="mailto:yukio@starcb.com">yukio@starcb.com</a>)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">* <o:p>
</o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US"> * Use at the end of the dialplan in
a monitored call. This will:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">* a) Add call metadatas to the
monitor file.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">* b) Send the file to the
specified server using ssh.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">* <o:p>
</o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US"> ******<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">* Version 0.1 – 2017.07<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">* <o:p>
</o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US"> * - Testing metadata hard writing
for the moment<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">* /!\ At runtime encountering error:
Segmentation fault (core dumped)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">***/<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">#include "asterisk.h"<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">/*ASTERISK_FILE_VERSION(__FILE__,
"$Revision$")*/<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">#include "asterisk/cdr.h"<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">#include "asterisk/logger.h"<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">#include "asterisk/module.h"<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">#include "asterisk/channel.h"<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">#include "asterisk/file.h"<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">#include "asterisk/pbx.h"<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">/* Use id3v2 application to add an
author metadata */<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">const char ID3V2_COMMAND[]= "id3v2
-a \"Algernopp Krieger\" ";<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">static int sendfile_exec(struct
ast_channel *chan, const char *data)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">{<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US"> size_t fnameLength=
strlen(pbx_builtin_getvar_helper(chan,
"MIXMONITOR_FILENAME"));<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US"> char fileName[fnameLength];<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US"> strcpy(fileName,
pbx_builtin_getvar_helper(chan, "MIXMONITOR_FILENAME"));<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US"> char fullCommand[1]= "\0";<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US"> strcat(fullCommand,
ID3V2_COMMAND);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US"> strcat(fullCommand, fileName);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US"> system(fullCommand);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US"> return 1;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">}<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">static int load_module(void)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">{<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">
ast_register_application("SendFile", sendfile_exec, "Send a
recorded call to a server.", "Some description.");<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US"> return AST_MODULE_LOAD_SUCCESS;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">}<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">static int unload_module(void)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">{<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US"> ast_cdr_unregister("SendFile");<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US"> return 0;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">}<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY,
"SendFile")<o:p></o:p></span></p>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Borja SIXTO (co-founder/manager)
Mail: <a class="moz-txt-link-abbreviated" href="mailto:borja.sixto@ulex.fr">borja.sixto@ulex.fr</a>
Tel: +33(0)4 28 35 03 44 Ext. 11
Ulex Innovative Systems | 4 rue des Prairies, 38460 St Romain de Jalionas, France
<a class="moz-txt-link-abbreviated" href="http://www.ulex.fr">www.ulex.fr</a></pre>
</body>
</html>