]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Allow doing digital PRI to PRI calls automatically
authorMartin Pycko <martinp@digium.com>
Thu, 18 Dec 2003 23:42:10 +0000 (23:42 +0000)
committerMartin Pycko <martinp@digium.com>
Thu, 18 Dec 2003 23:42:10 +0000 (23:42 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1868 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_dial.c
channels/chan_zap.c
include/asterisk/channel.h

index 533812a879d2ee3e021db3a5f0189da8bd7b031b..06073c2fdd81bf7c34286c7529aae09a4dec0928 100755 (executable)
@@ -585,6 +585,8 @@ static int dial_exec(struct ast_channel *chan, void *data)
                tmp->chan->callingpres = chan->callingpres;
                /* Presense of ADSI CPE on outgoing channel follows ours */
                tmp->chan->adsicpe = chan->adsicpe;
+               /* pass the digital flag */
+               ast_dup_flag(tmp->chan, chan, AST_FLAG_DIGITAL);
                /* Place the call, but don't wait on the answer */
                res = ast_call(tmp->chan, numsubst, 0);
 
index fd5ea7f717b534d5de144c53c57c4c06e23fd1bc..6cff248d77151c34888f63ced75c88310fd777b6 100755 (executable)
@@ -1558,6 +1558,7 @@ static int zt_call(struct ast_channel *ast, char *rdest, int timeout)
                        ast_log(LOG_WARNING, "Unable to create call on channel %d\n", p->channel);
                        return -1;
                }
+               p->digital = ast_test_flag(ast,AST_FLAG_DIGITAL);
                if (pri_call(p->pri->pri, p->call, p->digital ? PRI_TRANS_CAP_DIGITAL : PRI_TRANS_CAP_SPEECH, 
                        p->prioffset, p->pri->nodetype == PRI_NETWORK ? 0 : 1, 1, l, p->pri->dialplan - 1, n,
                        l ? (ast->restrictcid ? PRES_PROHIB_USER_NUMBER_PASSED_SCREEN : (p->use_callingpres ? ast->callingpres : PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN)) : PRES_NUMBER_NOT_AVAILABLE,
@@ -3914,6 +3915,8 @@ static struct ast_channel *zt_new(struct zt_pvt *i, int state, int startpbx, int
                /* Assume calls are not idle calls unless we're told differently */
                i->isidlecall = 0;
                i->alreadyhungup = 0;
+               i->digital = ctype;
+               ast_set2_flag(tmp, ctype, AST_FLAG_DIGITAL);
 #endif
                /* clear the fake event in case we posted one before we had ast_chanenl */
                i->fake_event = 0;
index 13e97da7c81de98da4c8f1c4e72afad21bb0d011..f0d998b684de7715cb64ba2b7ede54fe6d29a3c5 100755 (executable)
@@ -224,12 +224,48 @@ struct ast_channel {
 
        unsigned int callgroup;
        unsigned int pickupgroup;
+
+       /*! channel flags of AST_FLAG_ type */
+       int flag;
        
        /*! For easy linking */
        struct ast_channel *next;
 
 };
 
+#define AST_FLAG_DIGITAL       1       /* if the call is a digital ISDN call */
+
+static inline int ast_test_flag(struct ast_channel *chan, int mode)
+{
+       return chan->flag & mode;
+}
+
+static inline void ast_set_flag(struct ast_channel *chan, int mode)
+{
+       chan->flag |= mode;
+}
+
+static inline void ast_clear_flag(struct ast_channel *chan, int mode)
+{
+       chan->flag &= ~mode;
+}
+
+static inline void ast_set2_flag(struct ast_channel *chan, int value, int mode)
+{
+       if (value)
+               ast_set_flag(chan, mode);
+       else
+               ast_clear_flag(chan, mode);
+}
+
+static inline void ast_dup_flag(struct ast_channel *dstchan, struct ast_channel *srcchan, int mode)
+{
+       if (ast_test_flag(srcchan, mode))
+               ast_set_flag(dstchan, mode);
+       else
+               ast_clear_flag(dstchan, mode);
+}      
+
 struct chanmon;
 
 #define LOAD_OH(oh) {  \