Archie Rosenblum wrote: > > I am new to pjsip project and was unable to find the answer to a > conference question in the old archives or help. Here is my scenario: > > > > I have two wav messages to play to users. Both are created in the > beginning of the program with pjsua_player_create, etc. > > > > When the caller connects, the first message is played by calling > pjsua_conf_connect. This is looped. > > The caller is asked to type in a few digits. > > If the digits are incorrect, the first message is stopped by removing > the user from the conference, and the second message is played. The > second message is not looped. > > When the second message ends, I would like to reconnect the user to > the first message. > > > > Questions: How do I know when a non-looped message is finished > playing? Is there an event I can catch? There is an API to reset the > playing to the beginning, but I am unable to figure out when it > finishes playing. > When you create your wav player, with pjsua_player_create, you can also register a callback function, from pjmedia. This function will be automaticaly fired when the end of file is reached. pjsua_player_id player_id = PJSUA_INVALID_ID; pjmedia_port *media_port; // create player pjsua_player_get_port(player_id, &media_port); // register end of file callback pjmedia_wav_player_set_eof_cb(media_port, args, &on_wavplayerEof_callback); ("args" is void* pointer, if you want to send data, available in the callback function) This End Of File callback function has to be written this way: static PJ_DEF(pj_status_t) on_wavplayerEof_callback(pjmedia_port* media_port, void* args) { ... return PJ_SUCCESS; } Note that if you want to destroy the player, directly from the callback function, you need to return anything but PJ_SUCCESS (example: -1). Electrocut > > > > Any help is appreciated. > > > > Take care, > > Archie > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Visit our blog: http://blog.pjsip.org > > pjsip mailing list > pjsip at lists.pjsip.org > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org >