Sponsor: VoiceMeUp - Corporate & Wholesale VoIP Services

VoIP Mailing List Archives
Mailing list archives for the VoIP community
 SearchSearch 

[Freeswitch-users] More codec playback issues


 
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> freeSWITCH Users
View previous topic :: View next topic  
Author Message
bwood-lists at jacosof...
Guest





PostPosted: Thu Nov 06, 2008 2:07 pm    Post subject: [Freeswitch-users] More codec playback issues Reply with quote

I'm doing some more testing with various codecs. I'm seeing some more
weirdness with the selection of a codec by file extension. I'm testing
this on FreeSWITCH trunk 10270.

The following script works with the .wav and .gsm extension, but
everything else seems to fail.

Using lowercase names (such as .g722) fail when recording with a "[ERR]
switch_core_file.c:66 switch_core_perform_file_open() Invalid file
format [g722] for [/tmp/recording.g722]!". Which is fine, I can use
uppercase, but then that plays back garbled audio.

This script should beep, record until you stop speaking, beep again,
pause, beep, playback, beep, hang up.


var allDigits = "";
function on_dtmf(session, type, obj, arg)
{
try {
if (type == "dtmf") {
allDigits += obj.digit;
console_log("info", "DTMF digit: " + session.name + " [" +
obj.digit + "] len [" + obj.duration + "]\n\n");
}
} catch (e) {
console_log("err", e + "\n");
}
return true;
}


// .gsm works, .wav works
//filename = "/tmp/recording.gsm"
//filename = "/tmp/recording.wav"

// These all result in garbled playback
//filename = "/tmp/recording.GSM"
filename = "/tmp/recording.G722"
/filename = "/tmp/recording.SPEEX"
//filename = "/tmp/recording.LPC"
//filename = "/tmp/recording.PCMU"
//filename = "/tmp/recording.PCMA"
//filename = "/tmp/recording.AMR"



session.waitForAnswer(10000);
session.execute("sleep", "2000");

console_log("info", "*****BEGIN*****");
session.execute("gentones", "%(500,0,800)");
rtn = session.recordFile(filename, on_dtmf, "", 240, 500, 3);
session.execute("gentones", "%(500,0,800)");
console_log("info", "*****END*****");


session.execute("sleep", "2000");
session.execute("gentones", "%(500,0,800)");
session.streamFile(filename);
session.execute("gentones", "%(500,0,800)");

session.execute("sleep", "1000");
session.hangup();


_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
Back to top
brian at freeswitch.org
Guest





PostPosted: Thu Nov 06, 2008 2:30 pm    Post subject: [Freeswitch-users] More codec playback issues Reply with quote

When you're doing a playback with the native codecs you shouldn't put
any extension on it. It will automagically select the file based on
the current codec of the channel.

filename = "/tmp/recording"

Then have a file with all the codecs you support then FreeSWITCH will
pick the right one.


On Nov 6, 2008, at 1:06 PM, Brian Wood wrote:

Quote:
I'm doing some more testing with various codecs. I'm seeing some more
weirdness with the selection of a codec by file extension. I'm testing
this on FreeSWITCH trunk 10270.

The following script works with the .wav and .gsm extension, but
everything else seems to fail.

Using lowercase names (such as .g722) fail when recording with a
"[ERR]
switch_core_file.c:66 switch_core_perform_file_open() Invalid file
format [g722] for [/tmp/recording.g722]!". Which is fine, I can use
uppercase, but then that plays back garbled audio.

These are native file formats and should only play a G722 to a G722
channel. They are also case sensitive.

Quote:
This script should beep, record until you stop speaking, beep again,
pause, beep, playback, beep, hang up.

What exactly are you trying to accomplish?

/b

_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
Back to top
bwood-lists at jacosof...
Guest





PostPosted: Thu Nov 06, 2008 2:53 pm    Post subject: [Freeswitch-users] More codec playback issues Reply with quote

Brian West wrote:
Quote:
When you're doing a playback with the native codecs you shouldn't put
any extension on it. It will automagically select the file based on
the current codec of the channel.

