Portier SIP

Pàgina inicial

Reply to this message
Autor: Frédéric
Data:  
A: Guilde
Assumpte: Portier SIP
Hello,

Je suis en train de tester un client sip (pjsua, via le binding python¹) pour
faire un portier.

Je m'inspire de ce projet :

    https://github.com/mpodroid/door-berry


Je teste pour le moment juste la partie qui appelle le serveur (mon téléphone
IP, via son IP directe).

Et j'ai des soucis :o/ Ci-joint les logs que j'obtiens.

Dans log_0, j'utilise un sample_rate de 8000, comme dans door-berry. Mais ça
chie au niveau d'ALSA.

Dans log_1, j'ai mis 44100 ; là, le téléphone sonne bien, mais dès que je
décroche, la communication est stoppée tout de suite.

Une idée de ce qui coince ? Est-ce que c'est parce que je suis à 44100Hz ?
Comment faire pour me mettre à 8000Hz, si ALSA ne veut pas ?

Merci d'avance pour vos lumières.

¹ pas compris pourquoi il n'est pas dans debian (sid) ; j'ai dû recompiler le
paquet, et aller compiler à la main la binding python...
-- 
    Frédéric

sample_rate = 8000

$ python doorbot.py
18:19:22.857 os_core_unix.c !pjlib 2.1 for POSIX initialized
18:19:22.857 sip_endpoint.c  .Creating endpoint instance...
18:19:22.857          pjlib  .select() I/O Queue created (0x1c11b90)
18:19:22.857 sip_endpoint.c  .Module "mod-msg-print" registered
18:19:22.857 sip_transport.  .Transport manager created.
18:19:22.857   pjsua_core.c  .PJSUA state changed: NULL --> CREATED
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
[PJ] 18:19:22.954   pjsua_core.c  .pjsua version 2.1 for Linux-3.12.1/x86_64/glibc-2.17 initialized
        [2014-01-16 18:19:22.956046] DoorStation.__init__(): Account created
Expression 'paInvalidSampleRate' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2048
Expression 'PaAlsaStreamComponent_InitialConfigure( &self->capture, inParams, self->primeBuffers, hwParamsCapture, &realSr )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2719
Expression 'PaAlsaStream_Configure( stream, inputParameters, outputParameters, sampleRate, framesPerBuffer, &inputLatency, &outputLatency, &hostBufferSizeMode )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2843
Expression 'paInvalidSampleRate' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2048
Expression 'PaAlsaStreamComponent_InitialConfigure( &self->capture, inParams, self->primeBuffers, hwParamsCapture, &realSr )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2719
Expression 'PaAlsaStream_Configure( stream, inputParameters, outputParameters, sampleRate, framesPerBuffer, &inputLatency, &outputLatency, &hostBufferSizeMode )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2843
Expression 'paInvalidSampleRate' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2048
Expression 'PaAlsaStreamComponent_InitialConfigure( &self->capture, inParams, self->primeBuffers, hwParamsCapture, &realSr )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2719
Expression 'PaAlsaStream_Configure( stream, inputParameters, outputParameters, sampleRate, framesPerBuffer, &inputLatency, &outputLatency, &hostBufferSizeMode )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2843
Expression 'paInvalidSampleRate' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2048
Expression 'PaAlsaStreamComponent_InitialConfigure( &self->capture, inParams, self->primeBuffers, hwParamsCapture, &realSr )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2719
Expression 'PaAlsaStream_Configure( stream, inputParameters, outputParameters, sampleRate, framesPerBuffer, &inputLatency, &outputLatency, &hostBufferSizeMode )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2843
Expression 'paInvalidSampleRate' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2048
Expression 'PaAlsaStreamComponent_InitialConfigure( &self->capture, inParams, self->primeBuffers, hwParamsCapture, &realSr )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2719
Expression 'PaAlsaStream_Configure( stream, inputParameters, outputParameters, sampleRate, framesPerBuffer, &inputLatency, &outputLatency, &hostBufferSizeMode )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2843
Expression 'paInvalidSampleRate' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2048
Expression 'PaAlsaStreamComponent_InitialConfigure( &self->capture, inParams, self->primeBuffers, hwParamsCapture, &realSr )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2719
Expression 'PaAlsaStream_Configure( stream, inputParameters, outputParameters, sampleRate, framesPerBuffer, &inputLatency, &outputLatency, &hostBufferSizeMode )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2843
Expression 'paInvalidSampleRate' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2048
Expression 'PaAlsaStreamComponent_InitialConfigure( &self->capture, inParams, self->primeBuffers, hwParamsCapture, &realSr )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2719
Expression 'PaAlsaStream_Configure( stream, inputParameters, outputParameters, sampleRate, framesPerBuffer, &inputLatency, &outputLatency, &hostBufferSizeMode )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2843
Expression 'paInvalidSampleRate' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2048
Expression 'PaAlsaStreamComponent_InitialConfigure( &self->capture, inParams, self->primeBuffers, hwParamsCapture, &realSr )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2719
Expression 'PaAlsaStream_Configure( stream, inputParameters, outputParameters, sampleRate, framesPerBuffer, &inputLatency, &outputLatency, &hostBufferSizeMode )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2843
[PJ] 18:19:25.390    pjsua_aud.c  ..Unable to open sound device: Invalid sample rate [status=469996]
        Traceback (most recent call last):
  File "doorbot.py", line 253, in <module>
    bot._station.call()
  File "doorbot.py", line 197, in call
    self._call = self._account.make_call("sip:%s" % SIP_SERVER, DoorStationCallCallback())
  File "/usr/local/src/door-berry/station/pjsua.py", line 1198, in make_call
    self._lib()._err_check("make_call()", self, err)
  File "/usr/local/src/door-berry/station/pjsua.py", line 2625, in _err_check
    raise Error(op_name, obj, err_code, err_msg)
