4

I am working with Raspberry Pi's and PJSIP Softphone library, i have one Raspberry where everything works fine and one who always throws a error. The sound device is an usb headset which is configured correctly, means i can play sounds via aplay path/to/file.

I am just starting a call via a 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 which is thrown looks like following

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 which stops after 1 or 2 seconds.

I have build PJSIP by source like following:

    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 say its now a programming error since the code works on one device. So is it an audio miss configuration oder did i build pjsip wrong? Maybe i forget a package or sth?

if you need more information about the code i can give you more. Thanks for your time.

EDIT:

I have playback methods which looks like following:

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 );
}

I have some feeling that this could create the error since i get the error even before the call is established.

4
  • Check if the ./pjlib/include/pj/config_site.h file is same on both the environments.
    – Nithish
    Feb 9, 2016 at 13:02
  • If you use both for capturing and playback, it will give this error..This is bug. I am sure the pi in which it is working, you have used it only for playback and not for capturing while the other device is used for both Feb 10, 2016 at 5:37
  • so i have looked into the config_site.h and it content was different on both system. So i adjusted everything and recompiled it but the error still appears.
    – Pete
    Feb 10, 2016 at 9:55
  • @MayukhSarkar i have edited my post and maybe you may look at it. I am not sure it that is what you mean with playback. Well one side is just doing nothing accept for accepting calls, the other side waits for a button to be pressed and then calls a specific client. So now if i switch the purposes of the devices, the error appears.
    – Pete
    Feb 10, 2016 at 10:32

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.