login | register
Mon 06 of Oct, 2008 [19:26 UTC]

voip-info.org

NewmanTelOnAsterisk14

Created by: SwitzerBusinessSolutions,Last modification on Mon 20 of Aug, 2007 [17:25 UTC] by pgaz

Using NVFaxDetect (1.0.6), NVBackgroundDetect, etc from Newman Telecom on Asterisk 1.4.0

You may wish to use software fax detection on Asterisk 1.4.0. When you try to compile NVFaxDetect (or the like) on a new version of Asterisk, you'll see a few errors. The following instructions can help you

Source Modifications

For each respective source file, you will need to do the following. Always backup files prior to changing them!

(To comment out lines, just add "//" (without the quotes) at the beginning of the line. For example, "//LOCAL_USER_ADD(u);" is commented out.)
  • Search for and comment out all lines with: "LOCAL_USER_ADD(u);".
  • Search for and comment out all lines with: "LOCAL_USER_REMOVE(u);".
  • Search for and comment out all lines with: "STANDARD_HANGUP_LOCALUSERS;".
  • Add the following line to the very end of the file (change the second parameter/description to something that is applicable): "AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Fax Detection Application");".
  • Save the modified files.

Installation

After making all of your modifications, you will need to install the updated module. This follows the standard installation instructions.

Please do not attempt installation on live production systems without a fallback plan in place.

  • Type "cd /usr/src/asterisk" (or respective Asterisk directory)
  • Build Modules: Type "make".
  • Install Modules: If the build is successful, type "make install".
  • Restart Asterisk: When Asterisk is running, you can do this from your shell prompt with "asterisk -rx "restart now"". Be careful if you have calls active, as this will drop them immediately. If asterisk is not running, skip to the next step.
  • If Asterisk is running, type "asterisk -vvvvr". If Asterisk is not running, type "asterisk -vvvvc". The CLI should appear.
  • Verify Module: From the Asterisk CLI, type "core show application <app name>" (app name = NVFaxDetect or respective Newman Telecom module). If it shows the module's help, you are in business.

If you run into any problems, temporarily remove the module from the modules directory and restart Asterisk.

Patches for NVFaxDetect

app_nv_faxdetect.c.1.4.patch


The following patch makes app_nv_faxdetect.c compile against Asterisk 1.4.x (tested with 1.4.10). It follows the steps described in the previous section.
The compilation process still issues some warnings that shouldn't interfere with the application's behaviour.


