Greeting, I am making a pjsip sip application that is require to accept a call , then play a media file I use? pjmedia_wav_player_port_create, pjmedia_snd_port_create_player, pjmedia_snd_port_connect,? to play a sound file I call the pjsip from a linphone application, the call is answer and the File is played, (not on Linphone but from pjsip console application) How I can play the sound file on the linphone device ? Here is the code I used to play the file : ??? ??? ??? ??? pjmedia_session_info sess_info; ??? ??? ??? ??? const pjmedia_sdp_session *local_sdp; ??? ??? ??? ??? const pjmedia_sdp_session *remote_sdp; ??? ??? ??? ??? pjmedia_port *media_port; ??? ??? ??? ??? if (status_from_media != PJ_SUCCESS) { ??? ??? ??? ??? app_perror(THIS_FILE, "SDP negotiation has failed", status); ??? ??? ??? ??? /* Here we should disconnect call if we're not in the middle ??? ??? ??? ??? ?* of initializing an UAS dialog and if this is not a re-INVITE. ??? ??? ??? ??? ?*/ ??? ??? ??? ??? return 0; ??? ??? ??? ??? } ??? ??? ??? ??? /* Get local and remote SDP. ??? ??? ??? ???? * We need both SDPs to create a media session. ??? ??? ??? ???? */ ??? ??? ??? ??? status_from_media = pjmedia_sdp_neg_get_active_local(inv_from_media->neg, &local_sdp); ??? ??? ??? ??? status_from_media = pjmedia_sdp_neg_get_active_remote(inv_from_media->neg, &remote_sdp); ??? ??? ??? ??? /* Create session info based on the two SDPs. ??? ??? ??? ???? * We only support one stream per session for now. ??? ??? ??? ???? */ ??? ??? ??? ??? status_from_media = pjmedia_session_info_from_sdp(inv_from_media->dlg->pool, g_med_endpt, ??? ??? ??? ??? ??? ??? ??? ??? ?? 1, &sess_info, ??? ??? ??? ??? ??? ??? ??? ??? ?? local_sdp, remote_sdp); ??? ??? ??? ??? if (status_from_media != PJ_SUCCESS) { ??? ??? ??? ??? app_perror( THIS_FILE, "Unable to create media session", status); ??? ??? ??? ??? return 0; ??? ??? ??? ??? } ??? ??? ??? ??? /* If required, we can also change some settings in the session info, ??? ??? ??? ???? * (such as jitter buffer settings, codec settings, etc) before we ??? ??? ??? ???? * create the session. ??? ??? ??? ???? */ ??? ??? ??? ??? /* Create new media session, passing the two SDPs, and also the ??? ??? ??? ???? * media socket that we created earlier. ??? ??? ??? ???? * The media session is active immediately. ??? ??? ??? ???? */ ??? ??? ??? ??? status_from_media = pjmedia_session_create( g_med_endpt, &sess_info, ??? ??? ??? ??? ??? ??? ??? ???? &g_med_transport, NULL, &g_med_session ); ??? ??? ??? ??? if (status != PJ_SUCCESS) { ??? ??? ??? ??? app_perror( THIS_FILE, "Unable to create media session", status); ??? ??? ??? ??? return 0; ??? ??? ??? ??? } ??? ??? ??? ??? /* Get the media port interface of the first stream in the session. ??? ??? ??? ???? * Media port interface is basicly a struct containing get_frame() and ??? ??? ??? ???? * put_frame() function. With this media port interface, we can attach ??? ??? ??? ???? * the port interface to conference bridge, or directly to a sound ??? ??? ??? ???? * player/recorder device. ??? ??? ??? ???? */ ??? ??? ??? ??? pjmedia_session_get_port(g_med_session, 0, &media_port); ??? ??? ??? ??? ? /* Create file media port from the WAV file */ ??? status = pjmedia_wav_player_port_create(? inv_from_media->pool,??? /* memory pool??? ??? */ ??? ??? ??? ??? ??? ???? "C:\\Played.wav",??? /* file to play??? ??? */ ??? ??? ??? ??? ??? ????? 20,??? /* ptime.??? ??? */ ??? ??? ??? ??? ??? ????? 0,??? /* flags??? ??? */ ??? ??? ??? ??? ??? ????? 0,??? /* default buffer?? */ ??? ??? ??? ??? ??? ????? &media_port/* returned port??? */ ??? ??? ??? ??? ??? ????? ); ??? if (status != PJ_SUCCESS) { ??? app_perror(THIS_FILE, "Unable to use WAV file", status); ??? return 1; ??? } ??? ??? ??? ??? /* Create a sound Player device and connect the media port to the ??? ??? ??? ???? * sound device. ??? ??? ??? ???? */ ??? ??? ??? ??? status_from_media = pjmedia_snd_port_create_player( ??? ??? ??? ??? ??? ??? inv_from_media->pool,??? ??? ??? ??? /* pool??? ??? ??? */ ??? ??? ??? ??? ??? ??? 1,??? ??? ??? ??? ??? /* sound dev id??? ??? */ ??? ??? ??? ??? ??? ??? PJMEDIA_PIA_SRATE(&media_port->info),??? /* clock rate??? ??? */ ??? ??? ??? ??? ??? ??? PJMEDIA_PIA_CCNT(&media_port->info),??? /* channel count??? */ ??? ??? ??? ??? ??? ??? PJMEDIA_PIA_SPF(&media_port->info), /* samples per frame*/ ??? ??? ??? ??? ??? ??? PJMEDIA_PIA_BITS(&media_port->info),?? /* bits per sample? */ ??? ??? ??? ??? ??? ??? 0,??? ??? ??? ??? ??? /* options??? ??? */ ??? ??? ??? ??? ??? ??? &g_snd_player); ??? ??? ??? ??? if (status_from_media != PJ_SUCCESS) { ??? ??? ??? ??? app_perror( THIS_FILE, "Unable to create sound player", status); ??? ??? ??? ??? PJ_LOG(3,(THIS_FILE, "%d %d %d %d", ??? ??? ??? ??? ??? ??? ??? PJMEDIA_PIA_SRATE(&media_port->info),??? /* clock rate??? ??? */ ??? ??? ??? ??? ??? ??? PJMEDIA_PIA_CCNT(&media_port->info),??? /* channel count??? */ ??? ??? ??? ??? ??? ??? PJMEDIA_PIA_SPF(&media_port->info), /* samples per frame*/ ??? ??? ??? ??? ??? ???? PJMEDIA_PIA_BITS(&media_port->info)??? /* bits per sample? */ ??? ??? ??? ??? ??? )); ??? ??? ??? ??? return 0; ??? ??? ??? ??? } ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? status_from_media = pjmedia_snd_port_connect(g_snd_player, media_port); ??? ??? ??? ??? /* Create a sound recorder device and connect the media port to the ??? ??? ??? ???? * sound device. ??? ??? ??? ???? */ ??? ??? ??? ??? status_from_media = pjmedia_snd_port_create_rec( ??? ??? ??? ??? ??? ??? inv_from_media->pool,??? ??? ??? ??? /* pool??? ??? ??? */ ??? ??? ??? ??? ??? ??? -1,??? ??? ??? ??? ??? /* sound dev id??? ??? */ ??? ??? ??? ??? ??? ??? PJMEDIA_PIA_SRATE(&media_port->info),??? /* clock rate??? ??? */ ??? ??? ??? ??? ??? ??? PJMEDIA_PIA_CCNT(&media_port->info),??? /* channel count??? */ ??? ??? ??? ??? ??? ??? PJMEDIA_PIA_SPF(&media_port->info), /* samples per frame*/ ??? ??? ??? ??? ??? ??? PJMEDIA_PIA_BITS(&media_port->info),?? /* bits per sample? */ ??? ??? ??? ??? ??? ??? 0,??? ??? ??? ??? ??? /* options??? ??? */ ??? ??? ??? ??? ??? ??? &g_snd_rec); ??? ??? ??? ??? if (status != PJ_SUCCESS) { ??? ??? ??? ??? app_perror( THIS_FILE, "Unable to create sound recorder", status); ??? ??? ??? ??? return 0; ??? ??? ??? ??? } Thanks and Regards -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20151021/3e9d2b1f/attachment.html>