changed long to int (64 bit system's compatibilty)
[lcr.git] / action_vbox.cpp
index b2f06d9..2cd6edc 100644 (file)
@@ -9,13 +9,6 @@
 **                                                                           **
 \*****************************************************************************/ 
 
-#include <stdio.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-#include <unistd.h>
 #include "main.h"
 
 
@@ -80,7 +73,7 @@ void EndpointAppPBX::action_init_vbox_play(void)
 {
        int                     language = e_ext.vbox_language;
        struct route_param      *rparam;
-       struct message          *message;
+       struct lcr_msg          *message;
        struct port_list        *portlist = ea_endpoint->ep_portlist;
 
        /* get extension */
@@ -102,7 +95,7 @@ void EndpointAppPBX::action_init_vbox_play(void)
                e_dtmf = 1;
        message = message_create(ea_endpoint->ep_serial, portlist->port_id, EPOINT_TO_PORT, MESSAGE_CONNECT);
        message_put(message);
-       logmessage(message);
+       logmessage(message->type, &message->param, portlist->port_id, DIRECTION_OUT);
 
        /* initialize the vbox */
        PDEBUG(DEBUG_EPOINT, "EPOINT(%d) initializing answering vbox state\n", ea_endpoint->ep_serial);
@@ -267,13 +260,13 @@ void EndpointAppPBX::action_dialing_vbox_play(void)
 
        if (e_vbox_state == VBOX_STATE_RECORD_RECORD)
        {
-               if (e_extdialing[0] == '1')
+               if (e_extdialing[0] == '1' || e_extdialing[0] == '0')
                {
                        PDEBUG(DEBUG_EPOINT, "EPOINT(%d) stopping recording of announcement.\n", ea_endpoint->ep_serial);
 
                        port = find_port_id(portlist->port_id);
                        if (port)
-                               port->close_record(6000); /* append beep */
+                               port->close_record((e_extdialing[0]=='1')?6000:0, 2000); /* append beep */
                        goto record_ask;
                }
                goto done;
@@ -326,8 +319,8 @@ void EndpointAppPBX::action_dialing_vbox_play(void)
                        port = find_port_id(portlist->port_id);
                        if (port)
                        {
-                               port->close_record(6000); /* append beep */
-                               port->open_record(CODEC_MONO, 1, 5000, e_ext.number, 0, "", 0); /* record announcement, skip the first 5000 samples */
+                               port->close_record(0,0); 
+                               port->open_record(CODEC_MONO, 1, 4000, e_ext.number, 0, "", 0); /* record announcement, skip the first 4000 samples */
                        }
                        e_vbox_state = VBOX_STATE_RECORD_RECORD;
                        if (e_ext.vbox_language)
@@ -609,8 +602,8 @@ void EndpointAppPBX::action_dialing_vbox_play(void)
                        if (e_vbox_index_callerid[0]!='\0' && !!strcmp(e_vbox_index_callerid,"anonymous") && !!strcmp(e_vbox_index_callerid,"unknown"))
                        {
                                set_tone(portlist, "dialing");
-                               SPRINT(e_dialinginfo.number, "extern:%s", e_vbox_index_callerid);
-                               e_extdialing = e_dialinginfo.number;
+                               SPRINT(e_dialinginfo.id, "extern:%s", e_vbox_index_callerid);
+                               e_extdialing = e_dialinginfo.id;
                                e_action = NULL;
                                process_dialing();
                                return;
@@ -668,7 +661,7 @@ void EndpointAppPBX::vbox_handler(void)
        if (e_vbox_display_refresh && e_ext.vbox_display!=VBOX_DISPLAY_OFF)
        {
                char counter[32];
-               struct message *message;
+               struct lcr_msg *message;
 
                SPRINT(counter, "%02d:%02d", e_vbox_counter/60, e_vbox_counter%60);
                if (e_vbox_counter_max)
@@ -679,7 +672,7 @@ void EndpointAppPBX::vbox_handler(void)
                SPRINT(message->param.notifyinfo.display, e_vbox_display, counter);
                PDEBUG(DEBUG_EPOINT, "EPOINT(%d) terminal %s pending display:%s\n", ea_endpoint->ep_serial, e_ext.number, message->param.notifyinfo.display);
                message_put(message);
-               logmessage(message);
+               logmessage(message->type, &message->param, ea_endpoint->ep_portlist->port_id, DIRECTION_OUT);
        }
 }
 
@@ -899,7 +892,7 @@ void EndpointAppPBX::vbox_message_eof(void)
  */
 void EndpointAppPBX::set_tone_vbox(char *tone)
 {
-       struct message *message;
+       struct lcr_msg *message;
 
        if (tone == NULL)
                tone = "";
@@ -927,7 +920,7 @@ void EndpointAppPBX::set_tone_vbox(char *tone)
 void EndpointAppPBX::set_play_vbox(char *file, int offset)
 {
        char filename[256];
-       struct message *message;
+       struct lcr_msg *message;
 
        SPRINT(filename, "%s/%s/%s/vbox/%s", INSTALL_DATA, options.extensions_dir, e_vbox, file);
        
@@ -958,7 +951,7 @@ void EndpointAppPBX::set_play_vbox(char *file, int offset)
  */
 void EndpointAppPBX::set_play_speed(int speed)
 {
-       struct message *message;
+       struct lcr_msg *message;
 
        if (!ea_endpoint->ep_portlist)
        {