HOWTO patch .diff files to Asterisk

Hi Guys,

I have this .diff file that i want to patch to Asterisk. The author didn’t provide any documentation on which file exactly needs to be patched.

I know we are supposed to go like this:

root@asterisk#patch <patch.diff>

The file is “asterisk-1.4.18-codec-negotiation-20080313.diff”



From the asterisk source directory run this:
patch -p0 </path/to/patch.diff

Many thanks for your reply.

Is that the same if we wanted to patch asterisk-addons too? and what’s the difference between -p0 and -p1?


From “man patch” :smile:

 -pnum  or  --strip=num
          Strip  the  smallest  prefix containing num leading slashes from each file name found in the patch
          file.  A sequence of one or more adjacent slashes is counted as a single slash.  This controls how
          file  names found in the patch file are treated, in case you keep your files in a different direc-
          tory than the person who sent out the patch.  For example, supposing the file name  in  the  patch
          file was


          setting -p0 gives the entire file name unmodified, -p1 gives


          without the leading slash, -p4 gives


          and  not  specifying  -p  at  all just gives you blurfl.c.  Whatever you end up with is looked for
          either in the current directory, or the directory specified by the -d option.