eXosip2 function missed? - sip

I am writing a software for an embedded device, the basic function is VoIP, now I want to implement the SIP using eXosip2. I have downloaded the libeXosip2-3.6.0 source code from http://savannah.nongnu.org/projects/exosip/
I checked a few example code and find that to send an INVITE message, I need to call:
eXosip_call_build_initial_invite (in eXcall_api.c)
In this function, it will call osip_to_init , osip_to_parse , osip_to_free etc functions, however I could not find these functions in the eXosip2 folder....why?
Actually I also downloaded the osip2 library, I can find these functions, but can not see them in the eXosip2. Are these functions included in some object files that I can not read the content? Or actually I need to include both the osip2 and eXosip2?
I am sorry if this is a trivial question, I am novice to programming and would be very thankful if you can help.

You need to also build libosip2. Then link libeXosip2 to the libosip2 libraries

To be complete, you need to download libosip-3.6.0 and install it with those commands line (on a linux/unix platform):
$> tar -xvzf libosip-0.X.X.tar.gz
$> mkdir linux-build
$> cd linux-build
$> ../libosip-0.X.X/configure
$> make
# make install
Then compilation of eXosip2 should work.
The same is true for newer versions.

Related

cross-compile postgresql for ARM Sitara AM335x

I'm having trouble cross compiling PostgreSQL for my TI Sitara AM335x EVM SK. My host system is an i386 machine running Ubuntu 12.04.
My application is written in C++ using Qt. When I try and compile, I get the error that libpq.so is incompatible. I believe this is because the cross compiler is trying to use the host libpq.so instead of one for the target system (which as I have found out, doesn't exist).
I've downloaded the source for PostgreSQL with the intention of cross compiling that in order to give me the libpq.so library that will be compatible with my target system, however there is virtually no information on how to do this.
I have tried using the CC argument with the configure file to change my compiler to the following: CC=/home/tim/ti-sdk-am335x-evm-06.00.00.00/linux-devkit/sysroots/i686-arago-linux/usr/bin/arm-linux-gnueabihf-gcc but the configure script gives me this error: configure: error: cannot run C compiled programs. If you meant to cross compile, use --host.
The configure file makes a small reference to the --host option, but the only information in the file that I could find is in reference to mingw and windows, which isn't what I want.
I've done some quick searching through the configure file, and it references the --host option, but with no explanation of what is a valid host. I'm assuming that with --host option there will be an associated --target.
What arguments can I give the configure script so that it will cross compile with the correct compiler to generate a library that my target device can use? Are there any resources out there that I haven't found in regards to how the --host/--target works or how to use them?
OK, so after fiddling around for a little while, I think I was actually able to cross compile PostgreSQL and answer my own question.
Before I went any further, I had realized I had forgotten to add the path to my cross compiler to the PATH environment variable. I used the command export PATH=/path/to/cross/compiler:$PATH to insert the compiler path to the PATH environment variable.
Next, I did some experimenting with the --host option. To start off with I tried using ./configure --host=arm-linux-gnueabihf and running the configure script. The configure script seemed to accept this as the host argument. I then went to the next step of running the makefile. Running this makefile resulted in errors being generated. The errors were selected processor does not support Thumb mode. I did a quick search to see what information I could find about this error and came to this webpage: http://www.postgresql.org/message-id/E1Ra1sk-0000Pq-EL#wrigleys.postgresql.org.
This webpage gave me a bit more information since it seemed like the person was trying to do something very similar to me. One of the responders to the post mentioned that --disable-spinlocks is intended for processors that aren't supported by default by PostgreSQL. I emulated the arguments that were used in the website listed above and used the command: ./configure --host=arm-linux CC=arm-linux-gnueabihf-gcc AR=arm-linux-gnueabihf-ar CPP=arm-linux-gnueabihf-cpp --without-readline --without-zlib --disable-spinlocks to generate my makefile. This makefile actually generated all of the files, including the libpq.so library file I was needing.
Hope this helps somebody else in the future!

Using external files and modules in perl PAR Packer

I'm having some trouble using the pp command to create standalone executables on a Linux machine. It seems that every tutorial says a different thing and I'm a bit confused. I'd like your help regarding two issues:
1. I'm trying to include a module created by me (.pm file), but not sure how to do so and keep getting error messages. Should I use the -M option? or should it be -B? And once the module is included, how do I call it from the script? the usual way (i.e. "use module" and then "module::sub")?
2. I want to include some text files too. So far, I've tried -a and -l options, but not sure if they actually work. Which one should I use? Also, how do I open these files? For instance, if I pack the file tmp.txt, what should the open command look like?
Thank you very much!
Adding modules with the -M option and use the module as usual.
Adding your text file with the -a option, from pp's manual:
By default, files are placed under / inside the package with their original names.
so you should be able to read these text files with:
my $content = PAR::read_file('your_file.txt');

Perl. Fetching file from remote server, only core modules

I need help: is there a way to fetch a file from the remote server using only core modules of perl 5.8.8? File::Fetch became core module only from 5.9.
This comes up all the time. Take a look at the classic yes, even you can use CPAN. If you have the ability to create and run a Perl script, then you also have the ability to put a module in your local directory and use it. The requirement to use only core modules is entirely artificial.
In your case, LWP::Simple's getstore() function will do what you want. While it is technically not core, LWP::Simple is included by default with many Perl distributions. You may well already have it.
Update: so, you want to do this on 1000 servers? No need to manually install the module on each server. Use CPAN programmatically to download and install the module(s) you need (some tweaking will be needed to get CPAN to install it locally rather than in the root module library). Also Leon Timmermans's suggestion of fatpacking the module is another option.
If you really don't want to do it this way, then basically the answer is no: there is no simple way to fetch a remote file via HTTP using neither the appropriate modules, nor a system command (I didn't consider writing your own HTTP client to be a simple method, but that's fine if it works for you).
The only other potential solution I see would be a different approach to your problem, such as:
Using a script in a single location to get the file, then distribute
it to all 1000 servers via FTP.
Or, putting the file on an FTP server, then using a simple Perl
script on each server to fetch it via FTP.
As Dan already said, yes, even you can use CPAN. One approach his link doesn't mention is writing it as a normal CPAN-using distribution, and then fatpack it. Fatpacker combines a script with all its (pure-perl) dependencies, creating a single easy to distribute file.
You could use:
my $wgetoutput = `wget "$myFileToGet"`;
Stuff in backticks (`) will be given to the default shell, so you can call whatever you want (and are allowed) there.
Caveat: $myFileToGet could have stuff like "&& rm -rf *" in it, so dont forget to sanitize!

QR Code generation in shell / mac terminal

I want to create QR codes for a project I'm working on in applescript the resulting qr will be placed in the indesign document. I have found that there is a plugin for indesign but I suspect that requires user interaction.
So I've been search for how to generate the qr using a shell command. I've found things related to php and rails and even coldfusion but none of those will fit the bill on this. I need to generate them using shell command so image events or perl basically anything I can run from the command line that comes with the mac os
thanks for your help.
antotheer
I wonder if I could call a url using curl or somthing to get one ?
For doing something similar, we use libqrencode.
It's a c library for generating QR codes, but it comes with a command line utility (called qrencode) which lets you generate QR codes from a string, e.g.:
./qrencode -o /tmp/foo.png "This is the input string"
It supports most options you'd probably want (e.g. error correction level, image size, etc.).
We've used it in production for a year or two, with no problems.
I've only run it on linux systems, but there's no reason you shouldn't be able to compile it on Mac OS, assuming you have a compiler and build tools installed (and any libraries it depends on of course).
As Riccardo Cossu mentioned please use homebrew:
brew install qrencode
qrencode -o so.png "http://stackoverflow.com"

How to install a .deb file on a jailbroken iphone programmatically?

I'm developing an app with Xcode for the iPhone (jailbroken). Now I want to install a .deb file programmatically. How can I do this? I could execute a command to install it, but how? Is it enough if I install my app via Xcode on my jailbroken iPhone? (.ipa) or do I need to create a .deb? If yes, how?
Thank you very much!
Have a nice day.
edit: I made a app. In this app I have a file browser (only for documents directory). In this directory there are .deb files. Now, I want to install these .deb files programmatically if the user taps on one. How do I go about this?
AFAIK dpkg -i *.deb is the command to install a .deb. But you cannot install a .deb in a .deb because the package manager is locked thus you need a script or something.
If you want your app to function as a package installer, then yes, I would use
dpkg -i filename.deb
You could execute this command programmatically with a system() call, or an exec() call, with "dpkg -i filename.deb" as the command. You might want to fully qualify the path to dpkg (e.g. /usr/bin/dpkg ... or whatever it is ... I'm not on my phone now) if you use system() especially.
It might be that you find that you need to have root privileges to do this. See this on how to give your app root privileges.
Another option, that doesn't require your app running as root or using exec() or system() calls, is to use the technique I describe in this answer, which was about how to reboot an iPhone programmatically. Just as I used a script to call the reboot command, you could write a script to execute dpkg -i filename.deb. You'd just need to come up with a mechanism to pass the filename to your script, which I assume would change dynamically (unless your program used a temporary link that always pointed to the current .deb file to be installed.)
Many options.
You can learn the source code of Cydia.( Official site provide source code)
Learn source code from Icy Github. https://github.com/ripdev/Icy
The simple way, just use system function to invoke dpkg command.
NSString *appsyncDebPath=#"/var/root/appsync.deb";
NSString *cmdString=[NSString stringWithFormat:#"/usr/bin/dpkg -i %# >/tmp/dpkg.log;",appsyncDebPath];
const char *cmdChar=[cmdString UTF8String];
system(cmdChar);
You may show result from /tmp/dpkg.log
AFAIK jailbreaking an iPhone let you install ipa without certificates... so it's enough...