Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Punchblock returns incorrect recording URI #258

Open
system123 opened this issue Oct 13, 2016 · 6 comments
Open

Punchblock returns incorrect recording URI #258

system123 opened this issue Oct 13, 2016 · 6 comments

Comments

@system123
Copy link

I am initialising a recording in Adhearsion using the following code (note: I am using Asterisk 11)

def record_call record async: true, format: 'wav49' do |event| puts event.recording.uri end end

If I use the standard wav format then all recording URIs are correct, the issue comes in with the wav49 format, as this format has two possible valid extensions. It can either record to a .wav file or to a .wav49 file. Punchblock always returns the filename with a .wav49 extension however, some Asterisk instances appear to record to a .wav extension thus punchblock returns an incorrect URI for the recording.

@bklang
Copy link
Member

bklang commented Oct 13, 2016

@system123 for documentation sake, can you include Asterisk trace logs so we can see what Asterisk returns? I'd like to know whether we can rely on some specific data returned from Asterisk, or if we have to infer something (obviously the former is preferable)

@bklang
Copy link
Member

bklang commented Oct 13, 2016

Thanks for the logs (sent privately). The problem here is that Asterisk doesn't actually tell us what the filename is. When we send a request to start recording, it looks like this:

Action: monitor
ActionID: 74fa5222-d67d-43a8-a274-1d70cc98ad07
Channel: SIP/trunk-0000000d
File: /var/punchblock/record/6aadcc7b-c328-4773-9f72-9c2622debf63
Format: wav49
Mix: true

Response: Success
ActionID: 74fa5222-d67d-43a8-a274-1d70cc98ad07
Message: Started monitoring channel

Event: VarSet
Privilege: dialplan,all
Channel: SIP/trunk-0000000d
Variable: __MONITORED
Value: true
Uniqueid: 1476386347.19

Event: MonitorStart
Privilege: call,all
Channel: SIP/trunk-0000000d
Uniqueid: 1476386347.19

And when the recording completes:

Event: MonitorStop
Privilege: call,all
Channel: SIP/trunk-0000000d
Uniqueid: 1476386360.20

As you can see, we request the filename of the recording, but don't specify an extension, only a format. Asterisk gets to choose the extension based on its internal rules. We have to guess.

If we are going to fix this in Punchblock/Adhearsion 3, then we'll need to replicate the logic that Asterisk uses to pick the file name suffix.

@bklang
Copy link
Member

bklang commented Oct 13, 2016

If it helps, the place to insert the logic to infer/guess the correct file name/extension is the Asterisk record component translator

@system123
Copy link
Author

Is it not possible to force the file extension by specifying it as part of the filename passed in the Monitor data?

I will have a look to see how Asterisk determines which extension to use.

@bklang
Copy link
Member

bklang commented Oct 13, 2016

The Asterisk Monitor docs don't specify, but the source code doesn't seem to care whether a file extension is provided.

@system123
Copy link
Author

It appears that Asterisk hardcode the replacement of wav49 to WAV as the extension. This can be seen here

Thus the easiest will be for Punchblock to make the same replacement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants