#include <stdio.h>
#include <string.h>
-#include <asterisk/lock.h>
+//#include <asterisk/lock.h>
+#include <asterisk/utils.h>
#include <asterisk/channel.h>
#include <asterisk/channel_pvt.h>
#include <asterisk/config.h>
#define MAX_VPB_GAIN 12.0
+/*
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
+*/
static char *desc = "VoiceTronix V6PCI/V12PCI/V4PCI API Support";
static char *type = "vpb";
ast_verbose(VERBOSE_PREFIX_4 "%s: handle_owned: putting frame type[%d]subclass[%d], bridge=%p\n",
p->dev, f.frametype, f.subclass, (void *)p->bridge);
+/*
if (option_verbose > 3) ast_verbose("%s: LOCKING in handle_owned [%d]\n", p->dev,res);
res = ast_mutex_lock(&p->lock);
if (option_verbose > 3) ast_verbose("%s: LOCKING count[%d] owner[%d] \n", p->dev, p->lock.__m_count,p->lock.__m_owner);
+*/
{
if (p->bridge) { /* Check what happened, see if we need to report it. */
switch (f.frametype) {
if (endbridge){
res = ast_mutex_unlock(&p->lock);
+/*
if (option_verbose > 3) ast_verbose("%s: unLOCKING in handle_owned [%d]\n", p->dev,res);
+*/
return 0;
}
}
}
res = ast_mutex_unlock(&p->lock);
+/*
if (option_verbose > 3) ast_verbose("%s: unLOCKING in handle_owned [%d]\n", p->dev,res);
+*/
return 0;
}
vpb_put_event(&e);
} else {
/* Start a new monitor */
- int pid = pthread_create(&monitor_thread, NULL, do_monitor, NULL);
+ int pid = ast_pthread_create(&monitor_thread, NULL, do_monitor, NULL);
if (option_verbose > 3)
ast_verbose(VERBOSE_PREFIX_4 "Created new monitor thread %d\n",pid);
if (pid < 0) {
}
*/
+/*
if (option_verbose > 3) ast_verbose("%s: LOCKING in indicate \n", p->dev);
if (option_verbose > 3) ast_verbose("%s: LOCKING count[%d] owner[%d] \n", p->dev, p->lock.__m_count,p->lock.__m_owner);
+*/
ast_mutex_lock(&p->lock);
switch(condition) {
case AST_CONTROL_BUSY:
break;
}
tmp = ast_mutex_unlock(&p->lock);
+/*
if (option_verbose > 3) ast_verbose("%s: unLOCKING in indicate [%d]\n", p->dev,tmp);
+*/
return res;
}
struct vpb_pvt *p = (struct vpb_pvt *)newchan->pvt->pvt;
int res = 0;
+/*
if (option_verbose > 3) ast_verbose("%s: LOCKING in fixup \n", p->dev);
if (option_verbose > 3) ast_verbose("%s: LOCKING count[%d] owner[%d] \n", p->dev, p->lock.__m_count,p->lock.__m_owner);
+*/
ast_mutex_lock(&p->lock);
ast_log(LOG_DEBUG, "New owner for channel %s is %s\n", p->dev, newchan->name);
vpb_indicate(newchan, AST_CONTROL_RINGING);
res= ast_mutex_unlock(&p->lock);
+/*
if (option_verbose > 3) ast_verbose("%s: unLOCKING in fixup [%d]\n", p->dev,res);
+*/
return 0;
}
char s[2];
int res = 0;
+/*
if (option_verbose > 3) ast_verbose("%s: LOCKING in digit \n", p->dev);
if (option_verbose > 3) ast_verbose("%s: LOCKING count[%d] owner[%d] \n", p->dev, p->lock.__m_count,p->lock.__m_owner);
+*/
ast_mutex_lock(&p->lock);
ast_mutex_unlock(&p->play_dtmf_lock);
res = ast_mutex_unlock(&p->lock);
+/*
if (option_verbose > 3) ast_verbose("%s: unLOCKING in digit [%d]\n", p->dev,res);
+*/
return 0;
}
char dialstring[254] = "";
int tmp = 0;
+/*
if (option_verbose > 3) ast_verbose("%s: LOCKING in call \n", p->dev);
if (option_verbose > 3) ast_verbose("%s: LOCKING count[%d] owner[%d] \n", p->dev, p->lock.__m_count,p->lock.__m_owner);
+*/
ast_mutex_lock(&p->lock);
if (s)
if (ast->_state != AST_STATE_DOWN && ast->_state != AST_STATE_RESERVED) {
ast_log(LOG_WARNING, "vpb_call on %s neither down nor reserved!\n", ast->name);
tmp = ast_mutex_unlock(&p->lock);
+/*
if (option_verbose > 3) ast_verbose("%s: unLOCKING in call [%d]\n", p->dev,tmp);
+*/
return -1;
}
if (p->mode != MODE_FXO) /* Station port, ring it. */
}
if (!p->readthread){
- pthread_create(&p->readthread, NULL, do_chanreads, (void *)p);
+ ast_pthread_create(&p->readthread, NULL, do_chanreads, (void *)p);
}
tmp = ast_mutex_unlock(&p->lock);
+/*
if (option_verbose > 3) ast_verbose("%s: unLOCKING in call [%d]\n", p->dev,tmp);
+*/
return res;
}
if (!ast->pvt || !ast->pvt->pvt) {
ast_log(LOG_WARNING, "%s: channel not connected?\n", ast->name);
res = ast_mutex_unlock(&p->lock);
+/*
if (option_verbose > 3) ast_verbose("%s: unLOCKING in hangup [%d]\n", p->dev,res);
+*/
return 0;
}
ast_setstate(ast,AST_STATE_DOWN);
+/*
if (option_verbose > 3) ast_verbose("%s: LOCKING in hangup \n", p->dev);
if (option_verbose > 3) ast_verbose("%s: LOCKING in hangup count[%d] owner[%d] \n", p->dev, p->lock.__m_count,p->lock.__m_owner);
if (option_verbose > 3) ast_verbose("%s: LOCKING pthread_self(%d)\n", p->dev,pthread_self());
+*/
ast_mutex_lock(&p->lock);
if (p->mode != MODE_FXO) {
ast_verbose(VERBOSE_PREFIX_2 "%s: Hangup complete\n", ast->name);
restart_monitor();
+/*
if (option_verbose > 3) ast_verbose("%s: LOCKING in hangup count[%d] owner[%d] \n", p->dev, p->lock.__m_count,p->lock.__m_owner);
+*/
res = ast_mutex_unlock(&p->lock);
+/*
if (option_verbose > 3) ast_verbose("%s: unLOCKING in hangup [%d]\n", p->dev,res);
if (option_verbose > 3) ast_verbose("%s: LOCKING in hangup count[%d] owner[%d] \n", p->dev, p->lock.__m_count,p->lock.__m_owner);
+*/
return 0;
}
VPB_EVENT je;
int ret;
int res = 0;
+/*
if (option_verbose > 3) ast_verbose("%s: LOCKING in answer \n", p->dev);
if (option_verbose > 3) ast_verbose("%s: LOCKING count[%d] owner[%d] \n", p->dev, p->lock.__m_count,p->lock.__m_owner);
+*/
ast_mutex_lock(&p->lock);
if (option_verbose > 3)
if( !p->readthread ){
// res = ast_mutex_unlock(&p->lock);
// ast_verbose("%s: unLOCKING in answer [%d]\n", p->dev,res);
- pthread_create(&p->readthread, NULL, do_chanreads, (void *)p);
+ ast_pthread_create(&p->readthread, NULL, do_chanreads, (void *)p);
} else {
if(option_verbose>3)
ast_verbose(VERBOSE_PREFIX_4 "%s: Record thread already running!!\n",p->dev);
ast_verbose("%s: Re-enabling Loop Drop detection\n",p->dev);
vpb_enable_event(p->handle,VPB_MDROP);
res = ast_mutex_unlock(&p->lock);
+/*
if(option_verbose>3) ast_verbose("%s: unLOCKING in answer [%d]\n", p->dev,res);
+*/
return 0;
}
}
}
-int gain_vector(float g, short *v, int n)
+int a_gain_vector(float g, short *v, int n)
{
int i;
float tmp;
// Apply extra gain !
if( p->txswgain > MAX_VPB_GAIN )
- gain_vector(p->txswgain - MAX_VPB_GAIN , (short*)frame->data, frame->datalen/sizeof(short));
+ a_gain_vector(p->txswgain - MAX_VPB_GAIN , (short*)frame->data, frame->datalen/sizeof(short));
ast_log(LOG_DEBUG, "%s: vpb_write: Applied gain..\n", p->dev);
gettimeofday(&play_buf_time_finish,NULL);
if (play_buf_time_finish.tv_sec == play_buf_time_start.tv_sec){
p->play_buf_time=(int)((play_buf_time_finish.tv_usec-play_buf_time_start.tv_usec)/1000);
- ast_log(LOG_DEBUG, "%s: vpb_write: Timing start(%d) finish(%d)\n", p->dev,play_buf_time_start.tv_usec,play_buf_time_finish.tv_usec);
+// ast_log(LOG_DEBUG, "%s: vpb_write: Timing start(%d) finish(%d)\n", p->dev,play_buf_time_start.tv_usec,play_buf_time_finish.tv_usec);
}
else {
p->play_buf_time=(int)((play_buf_time_finish.tv_sec - play_buf_time_start.tv_sec)*100)+(int)((play_buf_time_finish.tv_usec-play_buf_time_start.tv_usec)/1000);
}
- ast_log(LOG_DEBUG, "%s: vpb_write: Wrote data [%d](%d=>%s) to play_buf in [%d]ms..\n", p->dev,frame->datalen,fmt,ast2vpbformatname(frame->subclass),p->play_buf_time);
+// ast_log(LOG_DEBUG, "%s: vpb_write: Wrote data [%d](%d=>%s) to play_buf in [%d]ms..\n", p->dev,frame->datalen,fmt,ast2vpbformatname(frame->subclass),p->play_buf_time);
}
else {
p->chuck_count++;
}
// Apply extra gain !
if( p->rxswgain > MAX_VPB_GAIN )
- gain_vector(p->rxswgain - MAX_VPB_GAIN , (short*)readbuf, readlen/sizeof(short));
+ a_gain_vector(p->rxswgain - MAX_VPB_GAIN , (short*)readbuf, readlen/sizeof(short));
if (option_verbose > 5) {
ast_verbose("%s: chanreads: applied gain\n", p->dev);
}
return ASTERISK_GPL_KEY;
}
+/*
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
+*/