Revert "Add .gitignore"
[lcr.git] / chan_lcr.c
index d0993b7..72bca9f 100644 (file)
@@ -496,6 +496,14 @@ void apply_opt(struct chan_call *call, char *data)
                        if (!call->nodsp)
                                call->nodsp = 1;
                        break;
+               case 'q':
+                       if (opt[1] == '\0') {
+                               CERROR(call, call->ast, "Option 'q' (queue) expects parameter.\n", opt);
+                               break;
+                       }
+                       CDEBUG(call, call->ast, "Option 'q' (queue).\n");
+                       call->nodsp_queue = atoi(opt+1);
+                       break;
                case 'e':
                        if (opt[1] == '\0') {
                                CERROR(call, call->ast, "Option 'e' (echo cancel) expects parameter.\n", opt);
@@ -591,7 +599,7 @@ void apply_opt(struct chan_call *call, char *data)
        /* re-open, if bchannel is created */
        if (call->bchannel && call->bchannel->b_sock > -1) {
                bchannel_destroy(call->bchannel);
-               if (bchannel_create(call->bchannel, ((call->nodsp || call->faxdetect > 0)?1:0) + ((call->hdlc)?2:0)))
+               if (bchannel_create(call->bchannel, ((call->nodsp || call->faxdetect > 0)?1:0) + ((call->hdlc)?2:0), call->nodsp_queue))
                        bchannel_activate(call->bchannel, 1);
        }
 }
@@ -604,6 +612,7 @@ static void send_setup_to_lcr(struct chan_call *call)
 {
        union parameter newparam;
        struct ast_channel *ast = call->ast;
+       const char *tmp;
 
        if (!call->ast || !call->ref)
                return;
@@ -656,6 +665,9 @@ static void send_setup_to_lcr(struct chan_call *call)
                default:
                newparam.setup.callerinfo.ntype = INFO_NTYPE_UNKNOWN;
        }
+       tmp = pbx_builtin_getvar_helper(ast, "LCR_TRANSFERCAPABILITY");
+       if (tmp && *tmp)
+               ast->transfercapability = atoi(tmp);
        newparam.setup.capainfo.bearer_capa = ast->transfercapability;
        newparam.setup.capainfo.bearer_mode = INFO_BMODE_CIRCUIT;
        if (call->hdlc)
@@ -1287,7 +1299,7 @@ int receive_message(int message_type, unsigned int ref, union parameter *param)
                                        bchannel_join(bchannel, call->bridge_id);
                                }
                                /* create only, if call exists, othewhise it bchannel is freed below... */
-                               if (bchannel_create(bchannel, ((call->nodsp || call->faxdetect > 0)?1:0) + ((call->hdlc)?2:0)))
+                               if (bchannel_create(bchannel, ((call->nodsp || call->faxdetect > 0)?1:0) + ((call->hdlc)?2:0), call->nodsp_queue))
                                        bchannel_activate(bchannel, 1);
                        }
                        /* acknowledge */
@@ -2344,9 +2356,11 @@ static int lcr_indicate(struct ast_channel *ast, int cond, const void *data, siz
                        break;
 #ifdef AST_CONTROL_SRCUPDATE
                case AST_CONTROL_SRCUPDATE:
+#else
+               case 20:
+#endif
                        CDEBUG(call, ast, "Received AST_CONTROL_SRCUPDATE from Asterisk.\n");
                         break;
-#endif
                 default:
                        CERROR(call, ast, "Received indicate from Asterisk with unknown condition %d.\n", cond);
                         res = -1;
@@ -2734,13 +2748,14 @@ static int lcr_config_exec(struct ast_channel *ast, void *data, char **argv)
 int load_module(void)
 {
        u_short i;
+       char options_error[256];
 
        for (i = 0; i < 256; i++) {
                flip_bits[i] = (i>>7) | ((i>>5)&2) | ((i>>3)&4) | ((i>>1)&8)
                             | (i<<7) | ((i&2)<<5) | ((i&4)<<3) | ((i&8)<<1);
        }
 
-       if (read_options() == 0) {
+       if (read_options(options_error) == 0) {
                CERROR(NULL, NULL, "%s", options_error);
 
                #ifdef LCR_FOR_ASTERISK
@@ -2802,6 +2817,8 @@ int load_module(void)
                                 "    n - Don't detect dtmf tones on called channel.\n"
                                 "    h - Force data call (HDLC).\n" 
                                 "    t - Disable mISDN_dsp features (required for fax application).\n"
+                                "    q - Add queue to make fax stream seamless (required for fax app).\n"
+                                "        Use queue size in miliseconds for optarg. (try 250)\n"
                                 "    f - Adding fax detection. It it timeouts, mISDN_dsp is used.\n"
                                 "        Use time to detect for optarg.\n"
                                 "    c - Make crypted outgoing call, optarg is keyindex.\n"
@@ -2813,6 +2830,12 @@ int load_module(void)
                                 "   vt - txgain control\n"
                                 "        Volume changes at factor 2 ^ optarg.\n"
                                 "    k - use keypad to dial this call.\n"
+                                "\n"
+                                "set LCR_TRANSFERCAPABILITY to the numerical bearer capabilty in order to alter caller's capability\n"
+                                " -> use 16 for fax (3.1k audio)\n"
+                                "\n"
+                                "To send a fax, you need to set LCR_TRANSFERCAPABILITY environment to 16, also you need to set\n"
+                                "options: \"n:t:q250\" for seamless audio transmission.\n"
                );