[asterisk-commits] branch oej/iptos r9293 - in /team/oej/iptos: ./
apps/ cdr/ channels/ channels...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Thu Feb 9 08:39:46 MST 2006
Author: oej
Date: Thu Feb 9 09:39:21 2006
New Revision: 9293
URL: http://svn.digium.com/view/asterisk?rev=9293&view=rev
Log:
Update to SVN trunk head
Added:
team/oej/iptos/funcs/func_sha1.c
- copied unchanged from r9263, trunk/funcs/func_sha1.c
team/oej/iptos/include/asterisk/sha1.h
- copied unchanged from r9263, trunk/include/asterisk/sha1.h
team/oej/iptos/sha1.c
- copied unchanged from r9263, trunk/sha1.c
Removed:
team/oej/iptos/apps/app_intercom.c
team/oej/iptos/apps/app_sql_postgres.c
Modified:
team/oej/iptos/ (props changed)
team/oej/iptos/Makefile
team/oej/iptos/apps/Makefile
team/oej/iptos/apps/app_macro.c
team/oej/iptos/cdr/Makefile
team/oej/iptos/channel.c
team/oej/iptos/channels/Makefile
team/oej/iptos/channels/chan_iax2.c
team/oej/iptos/channels/chan_local.c
team/oej/iptos/channels/chan_misdn.c
team/oej/iptos/channels/chan_misdn_config.c
team/oej/iptos/channels/chan_nbs.c
team/oej/iptos/channels/chan_oss.c
team/oej/iptos/channels/chan_sip.c
team/oej/iptos/channels/chan_vpb.c
team/oej/iptos/channels/chan_zap.c
team/oej/iptos/channels/misdn/Makefile
team/oej/iptos/channels/misdn/chan_misdn_config.h
team/oej/iptos/channels/misdn/isdn_lib.c
team/oej/iptos/channels/misdn/isdn_lib.h
team/oej/iptos/channels/misdn/isdn_lib_intern.h
team/oej/iptos/channels/misdn/isdn_msg_parser.c
team/oej/iptos/configs/misdn.conf.sample
team/oej/iptos/doc/misdn.txt
team/oej/iptos/dsp.c
team/oej/iptos/enum.c
team/oej/iptos/file.c
team/oej/iptos/funcs/Makefile
team/oej/iptos/include/asterisk/utils.h
team/oej/iptos/logger.c
team/oej/iptos/utils.c
Propchange: team/oej/iptos/
------------------------------------------------------------------------------
--- branch-1.2-blocked (added)
+++ branch-1.2-blocked Thu Feb 9 09:39:21 2006
@@ -1,0 +1,1 @@
+/branches/1.2:7490,7497,7517,7529,7546,7550,7552,7557,7580,7586,7595,7605,7641,7663,7706,7738,7771,7792,7812,7870-7871,7898-7900,7915,7960,7965,7970,7976,8047,8112,8124,8134,8394,8412,8414,8418,8429,8433,8445,8562,8573,8600,8619,8666,8808,9073,9262
Propchange: team/oej/iptos/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.
Propchange: team/oej/iptos/
('svnmerge-blocked' removed)
Propchange: team/oej/iptos/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Feb 9 09:39:21 2006
@@ -1,1 +1,1 @@
-/trunk:1-9074
+/trunk:1-9291
Modified: team/oej/iptos/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/iptos/Makefile?rev=9293&r1=9292&r2=9293&view=diff
==============================================================================
--- team/oej/iptos/Makefile (original)
+++ team/oej/iptos/Makefile Thu Feb 9 09:39:21 2006
@@ -3,7 +3,7 @@
#
# Top level Makefile
#
-# Copyright (C) 1999-2005, Mark Spencer
+# Copyright (C) 1999-2006, Digium, Inc.
#
# Mark Spencer <markster at digium.com>
#
@@ -327,8 +327,6 @@
ifneq ($(wildcard .svn),)
ASTERISKVERSIONNUM=999999
ASTERISKVERSION=SVN-$(shell build_tools/make_svn_branch_name)
- else
- ASTERISKVERSIONNUM=000000
endif
endif
@@ -351,7 +349,7 @@
astmm.o enum.o srv.o dns.o aescrypt.o aestab.o aeskey.o \
utils.o plc.o jitterbuf.o dnsmgr.o devicestate.o \
netsock.o slinfactory.o ast_expr2.o ast_expr2f.o \
- cryptostub.o
+ cryptostub.o sha1.o
ifeq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/sys/poll.h),)
OBJS+= poll.o
@@ -945,4 +943,4 @@
rm -rf $(DESTDIR)$(ASTSPOOLDIR)
rm -rf $(DESTDIR)$(ASTETCDIR)
rm -rf $(DESTDIR)$(ASTLOGDIR)
-
+
Modified: team/oej/iptos/apps/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/iptos/apps/Makefile?rev=9293&r1=9292&r2=9293&view=diff
==============================================================================
--- team/oej/iptos/apps/Makefile (original)
+++ team/oej/iptos/apps/Makefile Thu Feb 9 09:39:21 2006
@@ -26,12 +26,6 @@
app_userevent.so app_url.so app_verbose.so app_voicemail.so \
app_waitforring.so app_waitforsilence.so app_while.so app_zapateller.so \
app_morsecode.so
-
-#
-# Obsolete things...
-#
-#APPS+=app_sql_postgres.so
-#APPS+=app_sql_odbc.so
#
# Experimental things
@@ -97,15 +91,6 @@
app_curl.so: app_curl.o
$(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} $(CURLLIBS)
-app_sql_postgres.o: app_sql_postgres.c
- $(CC) -pipe -I$(CROSS_COMPILE_TARGET)/usr/local/pgsql/include -I$(CROSS_COMPILE_TARGET)/usr/include/postgresql $(CFLAGS) -c -o app_sql_postgres.o app_sql_postgres.c
-
-app_sql_postgres.so: app_sql_postgres.o
- $(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} -L/usr/local/pgsql/lib -lpq
-
-app_sql_odbc.so: app_sql_odbc.o
- $(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} -lodbc
-
look: look.c
$(CC) -pipe -O6 -g look.c -o look -lncurses
Modified: team/oej/iptos/apps/app_macro.c
URL: http://svn.digium.com/view/asterisk/team/oej/iptos/apps/app_macro.c?rev=9293&r1=9292&r2=9293&view=diff
==============================================================================
--- team/oej/iptos/apps/app_macro.c (original)
+++ team/oej/iptos/apps/app_macro.c Thu Feb 9 09:39:21 2006
@@ -107,7 +107,7 @@
char oldcontext[AST_MAX_CONTEXT] = "";
int offset, depth = 0;
int setmacrocontext=0;
- int autoloopflag;
+ int autoloopflag, dead = 0;
char *save_macro_exten;
char *save_macro_context;
@@ -208,8 +208,8 @@
break;
}
switch(res) {
- case MACRO_EXIT_RESULT:
- res = 0;
+ case MACRO_EXIT_RESULT:
+ res = 0;
goto out;
case AST_PBX_KEEPALIVE:
if (option_debug)
@@ -223,6 +223,7 @@
ast_log(LOG_DEBUG, "Spawn extension (%s,%s,%d) exited non-zero on '%s' in macro '%s'\n", chan->context, chan->exten, chan->priority, chan->name, macro);
else if (option_verbose > 1)
ast_verbose( VERBOSE_PREFIX_2 "Spawn extension (%s, %s, %d) exited non-zero on '%s' in macro '%s'\n", chan->context, chan->exten, chan->priority, chan->name, macro);
+ dead = 1;
goto out;
}
}
@@ -242,37 +243,44 @@
out:
/* Reset the depth back to what it was when the routine was entered (like if we called Macro recursively) */
snprintf(depthc, sizeof(depthc), "%d", depth);
- pbx_builtin_setvar_helper(chan, "MACRO_DEPTH", depthc);
-
- ast_set2_flag(chan, autoloopflag, AST_FLAG_IN_AUTOLOOP);
- for (x=1; x<argc; x++) {
+ if (!dead) {
+ pbx_builtin_setvar_helper(chan, "MACRO_DEPTH", depthc);
+
+ ast_set2_flag(chan, autoloopflag, AST_FLAG_IN_AUTOLOOP);
+ }
+
+ for (x = 1; x < argc; x++) {
/* Restore old arguments and delete ours */
snprintf(varname, sizeof(varname), "ARG%d", x);
if (oldargs[x]) {
- pbx_builtin_setvar_helper(chan, varname, oldargs[x]);
+ if (!dead)
+ pbx_builtin_setvar_helper(chan, varname, oldargs[x]);
free(oldargs[x]);
- } else {
+ } else if (!dead) {
pbx_builtin_setvar_helper(chan, varname, NULL);
}
}
/* Restore macro variables */
- pbx_builtin_setvar_helper(chan, "MACRO_EXTEN", save_macro_exten);
+ if (!dead) {
+ pbx_builtin_setvar_helper(chan, "MACRO_EXTEN", save_macro_exten);
+ pbx_builtin_setvar_helper(chan, "MACRO_CONTEXT", save_macro_context);
+ pbx_builtin_setvar_helper(chan, "MACRO_PRIORITY", save_macro_priority);
+ }
if (save_macro_exten)
free(save_macro_exten);
- pbx_builtin_setvar_helper(chan, "MACRO_CONTEXT", save_macro_context);
if (save_macro_context)
free(save_macro_context);
- pbx_builtin_setvar_helper(chan, "MACRO_PRIORITY", save_macro_priority);
if (save_macro_priority)
free(save_macro_priority);
- if (setmacrocontext) {
+
+ if (!dead && setmacrocontext) {
chan->macrocontext[0] = '\0';
chan->macroexten[0] = '\0';
chan->macropriority = 0;
}
- if (!strcasecmp(chan->context, fullmacro)) {
+ if (!dead && !strcasecmp(chan->context, fullmacro)) {
/* If we're leaving the macro normally, restore original information */
chan->priority = oldpriority;
ast_copy_string(chan->context, oldcontext, sizeof(chan->context));
@@ -292,7 +300,8 @@
}
}
- pbx_builtin_setvar_helper(chan, "MACRO_OFFSET", save_macro_offset);
+ if (!dead)
+ pbx_builtin_setvar_helper(chan, "MACRO_OFFSET", save_macro_offset);
if (save_macro_offset)
free(save_macro_offset);
LOCAL_USER_REMOVE(u);
Modified: team/oej/iptos/cdr/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/iptos/cdr/Makefile?rev=9293&r1=9292&r2=9293&view=diff
==============================================================================
--- team/oej/iptos/cdr/Makefile (original)
+++ team/oej/iptos/cdr/Makefile Thu Feb 9 09:39:21 2006
@@ -45,11 +45,11 @@
#
# FreeTDS stuff...
#
-ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/tds.h)$(wildcard $(CROSS_COMPILE_TARGET)/usr/local/include/tds.h),)
- ifeq ($(shell grep -s TDS_VERSION_NO $(CROSS_COMPILE_TARGET)/usr/include/tdsver.h $(CROSS_COMPILE_TARGET)/usr/local/include/tdsver.h | grep -c 0.63),1)
+ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/tds.h)$(wildcard $(CROSS_COMPILE_TARGET)/usr/local/include/tds.h)$(wildcard $(CROSS_COMPILE_TARGET)/usr/include/freetds/tds.h),)
+ ifeq ($(shell grep -s TDS_VERSION_NO $(CROSS_COMPILE_TARGET)/usr/include/tdsver.h $(CROSS_COMPILE_TARGET)/usr/local/include/tdsver.h $(CROSS_COMPILE_TARGET)/usr/include/freetds/tdsver.h | grep -c 0.63),1)
CFLAGS += -DFREETDS_0_63
else
- ifeq ($(shell grep -s TDS_VERSION_NO $(CROSS_COMPILE_TARGET)/usr/include/tdsver.h $(CROSS_COMPILE_TARGET)/usr/local/include/tdsver.h | grep -c 0.62),1)
+ ifeq ($(shell grep -s TDS_VERSION_NO $(CROSS_COMPILE_TARGET)/usr/include/tdsver.h $(CROSS_COMPILE_TARGET)/usr/local/include/tdsver.h $(CROSS_COMPILE_TARGET)/usr/include/freetds/tdsver.h | grep -c 0.62),1)
CFLAGS += -DFREETDS_0_62
else
CFLAGS += -DFREETDS_PRE_0_62
Modified: team/oej/iptos/channel.c
URL: http://svn.digium.com/view/asterisk/team/oej/iptos/channel.c?rev=9293&r1=9292&r2=9293&view=diff
==============================================================================
--- team/oej/iptos/channel.c (original)
+++ team/oej/iptos/channel.c Thu Feb 9 09:39:21 2006
@@ -72,6 +72,7 @@
#include "asterisk/app.h"
#include "asterisk/transcap.h"
#include "asterisk/devicestate.h"
+#include "asterisk/sha1.h"
struct channel_spy_trans {
int last_format;
Modified: team/oej/iptos/channels/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/iptos/channels/Makefile?rev=9293&r1=9292&r2=9293&view=diff
==============================================================================
--- team/oej/iptos/channels/Makefile (original)
+++ team/oej/iptos/channels/Makefile Thu Feb 9 09:39:21 2006
@@ -69,7 +69,7 @@
CHANNEL_LIBS+=chan_h323.so
endif
-ifneq ($(wildcard misdn/chan_misdn_lib.a),)
+ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/mISDNuser/mISDNlib.h),)
CHANNEL_LIBS+=chan_misdn.so
CFLAGS+=-Imisdn
endif
@@ -224,11 +224,18 @@
$(CC) $(SOLINK) -o $@ $< h323/libchanh323.a $(CHANH323LIB) -L$(PWLIBDIR)/lib $(PTLIB) -L$(OPENH323DIR)/lib $(H323LIB) -L/usr/lib -lcrypto -lssl -lexpat
endif
+misdn/chan_misdn_lib.a:
+ make -C misdn
+
chan_misdn.so: chan_misdn.o chan_misdn_config.o misdn/chan_misdn_lib.a
$(CC) -shared -Xlinker -x -L/usr/lib -o $@ $^ -lisdnnet -lmISDN
chan_misdn.o: chan_misdn.c
- $(CC) $(CFLAGS) -DCHAN_MISDN_VERSION=\"0.2.1\" -c $< -o $@
+ $(CC) $(CFLAGS) -DCHAN_MISDN_VERSION=\"0.3.0\" -c $< -o $@
+
+chan_misdn_config.o: chan_misdn_config.c misdn/chan_misdn_config.h
+ $(CC) $(CFLAGS) -DCHAN_MISDN_VERSION=\"0.3.0\" -c $< -o $@
+
install: all
for x in $(CHANNEL_LIBS); do $(INSTALL) -m 755 $$x $(DESTDIR)$(MODULES_DIR) ; done
Modified: team/oej/iptos/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/oej/iptos/channels/chan_iax2.c?rev=9293&r1=9292&r2=9293&view=diff
==============================================================================
--- team/oej/iptos/channels/chan_iax2.c (original)
+++ team/oej/iptos/channels/chan_iax2.c Thu Feb 9 09:39:21 2006
@@ -8131,6 +8131,7 @@
peer->pokefreqok = DEFAULT_FREQ_OK;
peer->pokefreqnotok = DEFAULT_FREQ_NOTOK;
peer->context[0] = '\0';
+ peer->peercontext[0] = '\0';
while(v) {
if (!strcasecmp(v->name, "secret")) {
if (!ast_strlen_zero(peer->secret)) {
Modified: team/oej/iptos/channels/chan_local.c
URL: http://svn.digium.com/view/asterisk/team/oej/iptos/channels/chan_local.c?rev=9293&r1=9292&r2=9293&view=diff
==============================================================================
--- team/oej/iptos/channels/chan_local.c (original)
+++ team/oej/iptos/channels/chan_local.c Thu Feb 9 09:39:21 2006
@@ -394,7 +394,7 @@
isoutbound = IS_OUTBOUND(ast, p);
if (isoutbound) {
status = pbx_builtin_getvar_helper(p->chan, "DIALSTATUS");
- if(status)
+ if ((status) && (p->owner))
pbx_builtin_setvar_helper(p->owner, "CHANLOCALSTATUS", status);
p->chan = NULL;
p->launchedpbx = 0;
Modified: team/oej/iptos/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/team/oej/iptos/channels/chan_misdn.c?rev=9293&r1=9292&r2=9293&view=diff
==============================================================================
--- team/oej/iptos/channels/chan_misdn.c (original)
+++ team/oej/iptos/channels/chan_misdn.c Thu Feb 9 09:39:21 2006
@@ -58,9 +58,10 @@
#include <asterisk/indications.h>
#include <asterisk/app.h>
#include <asterisk/features.h>
-
-#include "chan_misdn_config.h"
-#include "isdn_lib.h"
+#include <asterisk/stringfields.h>
+
+#include <chan_misdn_config.h>
+#include <isdn_lib.h>
ast_mutex_t release_lock_mutex;
@@ -101,6 +102,17 @@
/* BEGIN: chan_misdn.h */
+
+
+enum tone_e {
+ TONE_NONE=0,
+ TONE_DIAL,
+ TONE_ALERTING,
+ TONE_BUSY,
+ TONE_CUSTOM,
+ TONE_FILE
+};
+
enum misdn_chan_state {
MISDN_NOTHING, /*!< at beginning */
@@ -160,6 +172,8 @@
int addr;
char context[BUFFERSIZE];
+
+ const struct tone_zone_sound *ts;
struct chan_list *peer;
struct chan_list *next;
@@ -265,6 +279,7 @@
+static int tone_indicate( struct chan_list *cl, enum tone_e tone);
static int start_bc_tones(struct chan_list *cl);
static int stop_bc_tones(struct chan_list *cl);
@@ -299,25 +314,6 @@
return NULL;
}
-static char* tone2str(struct misdn_bchannel *bc)
-{
- static struct {
- char name[16];
- enum tone_e tone;
- } *tone, tone_buf[] = {
- {"NOTONE",TONE_NONE},
- {"DIAL",TONE_DIAL},
- {"BUSY",TONE_BUSY},
- {"ALERT",TONE_ALERTING},
- {"",TONE_NONE}
- };
-
-
- for (tone=&tone_buf[0]; tone->name[0]; tone++) {
- if (tone->tone == bc->tone) return tone->name;
- }
- return NULL;
-}
static char *bearer2str(int cap) {
static char *bearers[]={
@@ -528,12 +524,12 @@
if (argc == 3 || onlyport == 0) {
ast_cli(fd,"Misdn General-Config: \n");
- ast_cli(fd," -> VERSION: " CHAN_MISDN_VERSION "\n");
-
+ ast_cli(fd," -> Version: chan_misdn-" CHAN_MISDN_VERSION "\n");
for (elem = MISDN_GEN_FIRST + 1, linebreak = 1; elem < MISDN_GEN_LAST; elem++, linebreak++) {
misdn_cfg_get_config_string( 0, elem, buffer, BUFFERSIZE);
ast_cli(fd, "%-36s%s", buffer, !(linebreak % 2) ? "\n" : "");
}
+ ast_cli(fd, "\n");
}
if (onlyport < 0) {
@@ -609,6 +605,8 @@
free_robin_list();
misdn_cfg_reload();
+
+ misdn_cfg_update_ptp();
misdn_cfg_get( 0, MISDN_GEN_TRACEFILE, global_tracefile, BUFFERSIZE);
@@ -642,7 +640,6 @@
" --> ch_addr: %x\n"
" --> bc_addr: %x\n"
" --> bc_l3id: %x\n"
- " --> tone: %s\n"
" --> display: %s\n"
" --> activated: %d\n"
" --> capability: %s\n"
@@ -654,7 +651,6 @@
help->addr,
bc->addr,
bc?bc->l3_id:-1,
- tone2str(bc),
bc->display,
bc->active,
@@ -892,7 +888,7 @@
return RESULT_SUCCESS ;
}
-static char *complete_ch_helper(char *line, char *word, int pos, int state, int rpos)
+static char *complete_ch_helper(const char *line, const char *word, int pos, int state, int rpos)
{
struct ast_channel *c;
int which=0;
@@ -916,12 +912,12 @@
return ret;
}
-static char *complete_ch(char *line, char *word, int pos, int state)
+static char *complete_ch(const char *line, const char *word, int pos, int state)
{
return complete_ch_helper(line, word, pos, state, 3);
}
-static char *complete_debug_port (char *line, char *word, int pos, int state)
+static char *complete_debug_port (const char *line, const char *word, int pos, int state)
{
if (state)
return NULL;
@@ -1058,14 +1054,13 @@
/*** CLI END ***/
-
-static int read_config(struct chan_list *ch, int orig) {
-
+static int update_config (struct chan_list *ch, int orig)
+{
if (!ch) {
ast_log(LOG_WARNING, "Cannot configure without chanlist\n");
return -1;
}
-
+
struct ast_channel *ast=ch->ast;
struct misdn_bchannel *bc=ch->bc;
if (! ast || ! bc ) {
@@ -1075,27 +1070,110 @@
int port=bc->port;
+ chan_misdn_log(1,port,"update_config: Getting Config\n");
+
+
+ int pres, screen;
+
+ misdn_cfg_get( port, MISDN_CFG_PRES, &pres, sizeof(int));
+ misdn_cfg_get( port, MISDN_CFG_SCREEN, &screen, sizeof(int));
+ chan_misdn_log(2,port," --> pres: %d screen: %d\n",pres, screen);
+
+ if ( (pres + screen) < 0 ) {
+
+ chan_misdn_log(2,port," --> pres: %x\n", ast->cid.cid_pres);
+
+ switch (ast->cid.cid_pres & 0x60){
+
+ case AST_PRES_RESTRICTED:
+ bc->pres=1;
+ chan_misdn_log(2, port, " --> PRES: Restricted (0x1)\n");
+ break;
+
+
+ case AST_PRES_UNAVAILABLE:
+ bc->pres=2;
+ chan_misdn_log(2, port, " --> PRES: Unavailable (0x2)\n");
+ break;
+
+ default:
+ bc->pres=0;
+ chan_misdn_log(2, port, " --> PRES: Allowed (0x0)\n");
+ }
+
+ switch (ast->cid.cid_pres & 0x3){
+
+ case AST_PRES_USER_NUMBER_UNSCREENED:
+ bc->screen=0;
+ chan_misdn_log(2, port, " --> SCREEN: Unscreened (0x0)\n");
+ break;
+
+ case AST_PRES_USER_NUMBER_PASSED_SCREEN:
+ bc->screen=1;
+ chan_misdn_log(2, port, " --> SCREEN: Passed Screen (0x1)\n");
+ break;
+ case AST_PRES_USER_NUMBER_FAILED_SCREEN:
+ bc->screen=2;
+ chan_misdn_log(2, port, " --> SCREEN: Failed Screen (0x2)\n");
+ break;
+
+ case AST_PRES_NETWORK_NUMBER:
+ bc->screen=3;
+ chan_misdn_log(2, port, " --> SCREEN: Network Nr. (0x3)\n");
+ break;
+
+ default:
+ bc->screen=0;
+ chan_misdn_log(2, port, " --> SCREEN: Unscreened (0x0)\n");
+ }
+
+
+ } else {
+ bc->screen=screen;
+ bc->pres=pres;
+ }
+
+ return 0;
+
+}
+
+
+static int read_config(struct chan_list *ch, int orig) {
+
+ if (!ch) {
+ ast_log(LOG_WARNING, "Cannot configure without chanlist\n");
+ return -1;
+ }
+
+ struct ast_channel *ast=ch->ast;
+ struct misdn_bchannel *bc=ch->bc;
+ if (! ast || ! bc ) {
+ ast_log(LOG_WARNING, "Cannot configure without ast || bc\n");
+ return -1;
+ }
+
+ int port=bc->port;
+
chan_misdn_log(1,port,"read_config: Getting Config\n");
char lang[BUFFERSIZE];
misdn_cfg_get( port, MISDN_CFG_LANGUAGE, lang, BUFFERSIZE);
- ast_copy_string(ast->language, lang, sizeof(ast->language));
- ast->language[sizeof(ast->language)]=0;
-
-
- char musicclass[BUFFERSIZE];
-
- misdn_cfg_get( port, MISDN_CFG_MUSICCLASS, musicclass, BUFFERSIZE);
- ast_copy_string(ast->musicclass, musicclass, sizeof(ast->musicclass));
- ast->musicclass[sizeof(ast->musicclass)]=0;
+ ast_string_field_set(ast, language, lang);
+
+ char localmusicclass[BUFFERSIZE];
+
+ misdn_cfg_get( port, MISDN_CFG_MUSICCLASS, localmusicclass, BUFFERSIZE);
+ ast_string_field_set(ast, musicclass, localmusicclass);
misdn_cfg_get( port, MISDN_CFG_TXGAIN, &bc->txgain, sizeof(int));
misdn_cfg_get( port, MISDN_CFG_RXGAIN, &bc->rxgain, sizeof(int));
misdn_cfg_get( port, MISDN_CFG_SENDDTMF, &bc->send_dtmf, sizeof(int));
+
+ misdn_cfg_get( port, MISDN_CFG_NEED_MORE_INFOS, &bc->need_more_infos, sizeof(int));
/*Initialize new Jitterbuffer*/
@@ -1130,6 +1208,7 @@
}
misdn_cfg_get( bc->port, MISDN_CFG_CONTEXT, ch->context, sizeof(ch->context));
+
strncpy(ast->context,ch->context,sizeof(ast->context)-1);
{
@@ -1235,67 +1314,7 @@
}
- /* Will be overridden by asterisk in head! */
- {
- int pres;
-
- misdn_cfg_get( port, MISDN_CFG_PRES, &pres, sizeof(int));
- bc->pres=pres?0:1;
-
- }
-
- int def_callingpres;
- misdn_cfg_get( port, MISDN_CFG_USE_CALLINGPRES, &def_callingpres, sizeof(int));
- if ( def_callingpres) {
-
- switch (ast->cid.cid_pres & 0x60){
- case AST_PRES_RESTRICTED:
- bc->pres=1;
- chan_misdn_log(2, port, " --> PRES: Restricted (0x1)\n");
- break;
-
-
- case AST_PRES_UNAVAILABLE:
- bc->pres=2;
- chan_misdn_log(2, port, " --> PRES: Unavailable (0x2)\n");
- break;
-
- default:
- bc->pres=0;
- chan_misdn_log(2, port, " --> PRES: Allowed (0x0)\n");
- }
-
- switch (ast->cid.cid_pres & 0x3){
-
- case AST_PRES_USER_NUMBER_UNSCREENED:
- bc->screen=0;
- chan_misdn_log(2, port, " --> SCREEN: Unscreened (0x0)\n");
- break;
-
- case AST_PRES_USER_NUMBER_PASSED_SCREEN:
- bc->screen=1;
- chan_misdn_log(2, port, " --> SCREEN: Passed Screen (0x1)\n");
- break;
- case AST_PRES_USER_NUMBER_FAILED_SCREEN:
- bc->screen=2;
- chan_misdn_log(2, port, " --> SCREEN: Failed Screen (0x2)\n");
- break;
-
- case AST_PRES_NETWORK_NUMBER:
- bc->screen=3;
- chan_misdn_log(2, port, " --> SCREEN: Network Nr. (0x3)\n");
- break;
-
- default:
- bc->screen=0;
- chan_misdn_log(2, port, " --> SCREEN: Unscreened (0x0)\n");
- }
-
-
- }
-
-
} else { /** ORIGINATOR MISDN **/
@@ -1368,8 +1387,18 @@
strcpy(bc->dad,tmp);
}
-
-
+ if ( strcmp(bc->dad,ast->exten)) {
+ ast_copy_string(ast->exten, bc->dad, sizeof(ast->exten));
+ }
+ if ( ast->cid.cid_num && strcmp(ast->cid.cid_num, bc->oad)) {
+ free(ast->cid.cid_num);
+ ast->cid.cid_num=NULL;
+
+ }
+ if ( !ast->cid.cid_num) {
+ ast->cid.cid_num=strdup(bc->oad);
+ }
+
pbx_builtin_setvar_helper(ch->ast,"REDIRECTING_NUMBER",bc->rad);
}
@@ -1389,7 +1418,7 @@
struct misdn_bchannel *newbc;
char *opts=NULL, *ext,*tokb;
char dest_cp[256];
-
+
{
strncpy(dest_cp,dest,sizeof(dest_cp)-1);
dest_cp[sizeof(dest_cp)]=0;
@@ -1444,7 +1473,7 @@
strncpy(ast->exten,ext,sizeof(ast->exten));
- chan_misdn_log(1, 0, "* CALL: %s\n",dest);
+ chan_misdn_log(1, port, "* CALL: %s\n",dest);
chan_misdn_log(1, port, " --> * dad:%s tech:%s ctx:%s\n",ast->exten,ast->name, ast->context);
@@ -1477,17 +1506,18 @@
chan_misdn_log(2, port, " --> * Call with flag Digital\n");
}
-
+
+ /* update screening and presentation */
+ update_config(ch,ORG_AST);
+
/* Finally The Options Override Everything */
if (opts)
misdn_set_opt_exec(ast,opts);
else
- chan_misdn_log(1,0,"NO OPTS GIVEN\n");
-
+ chan_misdn_log(2,port,"NO OPTS GIVEN\n");
ch->state=MISDN_CALLING;
-
r=misdn_lib_send_event( newbc, EVENT_SETUP );
@@ -1506,7 +1536,6 @@
chan_misdn_log(1, port, " --> * SEND: State Dialing pid:%d\n",newbc?newbc->pid:1);
ast_setstate(ast, AST_STATE_DIALING);
-
ast->hangupcause=16;
return 0;
}
@@ -1517,9 +1546,7 @@
struct chan_list *p;
- if (!ast || ! MISDN_ASTERISK_PVT(ast)) return -1;
- p = MISDN_ASTERISK_TECH_PVT(ast) ;
-
+ if (!ast || ! (p=MISDN_ASTERISK_TECH_PVT(ast)) ) return -1;
chan_misdn_log(1, p? (p->bc? p->bc->port : 0) : 0, "* ANSWER:\n");
@@ -1551,10 +1578,12 @@
}
{
- const char *async=pbx_builtin_getvar_helper(ast, "MISDN_DIGITAL_TRANS");
- if (async) {
+ const char *nodsp=pbx_builtin_getvar_helper(ast, "MISDN_DIGITAL_TRANS");
+ if (nodsp) {
chan_misdn_log(1, p->bc->port, " --> Connection is transparent digital\n");
- p->bc->async=1;
+ p->bc->nodsp=1;
+ p->bc->hdlc=0;
+ p->bc->nojitter=1;
}
}
@@ -1569,9 +1598,7 @@
{
struct chan_list *p;
- if (!ast || ! MISDN_ASTERISK_PVT(ast)) return -1;
- p = MISDN_ASTERISK_TECH_PVT(ast) ;
-
+ if (!ast || ! (p=MISDN_ASTERISK_TECH_PVT(ast))) return -1;
struct misdn_bchannel *bc=p->bc;
chan_misdn_log(1, bc?bc->port:0, "* IND : Digit %c\n",digit);
@@ -1629,8 +1656,7 @@
{
struct chan_list *p;
- if (!ast || ! MISDN_ASTERISK_PVT(ast)) return -1;
- p = MISDN_ASTERISK_TECH_PVT(ast) ;
+ if (!ast || ! (p=MISDN_ASTERISK_TECH_PVT(ast) )) return -1;
chan_misdn_log(1, p->bc?p->bc->port:0, "* IND: Got Fixup State:%s Holded:%d L3id:%x\n", misdn_get_ch_state(p), p->holded, p->l3id);
@@ -1647,11 +1673,10 @@
struct chan_list *p;
- if (!ast || ! MISDN_ASTERISK_PVT(ast)) {
+ if (!ast || ! (p=MISDN_ASTERISK_TECH_PVT(ast))) {
ast_log(LOG_WARNING, "Returnded -1 in misdn_indication\n");
return -1;
}
- p = MISDN_ASTERISK_TECH_PVT(ast) ;
if (!p->bc ) {
chan_misdn_log(1, 0, "* IND : Indication from %s\n",ast->exten);
@@ -1659,7 +1684,7 @@
return -1;
}
- chan_misdn_log(1, p->bc->port, "* IND : Indication from %s\n",ast->exten);
+ chan_misdn_log(1, p->bc->port, "* IND : Indication [%d] from %s\n",cond, ast->exten);
switch (cond) {
case AST_CONTROL_BUSY:
@@ -1670,7 +1695,7 @@
p->bc->out_cause=17;
if (p->state != MISDN_CONNECTED) {
misdn_lib_send_event( p->bc, EVENT_DISCONNECT);
- manager_send_tone(p->bc, TONE_BUSY);
+ tone_indicate(p, TONE_BUSY);
} else {
chan_misdn_log(-1, p->bc->port, " --> !! Got Busy in Connected State !?! ast:%s\n", ast->name);
@@ -1680,23 +1705,26 @@
chan_misdn_log(1, p->bc->port, " --> * IND :\tring pid:%d\n",p->bc?p->bc->pid:-1);
break;
case AST_CONTROL_RINGING:
- if ( p->state == MISDN_ALERTING) {
- chan_misdn_log(1, p->bc->port, " --> * IND :\tringing pid:%d but I ws Ringing before, so ignoreing it\n",p->bc?p->bc->pid:-1);
- break;
- }
- p->state=MISDN_ALERTING;
-
- chan_misdn_log(1, p->bc->port, " --> * IND :\tringing pid:%d\n",p->bc?p->bc->pid:-1);
-
- misdn_lib_send_event( p->bc, EVENT_ALERTING);
-
- manager_send_tone(p->bc, TONE_ALERTING);
- chan_misdn_log(1, p->bc->port, " --> * SEND: State Ring pid:%d\n",p->bc?p->bc->pid:-1);
- ast_setstate(ast,AST_STATE_RINGING);
- break;
-
+ switch (p->state) {
+ case MISDN_ALERTING:
+ chan_misdn_log(1, p->bc->port, " --> * IND :\tringing pid:%d but I was Ringing before, so ignoreing it\n",p->bc?p->bc->pid:-1);
+ break;
+ case MISDN_CONNECTED:
+ chan_misdn_log(1, p->bc->port, " --> * IND :\tringing pid:%d but Connected, so just send TONE_ALERTING without state changes \n",p->bc?p->bc->pid:-1);
+ tone_indicate(p, TONE_ALERTING);
+ break;
+ default:
+ p->state=MISDN_ALERTING;
+ chan_misdn_log(1, p->bc->port, " --> * IND :\tringing pid:%d\n",p->bc?p->bc->pid:-1);
+ misdn_lib_send_event( p->bc, EVENT_ALERTING);
+ tone_indicate(p, TONE_ALERTING);
+ chan_misdn_log(1, p->bc->port, " --> * SEND: State Ring pid:%d\n",p->bc?p->bc->pid:-1);
+ ast_setstate(ast,AST_STATE_RINGING);
+ }
+ break;
case AST_CONTROL_ANSWER:
chan_misdn_log(1, p->bc->port, " --> * IND :\tanswer pid:%d\n",p->bc?p->bc->pid:-1);
+ start_bc_tones(p);
break;
case AST_CONTROL_TAKEOFFHOOK:
chan_misdn_log(1, p->bc->port, " --> *\ttakeoffhook pid:%d\n",p->bc?p->bc->pid:-1);
@@ -1709,9 +1737,13 @@
break;
case AST_CONTROL_PROGRESS:
chan_misdn_log(1, p->bc->port, " --> * IND :\tprogress pid:%d\n",p->bc?p->bc->pid:-1);
+ misdn_lib_send_event( p->bc, EVENT_PROGRESS);
+ break;
+ case AST_CONTROL_PROCEEDING:
+ chan_misdn_log(1, p->bc->port, " --> * IND :\tproceeding pid:%d\n",p->bc?p->bc->pid:-1);
+ misdn_lib_send_event( p->bc, EVENT_PROCEEDING);
break;
case AST_CONTROL_CONGESTION:
-
chan_misdn_log(1, p->bc->port, " --> * IND :\tcongestion pid:%d\n",p->bc?p->bc->pid:-1);
p->bc->out_cause=42;
@@ -1723,11 +1755,12 @@
}
if (p->bc->nt) {
- manager_send_tone(p->bc, TONE_BUSY);
+ tone_indicate(p, TONE_BUSY);
}
break;
case -1 :
- chan_misdn_log(1, p->bc->port, " --> * IND :\t-1! pid:%d\n",p->bc?p->bc->pid:-1);
+ chan_misdn_log(1, p->bc->port, " --> * IND :\t-1! (stop indication) pid:%d\n",p->bc?p->bc->pid:-1);
+ tone_indicate(p, TONE_NONE);
break;
case AST_CONTROL_HOLD:
@@ -1817,7 +1850,7 @@
case MISDN_HOLDED:
case MISDN_DIALING:
start_bc_tones(p);
- manager_send_tone(bc, TONE_BUSY);
+ tone_indicate(p, TONE_BUSY);
p->state=MISDN_CLEANING;
misdn_lib_send_event( bc, EVENT_RELEASE_COMPLETE);
@@ -1828,7 +1861,7 @@
chan_misdn_log(2, bc->port, " --> * State Alerting\n");
if (p->orginator != ORG_AST)
- manager_send_tone(bc, TONE_BUSY);
+ tone_indicate(p, TONE_BUSY);
p->state=MISDN_CLEANING;
misdn_lib_send_event( bc, EVENT_DISCONNECT);
@@ -1837,7 +1870,7 @@
/* Alerting or Disconect */
chan_misdn_log(2, bc->port, " --> * State Connected\n");
start_bc_tones(p);
- manager_send_tone(bc, TONE_BUSY);
+ tone_indicate(p, TONE_BUSY);
misdn_lib_send_event( bc, EVENT_DISCONNECT);
p->state=MISDN_CLEANING; /* MISDN_HUNGUP_FROM_AST; */
@@ -1920,8 +1953,8 @@
return -1;
}
- if (ch->bc->tone != TONE_NONE)
- manager_send_tone(ch->bc,TONE_NONE);
+ /*if (ch->bc->tone != TONE_NONE)
+ tone_indicate(ch,TONE_NONE); */
if (ch->holded ) {
@@ -1933,10 +1966,17 @@
chan_misdn_log(5, ch->bc->port, "misdn_write: Returning because notxone\n");
return 0;
}
+
+
+ if ( !frame->subclass) {
+ chan_misdn_log(0, ch->bc->port, "misdn_write: * prods us\n");
+ return 0;
+ }
if ( !(frame->subclass & prefformat)) {
-
+
chan_misdn_log(-1, ch->bc->port, "Got Unsupported Frame with Format:%d\n", frame->subclass);
+ return -1;
}
@@ -1951,6 +1991,13 @@
}
#endif
+
+ if (!ch->bc->active) {
+ chan_misdn_log(5, ch->bc->port, "BC not active droping: %d frames\n",frame->samples);
+ return 0;
+ }
+
+ chan_misdn_log(9, ch->bc->port, "Sending :%d bytes 2 MISDN\n",frame->samples);
/*if speech flip bits*/
if ( misdn_cap_is_speech(ch->bc->capability) )
flip_buf_bits(frame->data,frame->samples);
@@ -2065,10 +2112,56 @@
/** AST INDICATIONS END **/
+static int tone_indicate( struct chan_list *cl, enum tone_e tone)
+{
+ const struct tone_zone_sound *ts= NULL;
+ struct ast_channel *ast=cl->ast;
+
+ chan_misdn_log(0,cl->bc->port,"Tone Indicate:\n");
+
+ if (!cl->ast) {
+ return 0;
+ }
+
+ switch (tone) {
+ case TONE_DIAL:
+ chan_misdn_log(0,cl->bc->port," --> Dial\n");
+ ts=ast_get_indication_tone(ast->zone,"dial");
+ misdn_lib_tone_generator_start(cl->bc);
+ break;
+ case TONE_ALERTING:
+ chan_misdn_log(0,cl->bc->port," --> Ring\n");
+ ts=ast_get_indication_tone(ast->zone,"ring");
+ misdn_lib_tone_generator_stop(cl->bc);
+ break;
+ case TONE_BUSY:
+ chan_misdn_log(0,cl->bc->port," --> Busy\n");
+ ts=ast_get_indication_tone(ast->zone,"busy");
+ misdn_lib_tone_generator_stop(cl->bc);
+ break;
+ case TONE_FILE:
+ break;
+
+ case TONE_NONE:
+ chan_misdn_log(0,cl->bc->port," --> None\n");
+ misdn_lib_tone_generator_stop(cl->bc);
+ ast_playtones_stop(ast);
+ break;
+ default:
+ chan_misdn_log(0,cl->bc->port,"Don't know how to handle tone: %d\n",tone);
+ }
+
+ cl->ts=ts;
+
+ if (ts) ast_playtones_start(ast,0, ts->data, 0);
+
+ return 0;
+}
+
static int start_bc_tones(struct chan_list* cl)
{
manager_bchannel_activate(cl->bc);
- manager_send_tone(cl->bc ,TONE_NONE);
+ misdn_lib_tone_generator_stop(cl->bc);
cl->notxtone=0;
cl->norxtone=0;
return 0;
@@ -2190,17 +2283,16 @@
misdn_cfg_get(port, MISDN_CFG_GROUPNAME, cfg_group, BUFFERSIZE);
if (!strcasecmp(cfg_group, group)) {
- int l1, port_up;
+ int port_up;
- misdn_cfg_get( 0, MISDN_GEN_L1_INFO_OK, &l1, sizeof(l1));
port_up = misdn_lib_port_up(port);
- if ((l1 && port_up) || !l1) {
+ if ( port_up ) {
newbc = misdn_lib_get_free_bc(port, robin_channel);
if (newbc) {
chan_misdn_log(4, port, " Success! Found port:%d channel:%d\n", newbc->port, newbc->channel);
if (port_up)
- chan_misdn_log(4, port, "def_l1:%d, portup:%d\n", l1, port_up);
+ chan_misdn_log(4, port, "ortup:%d\n", port_up);
rr->port = newbc->port;
rr->channel = newbc->channel;
break;
@@ -2221,14 +2313,13 @@
misdn_cfg_get( port, MISDN_CFG_GROUPNAME, cfg_group, BUFFERSIZE);
if (!strcasecmp(cfg_group, group)) {
- int l1, port_up;
+ int port_up;
- misdn_cfg_get( 0, MISDN_GEN_L1_INFO_OK, &l1, sizeof(l1));
port_up = misdn_lib_port_up(port);
- chan_misdn_log(4, port, "def_l1:%d, portup:%d\n", l1, port_up);
+ chan_misdn_log(4, port, "portup:%d\n", port_up);
- if ((l1 && port_up) || !l1) {
+ if ( port_up ) {
newbc = misdn_lib_get_free_bc(port, 0);
if (newbc)
break;
@@ -2244,8 +2335,8 @@
}
if (!newbc) {
- chan_misdn_log(1, 0, " --> ! No free channel chan ext:%s even after Group Call\n",ext);
- chan_misdn_log(1, 0, " --> SEND: State Down\n");
+ chan_misdn_log(-1, 0, " --> ! No free channel chan ext:%s even after Group Call\n",ext);
+ chan_misdn_log(-1, 0, " --> SEND: State Down\n");
return NULL;
}
@@ -2265,6 +2356,21 @@
return tmp;
}
+
+int misdn_send_text (struct ast_channel *chan, const char *text)
+{
+ struct chan_list *tmp=chan->tech_pvt;
+
+ if (tmp && tmp->bc) {
+ ast_copy_string(tmp->bc->display,text,sizeof(tmp->bc->display));
+ misdn_lib_send_event(tmp->bc, EVENT_INFORMATION);
+ } else {
+ ast_log(LOG_WARNING, "No chan_list but send_text request?\n");
+ return -1;
+ }
+
+ return 0;
+}
static struct ast_channel_tech misdn_tech = {
.type="mISDN",
@@ -2280,6 +2386,7 @@
.write=misdn_write,
.indicate=misdn_indication,
.fixup=misdn_fixup,
+ .send_text=misdn_send_text,
.properties=0
};
@@ -2296,6 +2403,7 @@
.write=misdn_write,
.indicate=misdn_indication,
.fixup=misdn_fixup,
+ .send_text=misdn_send_text,
.properties=0
};
@@ -2314,14 +2422,12 @@
if (c<=0) {
c=glob_channel++;
- snprintf(tmp->name, sizeof(tmp->name), "%s/%d-u%d",
+ ast_string_field_build(tmp, name, "%s/%d-u%d",
misdn_type, port, c);
} else {
- snprintf(tmp->name, sizeof(tmp->name), "%s/%d-%d",
+ ast_string_field_build(tmp, name, "%s/%d-%d",
misdn_type, port, c);
}
-
- tmp->type = misdn_type;
tmp->nativeformats = prefformat;
@@ -2383,15 +2489,16 @@
static int misdn_tx2ast_frm(struct chan_list * tmp, char * buf, int len )
{
struct ast_frame frame;
-
+
/* If in hold state we drop frame .. */
if (tmp->holded ) return 0;
-
+
switch(tmp->state) {
case MISDN_CLEANING:
case MISDN_EXTCANTMATCH:
+ return 0;
+
case MISDN_WAITING4DIGS:
- return 0;
default:
break;
}
@@ -2477,7 +2584,7 @@
#endif
chan_misdn_log(9, tmp->bc->port, "Queueing %d bytes 2 Asterisk\n",len);
ast_queue_frame(tmp->ast,&frame);
-
+
} else {
ast_log (LOG_WARNING, "No ast || ast->pvt || ch\n");
}
@@ -2590,6 +2697,10 @@
{
struct chan_list *ch=find_chan_by_bc(cl_te, bc);
if (!ch) ch=find_chan_by_l3id (cl_te, bc->l3_id);
+ if (!ch) {
+ chan_misdn_log(0, bc->port, "release_chan: Ch not found!\n");
+ return;
+ }
release_lock;
if (ch->ast) {
@@ -2655,7 +2766,6 @@
} else {
chan_misdn_log(2, bc->port, "* --> Hangup\n");
ast_queue_hangup(ast);
- //ast_hangup(ast);
}
break;
@@ -2699,7 +2809,6 @@
holded_chan->state=MISDN_CONNECTED;
holded_chan->holded=0;
misdn_lib_transfer(holded_chan->bc?holded_chan->bc:holded_chan->holded_bc);
-
ast_channel_masquerade(holded_chan->ast, AST_BRIDGED_P(tmp_ch->ast));
}
@@ -2714,7 +2823,6 @@
strncpy(predial, ast->exten, sizeof(predial) -1 );
ch->state=MISDN_DIALING;
-
if (bc->nt) {
int ret;
@@ -2727,8 +2835,7 @@
ret = misdn_lib_send_event(bc, EVENT_PROCEEDING );
}
}
-
- manager_send_tone(bc,TONE_DIAL);
+ tone_indicate(ch,TONE_DIAL);
chan_misdn_log(1, bc->port, "* Starting Ast ctx:%s dad:%s oad:%s with 's' extension\n", ast->context, ast->exten, AST_CID_P(ast));
@@ -2736,7 +2843,7 @@
if (ast_pbx_start(ast)<0) {
ast=NULL;
- manager_send_tone(bc,TONE_BUSY);
+ tone_indicate(ch,TONE_BUSY);
if (bc->nt)
misdn_lib_send_event(bc, EVENT_RELEASE_COMPLETE );
@@ -2802,7 +2909,7 @@
if (!ch)
ch=find_chan_by_l3id(cl_te, bc->l3_id);
- if (event != EVENT_BCHAN_DATA) { /* Debug Only Non-Bchan */
+ if (event != EVENT_BCHAN_DATA && event != EVENT_TONE_GENERATE) { /* Debug Only Non-Bchan */
chan_misdn_log(1, bc->port, "I IND :%s oad:%s dad:%s\n", manager_isdn_get_info(event), bc->oad, bc->dad);
misdn_lib_log_ies(bc);
}
@@ -2832,6 +2939,11 @@
switch (event) {
+
+ case EVENT_BCHAN_ACTIVATED:
+ break;
+
+
case EVENT_NEW_L3ID:
ch->l3id=bc->l3_id;
break;
@@ -2867,8 +2979,8 @@
{
int stop_tone;
misdn_cfg_get( 0, MISDN_GEN_STOP_TONE, &stop_tone, sizeof(int));
- if ( stop_tone && bc->tone != TONE_NONE) {
- manager_send_tone(bc,TONE_NONE);
+ if ( stop_tone ) {
+ tone_indicate(ch,TONE_NONE);
}
if (ch->state == MISDN_WAITING4DIGS ) {
@@ -2887,11 +2999,26 @@
}
/* chan_misdn_log(5, bc->port, "Can Match Extension: dad:%s oad:%s\n",bc->dad,bc->oad);*/
+ /* Check for Pickup Request first */
+ if (!strcmp(ch->ast->exten, ast_pickup_ext())) {
+ int ret;/** Sending SETUP_ACK**/
+ ret = misdn_lib_send_event(bc, EVENT_SETUP_ACKNOWLEDGE );
+ if (ast_pickup_call(ch->ast)) {
+ ast_hangup(ch->ast);
+ } else {
+ struct ast_channel *chan=ch->ast;
+ ch->state = MISDN_CALLING_ACKNOWLEDGE;
+ ch->ast=NULL;
+ ast_setstate(chan, AST_STATE_DOWN);
+ ast_hangup(chan);
+ break;
+ }
+ }
if(!ast_canmatch_extension(ch->ast, ch->context, bc->dad, 1, bc->oad)) {
chan_misdn_log(-1, bc->port, "Extension can never match, so disconnecting\n");
- manager_send_tone(bc,TONE_BUSY);
+ tone_indicate(ch,TONE_BUSY);
ch->state=MISDN_EXTCANTMATCH;
bc->out_cause=1;
@@ -2904,12 +3031,12 @@
if (ast_exists_extension(ch->ast, ch->context, bc->dad, 1, bc->oad)) {
ch->state=MISDN_DIALING;
- manager_send_tone(bc,TONE_NONE);
+ tone_indicate(ch,TONE_NONE);
/* chan_misdn_log(1, bc->port, " --> * Starting Ast ctx:%s\n", ch->context);*/
if (ast_pbx_start(ch->ast)<0) {
chan_misdn_log(-1, bc->port, "ast_pbx_start returned < 0 in INFO\n");
- manager_send_tone(bc,TONE_BUSY);
+ tone_indicate(ch,TONE_BUSY);
if (bc->nt)
misdn_lib_send_event(bc, EVENT_RELEASE_COMPLETE );
@@ -3007,7 +3134,21 @@
/** queue new chan **/
cl_queue_chan(&cl_te, ch) ;
-
+
+ /* Check for Pickup Request first */
+ if (!strcmp(chan->exten, ast_pickup_ext())) {
+ int ret;/** Sending SETUP_ACK**/
+ ret = misdn_lib_send_event(bc, EVENT_SETUP_ACKNOWLEDGE );
+ if (ast_pickup_call(chan)) {
+ ast_hangup(chan);
+ } else {
+ ch->state = MISDN_CALLING_ACKNOWLEDGE;
+ ch->ast=NULL;
+ ast_setstate(chan, AST_STATE_DOWN);
+ ast_hangup(chan);
+ break;
+ }
+ }
/*
added support for s extension hope it will help those poor cretains
@@ -3031,7 +3172,7 @@
chan_misdn_log(-1, bc->port, "Extension can never match, so disconnecting\n");
- manager_send_tone(bc,TONE_BUSY);
+ tone_indicate(ch,TONE_BUSY);
ch->state=MISDN_EXTCANTMATCH;
bc->out_cause=1;
@@ -3045,7 +3186,7 @@
if (ast_exists_extension(ch->ast, ch->context, bc->dad, 1, bc->oad)) {
ch->state=MISDN_DIALING;
- if (bc->nt) {
+ if (bc->nt || (bc->need_more_infos && misdn_lib_is_ptp(bc->port)) ) {
int ret;
ret = misdn_lib_send_event(bc, EVENT_SETUP_ACKNOWLEDGE );
} else {
@@ -3057,7 +3198,7 @@
chan_misdn_log(-1, bc->port, "ast_pbx_start returned <0 in SETUP\n");
chan=NULL;
- manager_send_tone(bc,TONE_BUSY);
+ tone_indicate(ch,TONE_BUSY);
if (bc->nt)
misdn_lib_send_event(bc, EVENT_RELEASE_COMPLETE );
[... 4804 lines stripped ...]
More information about the asterisk-commits
mailing list