I think i would need your help in this. I am facing issues while trying to
play .g729 file (I pasted function definition below). Looks like line
"file_def->getFileInstance(RTPStream()->getPayloadType());" returns null
value. I made sure g729 file is there in the path (For test I am using a
asterisk demo file). It also crashes after showing error.. This is what my
debug output is..

------------------------------------Debug
Output-----------------------------------------
[#7f9fff4cf700/1636] [onSipRequest, AmSession.cpp:763] DEBUG: onSipRequest:
method = INVITE
 [#7f9fff4cf700/1636] [updateRefreshMethod, AmSession.cpp:1106] DEBUG:
remote allows UPDATE, using UPDATE for session refresh.
 [#7f9fff4cf700/1636] [onInvite, DSMCall.cpp:105] DEBUG: before
runEvent(this, this, DSMCondition::Invite);
 [#7f9fff4cf700/1636] [runEvent, DSMStateEngine.cpp:539] DEBUG: checking
transition 'invite'
 [#7f9fff4cf700/1636] [runEvent, DSMStateEngine.cpp:548] DEBUG: transition
'invite' matched.
 [#7f9fff4cf700/1636] [runEvent, DSMStateEngine.cpp:575] DEBUG: running 4
actions of transition 'invite'
 [#7f9fff4cf700/1636] [runactions, DSMStateEngine.cpp:243] DEBUG: running 4
DSM action elements
 [#7f9fff4cf700/1636] [runactions, DSMStateEngine.cpp:248] DEBUG: executing
'playFile_precoded(/usr/local/lib/sems/audio/min_ivr/demo.predef,false)'
 [#7f9fff4cf700/1636] [execute, DSMCoreModule.cpp:317] DEBUG: par1 =
'/usr/local/lib/sems/audio/min_ivr/demo.predef', par2 = false
 [#7f9fff4cf700/1636] [open, AmPrecodedFile.cpp:194] DEBUG: inserting codec
'G729' file '/usr/local/lib/sems/audio/min_ivr/dir-intro.g729' and id 18
 [#7f9fff4cf700/1636] [addCodec, AmPlugIn.cpp:660] DEBUG: codec id 100
inserted
 [#7f9fff4cf700/1636] [addPayload, AmPlugIn.cpp:704] DEBUG: payload
'G729/8000' inserted with id 18 and order 0
 [#7f9fff4cf700/1636] [RTPStream, ../../core/AmSession.h:611] DEBUG:
creating RTP stream instance for session [0x7f9fe40027e0]
 [#7f9fff4cf700/1636] [playFile_precoded, DSMCall.cpp:612] ERROR: no payload
 [#7f9fff4cf700/1636] [runEvent, DSMStateEngine.cpp:622] DEBUG:
DSMException occured, type = file
 [#7f9fff4cf700/1636] [reply, AmSipDialog.cpp:749] DEBUG: reply:
transaction found!
 [#7f9fff4cf700/1636] [getSdpAnswer, AmSession.cpp:964] DEBUG:
AmSession::getSdpAnswer(...) ...
 [#7f9fff4cf700/1636] [setLocalPort, AmRtpStream.cpp:179] DEBUG: added
stream [0x7fa00400e010] to RTP receiver (0.0.0.0:40000)
Segmentation fault (core dumped)
------------------------------------------------------------------------------------------

--------------------------------------------------------------------------Function
Definition---------------------------------------------------------------------------------------------------
void DSMCall::playFile_precoded(const string& name, bool loop, bool front) {
AmPrecodedFileInstance* file;
AmPrecodedFile precoded_file;
AmPrecodedFile* file_def;
   if (precoded_file.open(name) < 0) {
      ERROR("loading precoded file");
        throw DSMException("file", "path", name);
      return ;
    }

  precoded_file.initPlugin();
  RTPStream()->setPayloadProvider(&precoded_file);
  file_def = &precoded_file;
  file = file_def->getFileInstance(RTPStream()->getPayloadType());
  if (!file) {
    ERROR("no payload\n");
        throw DSMException("file", "path", name);
        return;
  }



   if (!file || file->open()) {
    ERROR("audio file '%s' could not be opened for reading.\n",
          name.c_str());
    delete file;

    throw DSMException("file", "path", name);

    return;
  }

  if (loop)
    file->loop.set(true);

  if (front)
    playlist.addToPlayListFront(new AmPlaylistItem(file, NULL));
  else
    playlist.addToPlaylist(new AmPlaylistItem(file, NULL));

  audiofiles.push_back(file);
  CLR_ERRNO;
}
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

On Tue, Sep 30, 2014 at 9:34 AM, John Nash <[email protected]> wrote:

> Dear Stefan,
>
> Please ignore my last mail. I typed that too soon. It turned out function
> needs to be defined in some other interfaces also. I am able to compile
> now. Will keep updated.
>
> Regards,
>
> John
>
>
>
> On Mon, Sep 29, 2014 at 4:02 PM, John Nash <[email protected]> wrote:
>
>> OK I implemented function void DSMCall::playFile_precoded(const string&
>> name, bool loop, bool front) and built dsm.so module and tried loading sems
>> but hit an error
>>  ERROR: could not find action for
>> 'playFile_precoded("/usr/local/lib/sems/audio/min_ivr/demo.predef")'
>> (missing import?)
>>
>> As this function is in DSMCALL.cpp and DSMCALL.h it should be able to
>> parse right?
>>
>> On Mon, Sep 29, 2014 at 1:12 PM, Stefan Sayer <[email protected]>
>> wrote:
>>
>>> John Nash wrote on 09/28/2014 06:11 AM:
>>> > Sorry i was busy working something else last few days. I have started
>>> > going through the code before changes. Before I go and start making
>>> > mess in stable code I want to be clear on what I am doing.
>>> >
>>> > In prerecorded application I think following lines are responsible to
>>> > finally play a file.
>>> >
>>> > 1- file->open() ---- Open the file of correct codec as per
>>> payload-type.
>>> > 2- setOutput(file); ---- It i think copies the buffer into session to
>>> > finally play.
>>> not really, it sets the pointer of the session's output so that when
>>> audio is requested its read from there
>>>
>>> > 3- AmSession::onSessionStart(); ---- This starts playing the file.
>>> >
>>> > Now the real reason i want to implement this in playfile() function of
>>> > DSM.cpp because I want to use playfile_precoded (Lets say) multiple
>>> > times (I want to play files like "You.g729", then "have.g729" then
>>> > "Hundred.g729"...and so on.
>>> >
>>> > If we maky a playfile_precoded() it will be like this ...
>>> > {
>>> >
>>> > AmPrecodedFileInstance* file =
>>> > file_def->getFileInstance(RTPStream()->getPayloadType());
>>> > if (!file) {
>>> > ERROR("no payload\n");
>>> > }
>>> > if (!file || file->open()) {
>>> > ERROR("PrecodedDialog::onSessionStart: Cannot open file\n");
>>> > dlg->bye();
>>> > setStopped();
>>> > return;
>>> > }
>>> >
>>> > setOutput(file);
>>> >
>>> > }
>>> >
>>> > But if i call this function multiple times wouldn't it set buffer to
>>> > last file?.. There should be some kind of queue to really work it out
>>> > (Or may be there already is)
>>> there is a Playlist already in place for DSM. playFile in DSM just
>>> adds them to the playlist, you can simply do the same with a precoded
>>> file instance. have a look at the code in DSMCall and DSMCoreModule.
>>>
>>> >
>>> > Also I need to implement Stop Function?
>>> already taken care of
>>>
>>> stefan
>>>
>>>
>>
>
_______________________________________________
Sems mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/sems

Reply via email to