There are many different ways but below is to the best of my recollection the way I did it.lowno wrote:How do you patch the chan_sip.so?
22 Aug 2009 - Edited Instructions to fix a bug and make them more general purpose
1) {login to your Asterisk box using the 'root' account - you can use putty to do this remotly}
2) {Backup the original version of chan_sip:}
{Hint: you can copy the following commands to the clip board, one at a time, and then right click on the putty window and the command will be copied there. Then just hit enter to execute the command in putty}
cp -p /usr/src/asterisk/channels/chan_sip.c /usr/src/asterisk/channels/chan_sip.c.b4patch
cp -p /usr/src/asterisk/channels/chan_sip.c.orig /usr/src/asterisk/channels/chan_sip.c.orig.b4patch
cp -p /usr/src/asterisk/channels/chan_sip.so /usr/src/asterisk/channels/chan_sip.so.b4patch
cp -p /usr/lib/asterisk/modules/chan_sip.so /usr/lib/asterisk/modules/chan_sip.so.b4patch
mv /usr/src/asterisk/channels/chan_sip.c.orig /usr/src/asterisk/channels/chan_sip.c.orig.b4patch
{used mv here to rename the chan_sip.c.orig if there was one so it won't interfer with the application of the patch later on}
3) {Navigate to the Asterisk source directory where chan_sip.c is located}
cd /usr/src/asterisk/channels
4) {highlight the patch text from the webpage here and copy the text to your clipboard}
5) {open a blank text file named chan_sip_mj_patch.txt}
cat > chan_sip_mj_patch.txt
6) {right click the mouse on the putty window to paste the text into the open chan_sip_mj_patch.txt}
7) {use the keyboard command below to close and save the chan_sip_mj_patch.txt file}
{Edit: 22 Aug 2009 - After pasting the text into putty hit return once before the Cntrl-d to eliminate the unexpected end in middle of line warning during patch}
Cntrl-D
{Edit: 22 Aug 2009 modified the patch command to assist with tab vs. spaces in patch file}
patch -l <chan_sip_mj_patch.txt
9) {move up one level to the asterisk source directory}
cd ..
10) {Compile your new chan_sip.so...saving a copy of the compilation messages to /tmp/make.all}
{Edit: If you have problems with the following command on your distro then just use the plain make command.}
make all 2>&1|tee /tmp/make.all
{If no errors during the compilation then stop asterisk and install the new chan_sip.so}
11) {stop asterisk}
/usr/sbin/asterisk -rx "stop gracefully"
12) {Copy the new chan_sip.so to the asterisk modules directory}
cp -p /usr/src/asterisk/channels/chan_sip.so /usr/lib/asterisk/modules/chan_sip.so
13) {Restart Asterisk}
/usr/sbin/asterisk