pjsua.Error: Object: {Account sip:raspi@st2030s}, operation=make_call(), error=Invalid sample rate

sample_rate == 44100

$ python doorbot.py
18:17:35.392 os_core_unix.c !pjlib 2.1 for POSIX initialized
18:17:35.393 sip_endpoint.c  .Creating endpoint instance...
18:17:35.393          pjlib  .select() I/O Queue created (0x29ceb90)
18:17:35.393 sip_endpoint.c  .Module "mod-msg-print" registered
18:17:35.393 sip_transport.  .Transport manager created.
18:17:35.393   pjsua_core.c  .PJSUA state changed: NULL --> CREATED
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
[PJ] 18:17:35.483   pjsua_core.c  .pjsua version 2.1 for Linux-3.12.1/x86_64/glibc-2.17 initialized
        [2014-01-16 18:17:35.485310] DoorStation.__init__(): Account created
[2014-01-16 18:17:35.545454] DoorStationCallCallback.on_state(): {Call sip:st2030s}
[2014-01-16 18:17:35.545802] DoorStationCallCallback.on_state(): [CALLING] To: sip:st2030s
  Call time: 00h:00m:00s, 1st res in 0 ms, conn in 0ms


[PJ] 18:17:35.546    pjsua_acc.c !....SIP registration failed, status=481 (CallLeg/Transaction Does Not Exist)
        [2014-01-16 18:17:35.596881] DoorStationCallCallback.on_state(): {Call sip:st2030s}
[2014-01-16 18:17:35.596956] DoorStationCallCallback.on_state(): [EARLY] To: sip:st2030s;tag=c0a80101-734b80e9
  Call time: 00h:00m:00s, 1st res in 52 ms, conn in 0ms


[ringing....]

[pickup phone]

[2014-01-16 18:17:41.248658] DoorStationCallCallback.on_state(): {Call sip:st2030s}
[2014-01-16 18:17:41.248748] DoorStationCallCallback.on_state(): [CONNECTING] To: sip:st2030s;tag=c0a80101-734b80e9
Call time: 00h:00m:00s, 1st res in 52 ms, conn in 0ms

[PJ] 18:17:41.248  pjsua_media.c  ......pjsua_aud_channel_update() failed for call_id 0 media 0: Invalid operation (PJ_EINVALIDOP)
        [PJ] 18:17:41.249   pjsua_call.c  .....Unable to create media session: No active media stream after negotiation (PJMEDIA_SDPNEG_ENOMEDIA) [status=220048]
        [2014-01-16 18:17:41.249206] DoorStationCallCallback.on_state(): {Call sip:st2030s}
[2014-01-16 18:17:41.249269] DoorStationCallCallback.on_state(): [CONFIRMED] To: sip:st2030s;tag=c0a80101-734b80e9
  Call time: 00h:00m:00s, 1st res in 52 ms, conn in 5705ms
  #0 audio PCMA @8kHz, inactive, peer=-
     SRTP status: Not active Crypto-suite: (null)
     RX pt=8, last update:00h:00m:00.001s ago
        total 0pkt 0B (0B +IP hdr) @avg=0bps/0bps
        pkt loss=0 (0.0%), discrd=0 (0.0%), dup=0 (0.0%), reord=0 (0.0%)
              (msec)    min     avg     max     last    dev
        loss period:   0.000   0.000   0.000   0.000   0.000
        jitter     :   0.000   0.000   0.000   0.000   0.000
     TX pt=8, ptime=20, last update:never
        total 0pkt 0B (0B +IP hdr) @avg=0bps/0bps
        pkt loss=0 (0.0%), dup=0 (0.0%), reorder=0 (0.0%)
              (msec)    min     avg     max     last    dev
        loss period:   0.000   0.000   0.000   0.000   0.000
        jitter     :   0.000   0.000   0.000   0.000   0.000
     RTT msec      :   0.000   0.000   0.000   0.000   0.000



[crash!]

[2014-01-16 18:17:41.402495] DoorStationCallCallback.on_state(): {Call sip:st2030s}
[2014-01-16 18:17:41.402608] DoorStationCallCallback.on_state(): [DISCONNCTD] To: sip:st2030s;tag=c0a80101-734b80e9
  Call time: 00h:00m:00s, 1st res in 52 ms, conn in 5705ms
  #0 audio PCMA @8kHz, inactive, peer=-
     SRTP status: Not active Crypto-suite: (null)
     RX pt=8, last update:00h:00m:00.154s ago
        total 0pkt 0B (0B +IP hdr) @avg=0bps/0bps
        pkt loss=0 (0.0%), discrd=0 (0.0%), dup=0 (0.0%), reord=0 (0.0%)
              (msec)    min     avg     max     last    dev
        loss period:   0.000   0.000   0.000   0.000   0.000
        jitter     :   0.000   0.000   0.000   0.000   0.000
     TX pt=8, ptime=20, last update:never
        total 0pkt 0B (0B +IP hdr) @avg=0bps/0bps
        pkt loss=0 (0.0%), dup=0 (0.0%), reorder=0 (0.0%)
              (msec)    min     avg     max     last    dev
        loss period:   0.000   0.000   0.000   0.000   0.000
        jitter     :   0.000   0.000   0.000   0.000   0.000
     RTT msec      :   0.000   0.000   0.000   0.000   0.000