Index: res/res_monitor.c =================================================================== --- res/res_monitor.c (revision 89398) +++ res/res_monitor.c (working copy) @@ -424,6 +424,7 @@ char *arg = NULL; char *options = NULL; char *delay = NULL; + char *format = NULL; char *urlprefix = NULL; char tmp[256]; int stream_action = X_REC_IN | X_REC_OUT; @@ -446,24 +447,34 @@ parse = ast_strdupa((char*)data); AST_STANDARD_APP_ARGS(args, parse); - if (strchr(args.options, 'm')) - stream_action |= X_JOIN; - if (strchr(args.options, 'b')) - waitforbridge = 1; - if (strchr(args.options, 'i')) - stream_action &= ~X_REC_IN; - if (strchr(args.options, 'o')) - stream_action &= ~X_REC_OUT; + if (args.options) { + if (strchr(args.options, 'm')) + stream_action |= X_JOIN; + if (strchr(args.options, 'b')) + waitforbridge = 1; + if (strchr(args.options, 'i')) + stream_action &= ~X_REC_IN; + if (strchr(args.options, 'o')) + stream_action &= ~X_REC_OUT; + } - arg = strchr(args.format, ':'); - if (arg) { - *arg++ = 0; - urlprefix = arg; + if (args.format) { + format = args.format; + arg = strchr(args.format, ':'); + if (arg) { + *arg++ = 0; + urlprefix = arg; + } } + if (format && strcasecmp(format, "gsm") == 0) + format = "gsm"; + else + format = "wav"; + if (urlprefix) { snprintf(tmp, sizeof(tmp), "%s/%s.%s", urlprefix, args.fname_base, - ((strcmp(args.format, "gsm")) ? "wav" : "gsm")); + format); if (!chan->cdr && !(chan->cdr = ast_cdr_alloc())) return -1; ast_cdr_setuserfield(chan, tmp); @@ -485,7 +496,7 @@ return 0; } - res = ast_monitor_start(chan, args.format, args.fname_base, 1, stream_action); + res = ast_monitor_start(chan, format, args.fname_base, 1, stream_action); if (res < 0) res = ast_monitor_change_fname(chan, args.fname_base, 1);