PJSIP Media Error

I work with the Raspberry Pi library and PJSIP Softphone, I have one raspberry, where everything works fine and who always gives an error. Sound device - A USB headset that is configured correctly means that I can play sounds through aplay path/to/file.

I am just starting a call with the button:

if ( button[1] ) { 
    digitalWrite( GPIO_LED_CALL3_AKTIVE, HIGH );
    while ( GPIO_Read( GPIO_BTN_CALL3 ) );
    dest_uri = pj_str( "sip:6001@" SIP_DOMAIN );
    call_init = 1;
}   
/* Initiate Call if call_init was set */
if ( call_init ) { 
    call_init = 0;
    printf ( "\n=============   Call to %s   =============\n",dest_uri );
    int status = pjsua_call_make_call( acc_id, &dest_uri, 0, NULL, NULL, NULL );
    delay ( 1000 );
}

The error that is being caused is as follows

Expression 'SetApproximateSampleRate( pcm, hwParams, sr )' failed in 'src/../../../portaudio/src/hostapi/alsa/pa_linux_alsa.c', line: 1294
Expression 'PaAlsaStreamComponent_InitialConfigure( &self->capture, inParams, self->primeBuffers, hwParamsCapture, &realSr )' failed in 'src/../../../portaudio/src/hostapi/alsa/pa_linux_alsa.c', line: 1870
Expression 'PaAlsaStream_Configure( stream, inputParameters, outputParameters, sampleRate, framesPerBuffer, &inputLatency, &outputLatency, &hostBufferSizeMode )' failed in 'src/../../../portaudio/src/hostapi/alsa/pa_linux_alsa.c', line: 1994
Expression 'SetApproximateSampleRate( pcm, hwParams, sr )' failed in 'src/../../../portaudio/src/hostapi/alsa/pa_linux_alsa.c', line: 1294
Expression 'PaAlsaStreamComponent_InitialConfigure( &self->capture, inParams, self->primeBuffers, hwParamsCapture, &realSr )' failed in 'src/../../../portaudio/src/hostapi/alsa/pa_linux_alsa.c', line: 1870
Expression 'PaAlsaStream_Configure( stream, inputParameters, outputParameters, sampleRate, framesPerBuffer, &inputLatency, &outputLatency, &hostBufferSizeMode )' failed in 'src/../../../portaudio/src/hostapi/alsa/pa_linux_alsa.c', line: 1994

I get a short audio output that stops after 1 or 2 seconds.

I create PJSIP by source, for example:

    sudo su

    apt−get install build−essential automake autoconf libtool \
       libasound2−dev libpulse−dev libssl−dev libsamplerate0−dev \
       libcommoncpp2−dev libccrtp−dev libzrtpcpp−dev libdbus−1−dev \
       libdbus−c++−dev libyaml−dev libpcre3-dev libgsm1−dev \ 
       libspeex−dev libspeexdsp−dev libcelt−dev
        cd /home/pi
        wget http://www.pjsip.org/release/2.4.5/pjproject−2.4.5.tar.bz2 
        tar xvjf pjproject −2.4.5.tar.bz2
        cd pjproject−2.4.5.tar.bz2
        ./configure && make dep && make

As far as I can tell, now this is a programming error, since the code works on one device. So this is the sound firmware configuration, otherwise I created pjsip incorrectly? Maybe I forget the package or w?

If you need more information about the code, I can give you more. Thank you for your time.

EDIT:

, :

static void ringback_start( pjsua_call_id call_id ) {
    print_Debug_Info( "*** Starting ringback to out_call ***\n" );
    pj_str_t fname = pj_str( "Sounds/Freizeichen3.wav" );
    pjsua_player_create( &fname, 0, &cm.player_id );
    pjsua_conf_connect( pjsua_player_get_conf_port( cm.player_id ), 0 );
}

static void ringback_stop( pjsua_call_id call_id ) {
    print_Debug_Info( "*** Stopping ringback to out_call ***\n" );
    pjsua_conf_disconnect( pjsua_player_get_conf_port( cm.player_id ), 0 );
    pjsua_player_destroy( cm.player_id );
}

, , , .

+4

Source: https://habr.com/ru/post/1626846/


All Articles