tir, 20,.02.2007 kl. 12.03 -0800, skrev Beau Hargis:
> When moving from Asterisk to OpenPBX, I found one problem that prevents it
> from working. When using the Read() app, the maxdigits argument fails to
> work. '#' must be hit no matter the options set. The console reports this:
>
> -- Executing Wait("SIP/5061-0808c5b0", "1") in new stack
> -- Executing Read("SIP/5061-0808c5b0", "VAR|promptx|1") in new stack
> -- Accepting a maximum of 1 digits.
> -- Playing 'promptx' (language 'en')
> -- User entered '1'
>
> It will only accept the digits entered when I press '#', and it wont do
> anything until it times out. Because I specified '1' as maxdigits, it should
> stop the playback and return upon any digit entry. The same thing has been
> working on asterisk for about a year. The read_exec() functions are the same
> in openpbx and asterisk. I did notice, however, that there were differences
> between the [ast|opbx]_app_getdata() functions. The asterisk code is thus:
>
> int ast_app_getdata(struct ast_channel *c, char *prompt, char *s, int maxlen,
> int timeout)
> {
> int res,to,fto;
> /* XXX Merge with full version? XXX */
> if (maxlen)
> s[0] = '\0';
> if (prompt) {
> res = ast_streamfile(c, prompt, c->language);
> if (res < 0)
> return res;
> }
> fto = c->pbx ? c->pbx->rtimeout * 1000 : 6000;
> to = c->pbx ? c->pbx->dtimeout * 1000 : 2000;
>
> if (timeout > 0)
> fto = to = timeout;
> if (timeout < 0)
> fto = to = 1000000000;
> res = ast_readstring(c, s, maxlen, to, fto, "#");
> return res;
> }
>
> The openpbx code is different:
>
> int opbx_app_getdata(struct opbx_channel *c, char *prompt, char *s, int
> maxlen, int timeout)
> {
> int res=0;
> int to,fto;
> int result=0;
> /* XXX Merge with full version? XXX */
> if (maxlen)
> s[0] = '\0';
> if (prompt) {
> char *front;
> char *temp = opbx_strdupa(prompt);
> while ( (!res) && (front = strsep(&temp, "&")) ) {
> if ( (res = opbx_streamfile(c, front, c->language)) )
> {
> res = 0;
> break;
> }
> if (!res && !result)
> result = opbx_waitstream(c, OPBX_DIGIT_ANY);
> if (result)
> break;
> opbx_stopstream(c);
> }
> }
> fto = c->pbx ? c->pbx->rtimeout * 1000 : 6000;
> to = c->pbx ? c->pbx->dtimeout * 1000 : 2000;
>
> if (timeout > 0)
> fto = to = timeout;
> if (timeout < 0)
> fto = to = 1000000000;
> res = opbx_readstring(c, s, maxlen, to, fto, "#");
> if (result) {
> char tmp[256];
> snprintf(tmp, sizeof(tmp), "%c%s", result, s);
> snprintf(s, sizeof(tmp), "%s", tmp);
> }
> return res;
> }
>
>
> Something seems to have broken. Any thoughts?
> _______________________________________________
> Openpbx-dev mailing list
> [email protected]
> http://lists.openpbx.org/mailman/listinfo/openpbx-dev
Hi Beau,
did you try recompiling OpenPBX.org with the code you just posted?
If you could try this, confirm that it works and send me a patch file, I
will make sure this is fixed.
Mikael
_______________________________________________
Openpbx-dev mailing list
[email protected]
http://lists.openpbx.org/mailman/listinfo/openpbx-dev