[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Linphone-developers] raspberry pi

From: Leland Green
Subject: Re: [Linphone-developers] raspberry pi
Date: Thu, 10 Mar 2016 15:52:19 -0600

Hi Toshi,

That is a Python script. You'll need to have Python installed. (I still use 2.7.x)

Then you type:

sudo python <filename>

Is that what you mean?

If you mean how to adapt this to a real-world example, have released a script that I wrote starting with this example. I added a motion sensor and many other things. There is a schematic included, but it should work as-is without the sensor or any custom hardware. (You may see a delay on starting it.)There are a couple of issues, but I have worked out many others. You are welcome to branch the code or do whatever you'd like with it. The repository is here:

I'd be happy to answer questions. Feel free to contact me off-list. (You can find my contact info in the README file of the project.)

Hope this helps,

On Wed, Mar 9, 2016 at 5:39 PM, Mario Takamatsu <address@hidden> wrote:
hi thanks for developed linphone for PI.
i just start using code, so i don’t know to install thinks.
i able to do:
 $ wget
 $ sudo apt-get install python-setuptools
   $ sudo easy_install pip
   $ sudo pip install wheel
   $ sudo pip install --upgrade pip
   $ sudo pip install linphone4raspberry-3.9.0-cp27-none-any.whl
   $ python
   import linphone
but now how to make the file to start linphone from this code?

#!/usr/bin/env python
import linphone
import logging
import signal
import time
class SecurityCamera:
  def __init__(self, username='', password='', whitelist=[], camera='', snd_capture='', snd_playback=''):
    self.quit = False
    self.whitelist = whitelist
    callbacks = {
      'call_state_changed': self.call_state_changed,
    # Configure the linphone core
    signal.signal(signal.SIGINT, self.signal_handler)
    self.core =, None, None)
    self.core.max_calls = 1
    self.core.echo_cancellation_enabled = False
    self.core.video_capture_enabled = True
    self.core.video_display_enabled = False
    self.core.stun_server = ''
    self.core.firewall_policy = linphone.FirewallPolicy.PolicyUseIce
    if len(camera):
      self.core.video_device = camera
    if len(snd_capture):
      self.core.capture_device = snd_capture
    if len(snd_playback):
      self.core.playback_device = snd_playback
    # Only enable PCMU and PCMA audio codecs
    for codec in self.core.audio_codecs:
      if codec.mime_type == "PCMA" or codec.mime_type == "PCMU":
        self.core.enable_payload_type(codec, True)
        self.core.enable_payload_type(codec, False)
    # Only enable VP8 video codec
    for codec in self.core.video_codecs:
      if codec.mime_type == "VP8":
        self.core.enable_payload_type(codec, True)
        self.core.enable_payload_type(codec, False)
    self.configure_sip_account(username, password)
  def signal_handler(self, signal, frame):
    self.quit = True
  def log_handler(self, level, msg):
    method = getattr(logging, level)
  def call_state_changed(self, core, call, state, message):
    if state == linphone.CallState.IncomingReceived:
      if call.remote_address.as_string_uri_only() in self.whitelist:
        params = core.create_call_params(call)
        core.accept_call_with_params(call, params)
        core.decline_call(call, linphone.Reason.Declined)
        chat_room = core.get_chat_room_from_uri(self.whitelist[0])
        msg = chat_room.create_message(call.remote_address_as_string + ' tried to call')
  def configure_sip_account(self, username, password):
    # Configure the SIP account
    proxy_cfg = self.core.create_proxy_config()
    proxy_cfg.identity_address = self.core.create_address('sip:{username}'.format(username=username))
    proxy_cfg.server_addr = ';transport=tls'
    proxy_cfg.register_enabled = True
    auth_info = self.core.create_auth_info(username, None, password, None, None, '')
  def run(self):
    while not self.quit:
def main():
  cam = SecurityCamera(username='raspberry', password='pi', whitelist=['sip:address@hidden'], camera='V4L2: /dev/video0', snd_capture='ALSA: USB Device 0x46d:0x825')



Linphone-developers mailing list

reply via email to

[Prev in Thread] Current Thread [Next in Thread]