filename = "/tmp/recording"

Then have a file with all the codecs you support then FreeSWITCH will
pick the right one.


But what if I want to force a specific codec?

Quote:
Quote:
This script should beep, record until you stop speaking, beep again,
pause, beep, playback, beep, hang up.


What exactly are you trying to accomplish?


Ultimately, what I'm trying to do is prevent FreeSWITCH from transcoding
on the fly. I would like to have prompts and menus pre-encoded in all
the codecs I expect to be using with my various endpoints and devices.

That script is just a really stupid test that I'll never use for
anything. I was trying to make SOX create a .G722 file, but it was
playing back all garbled, much like my GSM experience earlier in the
week. This script is an attempt to force FreeSWITCH to record in a
specific codec to determine if the problem was with SOX and the other
G722 encoder I tried.

I may be trying to do something that really isn't necessary, but it
seems like you should be able to do it.



_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
Back to top
brian at freeswitch.org
Guest





PostPosted: Thu Nov 06, 2008 3:09 pm    Post subject: [Freeswitch-users] More codec playback issues Reply with quote

On Nov 6, 2008, at 1:46 PM, Brian Wood wrote:

Quote:
Brian West wrote:
But what if I want to force a specific codec?

You turn on inbound late negotiation and make the decision in the
dialplan.

Quote:
Quote:
Quote:
This script should beep, record until you stop speaking, beep again,
pause, beep, playback, beep, hang up.


What exactly are you trying to accomplish?


Ultimately, what I'm trying to do is prevent FreeSWITCH from
transcoding
on the fly. I would like to have prompts and menus pre-encoded in all
the codecs I expect to be using with my various endpoints and devices.

Have the files in all the codecs and use playback without a file
extension it'll pick the one that matches the current codec.

Quote:
That script is just a really stupid test that I'll never use for
anything. I was trying to make SOX create a .G722 file, but it was
playing back all garbled, much like my GSM experience earlier in the
week. This script is an attempt to force FreeSWITCH to record in a
specific codec to determine if the problem was with SOX and the other
G722 encoder I tried.

We fixed the error in the GSM codec earlier this week. Not sure that
sox will create the right file format for G722. I might be wrong!

Quote:


I may be trying to do something that really isn't necessary, but it
seems like you should be able to do it.



_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org


_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
Back to top
bwood-lists at jacosof...
Guest





PostPosted: Thu Nov 06, 2008 3:40 pm    Post subject: [Freeswitch-users] More codec playback issues Reply with quote

Brian West wrote:
Quote:
You turn on inbound late negotiation and make the decision in the
dialplan.

But I'm trying to do this on outbound/originate sessions. So nothing's
going through the dialplan. Smile I'm initiating the script with originate
commands, from the CLI or XML-RPC.

Quote:
We fixed the error in the GSM codec earlier this week. Not sure that
sox will create the right file format for G722. I might be wrong!



I'm also not sure if SOX is producing a valid file. I also tried using
the ITU's ansi-c encoder with the same result, but I'm not completely
convinced it works either. I was trying to see if I could make
FreeSWITCH record and play back in various codecs, so I would have a
known/good file to try to decode with SOX and the ITU's code.


I also tried changing the filename in my script to /tmp/recording. I've
seen the auto extension select work for playback. If I don't specify an
extension when recording, it throws an error about the file format being
invalid. If I record as /tmp/recoding.G722 and playback as
/tmp/recording, it auto-selects the .G722 codec because that's what my
phone is using, but the playback is garbled.


So, I guess the better question for me to ask... is specifying a
extension to session.recordFile() the correct way to force recording in
a specifc codec (if, for some reason you _really_ want to do this)? OR,
is that just not supported and why I get garbled playback? .gsm and .wav
seem to work, and a hexdump of the files looks sane, so why not the others?

_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
Back to top
Display posts from previous:   
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> freeSWITCH Users All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

VoiceMeUp - Corporate & Wholesale VoIP Services