--- app_nv_faxdetect.c.old  2006-02-24 04:52:29.000000000 +0100-+
+++ app_nv_faxdetect.c  2007-08-16 03:40:21.000000000 +0200
@@ -77,7 +77,7 @@
static int nv_detectfax_exec(struct ast_channel *chan, void *data)
{
    int res = 0;
-   struct localuser *u; 
+   //struct localuser *u;
    char tmp256 = "\0";
    char *p = NULL;
    char *waitstr = NULL; 
@@ -157,7 +157,7 @@
    ast_log(LOG_DEBUG, "Preparing detect of fax (waitdur=%dms, sildur=%dms, mindur=%dms, maxdur=%dms)\n",
                       waitdur, sildur, mindur, maxdur);

-   LOCAL_USER_ADD(u); 
+   //LOCAL_USER_ADD(u);
   if (chan->_state != AST_STATE_UP && !skipanswer) {
       /* Otherwise answer unless we're supposed to send this while on-hook */
       res = ast_answer(chan);
@@ -307,14 +307,14 @@
   if (dsp)
       ast_dsp_free(dsp);

-   LOCAL_USER_REMOVE(u);
+   //LOCAL_USER_REMOVE(u);

   return res;
}

int unload_module(void)
{
-   STANDARD_HANGUP_LOCALUSERS;
+   //STANDARD_HANGUP_LOCALUSERS;
   return ast_unregister_application(app);
}

@@ -339,3 +339,5 @@
 {
   return ASTERISK_GPL_KEY;
 }
+
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Fax detection application");


Put the file in the apps/ subdirectory of the Asterisk source tree, put the original app_nv_faxdetect.c file in the same dir and then issue the command
patch app_nv_faxdetect.c app_nv_faxdetect.c.1.4.patch

menuselect-deps.in.patch

This small patch adds app_nv_faxdetect to the menu configuration interface of asterisk (make menuselect).


--- menuselect-deps.in.old  2007-08-16 03:32:51.000000000 +0200
+++ menuselect-deps.in  2007-08-16 03:32:32.000000000 +0200
@@ -14,6 +14,7 @@
NBS=@PBX_NBS@
NETSNMP=@PBX_NETSNMP@
NEWT=@PBX_NEWT@
+NV_DETECT=@PBX_NV_DETECT@
OGG=@PBX_OGG@
OSPTK=@PBX_OSPTK@
OSSAUDIO=@PBX_OSS@


To apply the patch, copy the patchfile to the build_tools subdir of the Asterisk source tree, and then issue the command
patch menuselect-deps.in menuselect-deps.in.patch

Fax Installation Services

Switzer Business Solutions, LLC can offer many Asterisk/VoIP services, including fax installation services on your Asterisk system.

Error(s) that many have directed you here:

I'm including the following mostly to be sure that Google will direct people here that search for the compiling error.
  [CC] app_nv_faxdetect.c -> app_nv_faxdetect.o
In file included from app_nv_faxdetect.c:19:
/usr/src/asterisk/include/asterisk/file.h:27:2: #error You must include stdio.h before file.h!
app_nv_faxdetect.c:64: warning: type defaults to `int' in declaration of `STANDARD_LOCAL_USER'
app_nv_faxdetect.c:64: warning: data definition has no type or storage class
app_nv_faxdetect.c:66: warning: type defaults to `int' in declaration of `LOCAL_USER_DECL'
app_nv_faxdetect.c:66: warning: data definition has no type or storage class
app_nv_faxdetect.c: In function `nv_detectfax_exec':
app_nv_faxdetect.c:151: warning: implicit declaration of function `LOCAL_USER_ADD'
app_nv_faxdetect.c:301: warning: implicit declaration of function `LOCAL_USER_REMOVE'
app_nv_faxdetect.c: At top level:
app_nv_faxdetect.c:307: warning: no previous prototype for 'unload_module'
app_nv_faxdetect.c: In function `unload_module':
app_nv_faxdetect.c:308: error: `STANDARD_HANGUP_LOCALUSERS' undeclared (first use in this function)
app_nv_faxdetect.c:308: error: (Each undeclared identifier is reported only once
app_nv_faxdetect.c:308: error: for each function it appears in.)
app_nv_faxdetect.c: At top level:
app_nv_faxdetect.c:313: warning: no previous prototype for 'load_module'
app_nv_faxdetect.c:318: warning: no previous prototype for 'description'
app_nv_faxdetect.c:323: warning: no previous prototype for 'usecount'
app_nv_faxdetect.c: In function `usecount':
app_nv_faxdetect.c:325: warning: implicit declaration of function `STANDARD_USECOUNT'
app_nv_faxdetect.c: At top level:
app_nv_faxdetect.c:330: warning: function declaration isn't a prototype
make[1]: *** [app_nv_faxdetect.o] Error 1
make: *** [apps] Error 2



See also

  • NVFaxDetect - Detects fax, talk, DMTF, and other tones on IAX, SIP, ZAP, and other channels
  • NVBackgroundDetect - Detects fax, talk, DMTF, and other tones on IAX, SIP, ZAP, and other channels
  • NVLineDetect - Detects answer, busy, congestion, dialtone, dead, and others on IAX, SIP, ZAP, and other channels
  • NVFaxEmail - Integration of SpanDSP, RxFax, and e-mail; quick and simple to use without scripts
  • NVMachineDetect - Answering machine, PBX, and talk detection

Comments

Comments Filter
222

333Re: My patch method

by enky, Saturday 20 of October, 2007 [23:58:30 UTC]
Please read:
        Insert "//" (without the quotes) before LOCAL_USER_REMOVE(u); to comment that line <now on line 317> (as seen above)
as:
        Insert "//" (without the quotes) before STANDARD_HANGUP_LOCALUSERS; to comment that line <now on line 317> (as seen above)

222

333My patch method

by ekingme, Friday 07 of September, 2007 [03:29:34 UTC]
I have personally tried these patches and had no luck. I edited the files and got everything to work. I used asterisk-1.4.11 for my build and all directories below are located in the asterisk work direcotry.

Here is what I did:

Copy the app_nv_faxdetect.c file to the apps/ directory.
Edit the app_nv_faxdetect.c file as follows:
         Insert "#include <stdio.h>" (without the quotes) after the line that reads #include <asterisk/lock.h> <line 27>
         Insert "//" (without the quotes) before LOCAL_USER_ADD(u); to comment that line <now on line 160> (as seen above)
         Insert "//" (without the quotes) before LOCAL_USER_REMOVE(u); to comment that line <now on line 310> (as seen above)
         Insert "//" (without the quotes) before LOCAL_USER_REMOVE(u); to comment that line <now on line 317> (as seen above)
         Insert "//" (without the quotes) before int res; to comment that line <now on line 333>
         Insert "//" (without the quotes) before STANDARD_USECOUNT(res); to comment that line <now on line 334>
         Insert "//" (without the quotes) before return res; to comment that line <now on line 335>
         Insert "AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Fax Detection Application");" (without the quotes) at the end of the .c file.
         Save your changes to the .c file.

Edit the file menuselect-deps.in in the build_tools/ directory.
         Insert "NV_DETECT=@PBX_NV_DETECT@" after the line that reads NEWT=@PBX_NEWT@ <line 16>

Run make clean
Run make menuselect
         Make sure app_nv_faxdetect is selected *
Run make
Run make install

You should be all set!

Obviously you will want to test the module before putting it into production.

Good luck! I'd appreciate it if anyone uses the patch procedure I provided if you would let me know if it worked for you!
222

333Directly usable patches added to the wiki page

by lupino3, Thursday 16 of August, 2007 [12:38:17 UTC]
Hello,
inspired by Eric Davis' post, I added two working patches to the wiki page. Eric's patches were not directly usable as I couldn't cut'n'paste the code, so I repeated the process suggested by the wiki page and did an unified diff.

I also created the patch for the small change in menuselect-deps.in that makes the NVFaxDetect app available from the menu.

I left the warnings because I'm not into Asterisk internals and I was afraid to remove something that I shouldn't remove. Feel free to improve the patch if you can do it.

Hope that helps,
Andrea Spadaccini
222

333Patch file for app_nv_faxdetect.c

by edavis, Tuesday 01 of May, 2007 [16:35:51 UTC]
The following patch file will give you all the changes listed bellow. I compiled this and tested it on an Asterisk 1.4.2 code base using SIP trunks only.

1.) Get the app_nv_faxdetect.c source --> wget http://nerdvittles.com/aah2/app_nv_faxdetect.c
2.) Apply the patch bellow --> patch app_nv_faxdetect.c app_nv_faxdetect.c.patch
3.) Copy the patched file to your <asterisk-src>/apps directory
4.) Add the following line (in the correct place) to your <asterisk-src>/build-tools/menuselect-deps.in file --> NV_DETECT=@PBX_NV_DETECT@
         NEWT=@PBX_NEWT@
         NV_DETECT=@PBX_NV_DETECT@
         OGG=@PBX_OGG@
5.) Rebuild asterisk...
5.1) ./bootstrap.sh
5.2) ./configure
5.3) make menuselect (make sure that app_nv_detect is selected)
5.4) make
5.5) make install
6.) Restart asterisk, connect and verify that the app is loaded --> core show application NVFaxDetect
7.) Use the examples posted elsewhere on configuring your dial plan.

{Start of app_nv_faxdetect.c.patch} (sorry that the formatting is weird - I'm not a wiki expert. The solid lines bellow were "----" in the source file.)

32a33
> #include <asterisk/options.h>
39c40
< static char *tdesc = "Newman's fax detection application";

>
69d69
< // Use the second one for recent Asterisk releases
71,75d70
< //#define CALLERID_FIELD callerid
<
< STANDARD_LOCAL_USER;
<
< LOCAL_USER_DECL;
80c75,76
< struct localuser *u;

> //struct localuser *u;
> struct ast_module_user *u;
160c156
< LOCAL_USER_ADD(u);

> u = ast_module_user_add(chan);
310c306
< LOCAL_USER_REMOVE(u);

> ast_module_user_remove(u);
315c311
< int unload_module(void)

> static int unload_module(void)
317,319c313
< STANDARD_HANGUP_LOCALUSERS;
< return ast_unregister_application(app);
< }

> int res;
321,324c315
< int load_module(void)
< {
< return ast_register_application(app, nv_detectfax_exec, synopsis, descrip);
< }

> res = ast_unregister_application(app);
326,329c317
< char *description(void)
< {
< return tdesc;
< }

> ast_module_user_hangup_all();
331,335c319
< int usecount(void)
< {
< int res;
< STANDARD_USECOUNT(res);
< return res;

> return res;
338c322
< char *key()

> static int load_module(void)
340c324
< return ASTERISK_GPL_KEY;

> return ast_register_application(app, nv_detectfax_exec, synopsis, descrip);
341a326,327
>
> AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Fax Detection Application");

{End of app_nv_faxdetect.c.patch}