VoIP Mailing List Archives
Mailing list archives for the VoIP community |
|
View previous topic :: View next topic |
Author |
Message |
oza.4h07 at gmail.com Guest
|
Posted: Thu Jan 16, 2014 10:58 am Post subject: [asterisk-users] Starpy and Asterisk on different machines ? |
|
|
Thanks for replying.
So as python-starpy requires asterisk in Debian Wheezy repo, for a Debian setup the alternatives are either :
- to install it from source
- tto build my own custom package removing this asterisk dependency (is it easy or even possible ?)
- to use another solution such as pyst.
Regards
2014/1/16 Adolphe Cher-Aime <acheraime@gmail.com (acheraime@gmail.com)>
Quote: | Yes you can. This what starpy is for. It's build around Python twisted which allow you to write non blocked socket servers. You can use starpy as a fastagi server. Both AMI and FASTAGI can be configured from a .conf file as follow:
[AMI]
username=ami_user
secret=ami_pass
server=asterisk_ami_ip
port=ami_port
[FastAGI]
port=listen_port
interface=listen_ip
Hope that will help.
On Thu, Jan 16, 2014 at 10:02 AM, Olivier <oza.4h07@gmail.com (oza.4h07@gmail.com)> wrote:
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users
|
|
|
Back to top |
|
|
asterisk_list at earth... Guest
|
Posted: Thu Jan 16, 2014 11:32 am Post subject: [asterisk-users] Starpy and Asterisk on different machines ? |
|
|
On Thursday 16 January 2014, Olivier wrote:
Quote: | Thanks for replying.
So as python-starpy requires asterisk in Debian Wheezy repo, for a Debian
setup the alternatives are either :
- to install it from source
- tto build my own custom package removing this asterisk dependency (is it
easy or even possible ?)
- to use another solution such as pyst.
|
Installing from Source Code might well be the simplest solution.
If you need to install something on several boxen, you can make your own .deb
package -fairly- easily -- although it probably will have too many little
technicalities to be accepted by the Debian project.
What I have done with homebrew .debs is have the package depend on `build-
essential` and the necessary `*-dev` .debs, install the Source Code files under
/usr/src/, then do the build process in the postinst script. This allows you
to install the same .deb on 32 bit, 64 bit or Raspberry Pi architectures.
--
AJS
Answers come *after* questions.
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users |
|
Back to top |
|
|
tzafrir.cohen at xorco... Guest
|
Posted: Thu Jan 16, 2014 2:05 pm Post subject: [asterisk-users] Starpy and Asterisk on different machines ? |
|
|
On Thu, Jan 16, 2014 at 04:58:14PM +0100, Olivier wrote:
Quote: | Thanks for replying.
So as python-starpy requires asterisk in Debian Wheezy repo, for a Debian
setup the alternatives are either :
- to install it from source
- tto build my own custom package removing this asterisk dependency (is it
easy or even possible ?)
|
Should be simple.
Quote: | - to use another solution such as pyst.
|
- To "provide" Asterisk by a dummy package such as one built by equivs.
See, e.g. https://wiki.debian.org/CreateDummyPackage
--
Tzafrir Cohen
icq#16849755 jabber:tzafrir.cohen@xorcom.com
+972-50-7952406 mailto:tzafrir.cohen@xorcom.com
http://www.xorcom.com
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users |
|
Back to top |
|
|
oza.4h07 at gmail.com Guest
|
Posted: Fri Jan 17, 2014 3:15 am Post subject: [asterisk-users] Starpy and Asterisk on different machines ? |
|
|
2014/1/16 A J Stiles <asterisk_list@earthshod.co.uk (asterisk_list@earthshod.co.uk)>
Quote: | On Thursday 16 January 2014, Olivier wrote:
Quote: | Thanks for replying.
So as python-starpy requires asterisk in Debian Wheezy repo, for a Debian
setup the alternatives are either :
- to install it from source
- tto build my own custom package removing this asterisk dependency (is it
easy or even possible ?)
- to use another solution such as pyst.
|
Installing from Source Code might well be the simplest solution.
|
Yes, I agree.
Quote: |
If you need to install something on several boxen, you can make your own .deb
package -fairly- easily -- | For a complete packager beginner, how much time would it (very roughly) take to its first .deb package ?
Quote: | although it probably will have too many little
technicalities to be accepted by the Debian project.
What I have done with homebrew .debs is have the package depend on `build-
essential` and the necessary `*-dev` .debs, install the Source Code files under
/usr/src/, then do the build process in the postinst script. This allows you
to install the same .deb on 32 bit, 64 bit or Raspberry Pi architectures.
--
AJS
Answers come *after* questions.
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users
|
|
|
Back to top |
|
|
oza.4h07 at gmail.com Guest
|
Posted: Fri Jan 17, 2014 3:18 am Post subject: [asterisk-users] Starpy and Asterisk on different machines ? |
|
|
2014/1/16 Tzafrir Cohen <tzafrir.cohen@xorcom.com (tzafrir.cohen@xorcom.com)>
Quote: | On Thu, Jan 16, 2014 at 04:58:14PM +0100, Olivier wrote:
Quote: | Thanks for replying.
So as python-starpy requires asterisk in Debian Wheezy repo, for a Debian
setup the alternatives are either :
- to install it from source
- tto build my own custom package removing this asterisk dependency (is it
easy or even possible ?)
|
Should be simple.
Quote: | - to use another solution such as pyst.
|
- To "provide" Asterisk by a dummy package such as one built by equivs.
See, e.g. https://wiki.debian.org/CreateDummyPackage
|
I didn't know about these dummy packages.
Thank you very much for letting me know about: this solution is very interesting (though I wonder if starpy should really depend on asterisk in the first place, given it characteristics).
Thanks again.
|
|
Back to top |
|
|
asterisk_list at earth... Guest
|
Posted: Fri Jan 17, 2014 9:39 am Post subject: [asterisk-users] Starpy and Asterisk on different machines ? |
|
|
On Friday 17 January 2014, Olivier wrote:
Quote: | 2014/1/16 A J Stiles <asterisk_list@earthshod.co.uk>
Quote: | If you need to install something on several boxen, you can make your own
.deb
package -fairly- easily --
|
For a complete packager beginner, how much time would it (very roughly)
take to its first .deb package ?
|
There is plenty of information out there on the Internet (and to be quite
honest I have to check everytime I do this, because it's a bit of a rarity),
but here's my quick executive summary of the process. There are other ways to
do it and if you find one that works better for you, feel free to use that
method.
We are going to create a package "wibble_1.1-1_all.deb". This is a trivial
example, and just prints a silly message; but what is special about it is, the
same package can be installed on 32-bit, 64-bit and Raspberry Pi
architectures. (It most probably will work on other architectures too, but I
have no way to test this at the moment.)
1. Make a folder in which to hold the files for your package, named after the
package itself with version number (see how other people's .deb files are
named), and navigate to there;
$ mkdir wibble_1.1-1_all
$ cd wibble_1.1-1_all
2. Make a folder structure consisting of everything that the package is going
to install, but under here instead of under / . So for example there may be
folders usr/ , usr/bin/ , usr/lib/ , usr/share/ , etc/ and so forth.
("wibble" doesn't have any configuration files, so it doesn't need anything
under /etc/ .)
Important: Your package *must* have been built to install under /usr/ and
*not* under /usr/local/ ! /usr/local/ is supposed to be off limits to .deb
packages!
In order to work out what you need to put here, look at the Makefile and see
what it installs.
My package "wibble" consists of the following:
usr/src/wibble-1.1/wibble.c :
#include <stdio.h>
int main() {
printf("Wibble!\n");
};
And that's almost all there is to it. I said it was a trivial example.
3. Make sure you have a folder under usr/share/doc/*/ with "changelog" and
"copyright" files.
usr/share/doc/wibble/changelog :
wibble (1:1.1) stable; urgency=low
First .deb version of package.
usr/share/doc/wibble/copyright :
This package is licenced under a "Don't Ask, Don't Tell" licence.
Don't ask us for permission to copy it, and we won't tell you not to .....
4. Create a tarball "data.tar.gz" with your folder structure in it. This is
going to get extracted under / as part of the installation process. Now, a
.deb file is also supposed to include a file with the MD5 sums of all files in
data.tar.gz. We can use the power of bash to create the tarball and the
MD5sums file in one operation;
$ md5sum $(tar cvzf data.tar.gz usr | awk '!/\/$/{print}') > md5sums
Now, this needs explaining.
The inner command is
tar cvzf data.tar.gz usr
(obviously, if you have other folders beside usr, include these too)
and the v makes it list the files it added to the archive. This output then
gets piped through an awk filter:
awk '!/\/$/{print}'
which passes through only lines that don't end with a / character (lines
ending in / are folders). The $() wrapped around this pipeline command runs
the commands between the round brackets, and passes the final output (i.e.,
all the files processed by tar, but no folders) to the command which is using
it as an argument -- in this case, md5sum . So what this does is, it takes
the md5sum of every file (but not the folders) that is being added to the tar
archive. Finally, the more-than sign > directs the output into a file called
"md5sums".
5. Create a file "control" explaining the package. Here is mine:
Package: wibble
Version: 1:1.1
Architecture: all
Maintainer: AJS <adam@priceengines.co.uk>
Installed-Size: 123
Depends: build-essential
Section: stuff
Priority: standard
Homepage: http://blog.earthshod.co.uk/
Description: Just prints "wibble", which isn't very fantastic. What is
special about this package is, the same package should install correctly on
32-bit, 64-bit or Raspberry Pi architectures. (And others, but these have
not been tested for want of suitable candidate hardware.)
You will need to refer to other documentation online here. What is most
important is the "Depends:" line. Here you list every package that your
package depends on. If you get this right, then it will always pull in all
the packages it needs to install, even on a totally pristine, minimal system.
(Raspberry Pi users have the advantage here, because it is so quick and easy
to clone an SD card.) In particular, the "Installed-Size:123" is wrong (but
it seems to work in spite of this). Where storage space is tight, it will be
more important to get this right. Note also that continuation lines (as
after Description: above) start with a space.
6. Create shell scripts "postinst" (which runs after data.tar.gz is
unpacked, and finishes off the installation process) and "prerm" (which runs
first thing before you uninstall the package, and is supposed to tidy things
up). Here we are actually going to install the Source Code under /usr/src/
and then build it in the postinst script. This is going to create files that
were not in data.tar.gz, so we have to remove them in the prerm script.
Don't forget to run chmod +x on these scripts.
prerm:
#!/bin/bash
rm -rf /usr/src/wibble-1.1/
rm -f /usr/bin/wibble
postinst:
#!/bin/bash
OLDPWD=$(pwd)
cd /usr/src/wibble-1.1
gcc -owibble wibble.c
install -c -m755 wibble /usr/bin
cd "$OLDPWD"
7. Now you have to make an archive called "control.tar.gz" which contains the
"control" file, the prerm and postinst scripts and the md5sums file:
$ tar cvzf control.tar.gz control prerm postinst md5sums
8. Create a file called "debian-binary" which just tells dpkg the version of
the .deb format. This should contain the characters "2.0" followed by a line
break. Don't bother using your favourite editor; just type
$ echo "2.0" > debian-binary
9. Now we are ready to make the .deb file! We will create it outside the
folder so as not to pollute its structure.
$ ar rv ../$(basename $PWD).deb debian-binary control.tar.gz data.tar.gz
$() runs a command and uses its output.
basename $PWD returns just the name of the current folder (without the path
to it). If we are in a folder called /home/adam/programming/wibble_1.1-1_all
then it will return wibble_1.1-1_all . We use ../ before this to put it in
the parent folder, and .deb afterwards to give it a .deb extension.
10. Install the new package:
$ cd ..
$ sudo dpkg -i wibble_1.1-1_all.deb
11. Try it out:
$ wibble
12. Once you're bored of the package, uninstall it:
$ sudo dpkg -r wibble
13. (Just for fun) Make a new, architecture-specific .deb package called
wibble-bin_1.1-1-amd64.deb (or whatever architecture you are using) which
installs the compiled "wibble" binary as created here.
I've attached a tarball of my wibble_1.1-1_all folder, so you can try all this
out for yourself.
--
AJS
Answers come *after* questions.
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users |
|
Back to top |
|
|
oza.4h07 at gmail.com Guest
|
Posted: Fri Jan 17, 2014 10:25 am Post subject: [asterisk-users] Starpy and Asterisk on different machines ? |
|
|
Thank you very much for this invaluable answer !!
I'm gonna try it as soon as possible.
Thanks again.
2014/1/17 A J Stiles <asterisk_list@earthshod.co.uk (asterisk_list@earthshod.co.uk)>
Quote: | On Friday 17 January 2014, Olivier wrote:
Quote: | Quote: | If you need to install something on several boxen, you can make your own
.deb
package -fairly- easily --
|
For a complete packager beginner, how much time would it (very roughly)
take to its first .deb package ?
|
There is plenty of information out there on the Internet (and to be quite
honest I have to check everytime I do this, because it's a bit of a rarity),
but here's my quick executive summary of the process. There are other ways to
do it and if you find one that works better for you, feel free to use that
method.
We are going to create a package "wibble_1.1-1_all.deb". This is a trivial
example, and just prints a silly message; but what is special about it is, the
same package can be installed on 32-bit, 64-bit and Raspberry Pi
architectures. (It most probably will work on other architectures too, but I
have no way to test this at the moment.)
1. Make a folder in which to hold the files for your package, named after the
package itself with version number (see how other people's .deb files are
named), and navigate to there;
$ mkdir wibble_1.1-1_all
$ cd wibble_1.1-1_all
2. Make a folder structure consisting of everything that the package is going
to install, but under here instead of under / . So for example there may be
folders usr/ , usr/bin/ , usr/lib/ , usr/share/ , etc/ and so forth.
("wibble" doesn't have any configuration files, so it doesn't need anything
under /etc/ .)
Important: Your package *must* have been built to install under /usr/ and
*not* under /usr/local/ ! /usr/local/ is supposed to be off limits to .deb
packages!
In order to work out what you need to put here, look at the Makefile and see
what it installs.
My package "wibble" consists of the following:
usr/src/wibble-1.1/wibble.c :
#include <stdio.h>
int main() {
printf("Wibble!\n");
};
And that's almost all there is to it. I said it was a trivial example.
3. Make sure you have a folder under usr/share/doc/*/ with "changelog" and
"copyright" files.
usr/share/doc/wibble/changelog :
wibble (1:1.1) stable; urgency=low
First .deb version of package.
usr/share/doc/wibble/copyright :
This package is licenced under a "Don't Ask, Don't Tell" licence.
Don't ask us for permission to copy it, and we won't tell you not to .....
4. Create a tarball "data.tar.gz" with your folder structure in it. This is
going to get extracted under / as part of the installation process. Now, a
.deb file is also supposed to include a file with the MD5 sums of all files in
data.tar.gz. We can use the power of bash to create the tarball and the
MD5sums file in one operation;
$ md5sum $(tar cvzf data.tar.gz usr | awk '!/\/$/{print}') > md5sums
Now, this needs explaining.
The inner command is
tar cvzf data.tar.gz usr
(obviously, if you have other folders beside usr, include these too)
and the v makes it list the files it added to the archive. This output then
gets piped through an awk filter:
awk '!/\/$/{print}'
which passes through only lines that don't end with a / character (lines
ending in / are folders). The $() wrapped around this pipeline command runs
the commands between the round brackets, and passes the final output (i.e.,
all the files processed by tar, but no folders) to the command which is using
it as an argument -- in this case, md5sum . So what this does is, it takes
the md5sum of every file (but not the folders) that is being added to the tar
archive. Finally, the more-than sign > directs the output into a file called
"md5sums".
5. Create a file "control" explaining the package. Here is mine:
Package: wibble
Version: 1:1.1
Architecture: all
Maintainer: AJS <adam@priceengines.co.uk (adam@priceengines.co.uk)>
Installed-Size: 123
Depends: build-essential
Section: stuff
Priority: standard
Homepage: http://blog.earthshod.co.uk/
Description: Just prints "wibble", which isn't very fantastic. What is
special about this package is, the same package should install correctly on
32-bit, 64-bit or Raspberry Pi architectures. (And others, but these have
not been tested for want of suitable candidate hardware.)
You will need to refer to other documentation online here. What is most
important is the "Depends:" line. Here you list every package that your
package depends on. If you get this right, then it will always pull in all
the packages it needs to install, even on a totally pristine, minimal system.
(Raspberry Pi users have the advantage here, because it is so quick and easy
to clone an SD card.) In particular, the "Installed-Size:123" is wrong (but
it seems to work in spite of this). Where storage space is tight, it will be
more important to get this right. Note also that continuation lines (as
after Description: above) start with a space.
6. Create shell scripts "postinst" (which runs after data.tar.gz is
unpacked, and finishes off the installation process) and "prerm" (which runs
first thing before you uninstall the package, and is supposed to tidy things
up). Here we are actually going to install the Source Code under /usr/src/
and then build it in the postinst script. This is going to create files that
were not in data.tar.gz, so we have to remove them in the prerm script.
Don't forget to run chmod +x on these scripts.
prerm:
#!/bin/bash
rm -rf /usr/src/wibble-1.1/
rm -f /usr/bin/wibble
postinst:
#!/bin/bash
OLDPWD=$(pwd)
cd /usr/src/wibble-1.1
gcc -owibble wibble.c
install -c -m755 wibble /usr/bin
cd "$OLDPWD"
7. Now you have to make an archive called "control.tar.gz" which contains the
"control" file, the prerm and postinst scripts and the md5sums file:
$ tar cvzf control.tar.gz control prerm postinst md5sums
8. Create a file called "debian-binary" which just tells dpkg the version of
the .deb format. This should contain the characters "2.0" followed by a line
break. Don't bother using your favourite editor; just type
$ echo "2.0" > debian-binary
9. Now we are ready to make the .deb file! We will create it outside the
folder so as not to pollute its structure.
$ ar rv ../$(basename $PWD).deb debian-binary control.tar.gz data.tar.gz
$() runs a command and uses its output.
basename $PWD returns just the name of the current folder (without the path
to it). If we are in a folder called /home/adam/programming/wibble_1.1-1_all
then it will return wibble_1.1-1_all . We use ../ before this to put it in
the parent folder, and .deb afterwards to give it a .deb extension.
10. Install the new package:
$ cd ..
$ sudo dpkg -i wibble_1.1-1_all.deb
11. Try it out:
$ wibble
12. Once you're bored of the package, uninstall it:
$ sudo dpkg -r wibble
13. (Just for fun) Make a new, architecture-specific .deb package called
wibble-bin_1.1-1-amd64.deb (or whatever architecture you are using) which
installs the compiled "wibble" binary as created here.
I've attached a tarball of my wibble_1.1-1_all folder, so you can try all this
out for yourself.
--
AJS
Answers come *after* questions.
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users
|
|
|
Back to top |
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|