C program to print pascal triangle

C program to print pascal triangle #include <stdio.h> long factorial(int); int main() { int i, n, c; printf(“Enter the number of rows you wish to see in pascal triangle\n”); scanf(“%d”,&n); for (i = 0; i < n; i++) { for (c = 0; c <= (n – i – 2); c++) printf(” “); for (c = 0 ; c <= i; c++) printf(“%ld “,factorial(i)/(factorial(c)*factorial(i-c))); printf(“\n”); } return 0; } long factorial(int n) { int c; long result = 1; for (c = 1; c <= n; c++) result = result*c; return result; }

C Program example to Find Quotient and Remainder

C Program example to Find Quotient and Remainder #include<stdio.h> int main() { printf(“\n\n\t\tEduguru – C prgram example\n\n\n”); int c, d, n, a[100], b[100]; printf(“\n\nEnter number of elements in array :”); scanf(“%d”, &n); printf(“\n\nEnter %d elements\n”, n); for(c = 0; c < n; c++) scanf(“%d”, &a[c]); /* temporarily storing elements into array b starting from end … Read more

C Program to find the Sum of First n Natural numbers using for loop

C Program to find the Sum of First n Natural numbers

C Program to find the Sum of First n Natural numbers using for loop   #include <stdio.h> int main() { int n, count, sum = 0; printf(“Enter the value of n(positive integer): “); scanf(“%d”,&n); for(count=1; count <= n; count++) { sum = sum + count; } printf(“Sum of first %d natural numbers is: %d”,n, sum); … Read more

Matrix multiplication program in C

c program for two-dimensional arrays

Matrix multiplication program in C Matrix multiplication in C language to calculate the product of two matrices (two-dimensional arrays). A user inputs the orders and elements of the matrices. If the multiplication isn’t possible, an error message is displayed. You may have studied the method to multiply matrices in Mathematics. Matrix multiplication in C language … Read more

Asterisk DialStatus Channel Varriable

Asterisk channel variable DIALSTATUS Contains a text string signifying result of the last dial attempt: ANSWER: Call is answered. A successful dial. The caller reached the callee. BUSY: Busy signal. The dial command reached its number but the number is busy. NOANSWER: No answer. The dial command reached its number, the number rang for too … Read more

Asterisk cmd MYSQL

This is an ADD-ON of asterisk, is not installed by default and must be downloaded and installed with the asterisk-addons package.  However, in Asterisk 1.8 the addons have been integrated back into Asterisk. MYSQL(): Basic MYSQL Database Functionality (note that the help information returned from ‘show application MYSQL’ is a little misleading – what’s shown … Read more

Asterisk queue callback

SQL Table Structure If using the dialplan below, put the following table into a database called ‘acd‘. CREATE TABLE `bit_callers` ( `uniqueid` varchar(15) NOT NULL default ”, `callback` int(3) NOT NULL default ‘0’, `callbacknum` varchar(15) NOT NULL default ”, PRIMARY KEY (`uniqueid`), KEY `callback` (`callback`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; Dialplan Additions [support-queue] exten => s,1,Answer … Read more

Asterisk – best practice to play multiple sound files in .call files

If you want to play multiple sound file with .call then you can send it like this: Setvar: file_max=2 Setvar: file1=custom/1_message Setvar: file2=custom/2_message After that use asterisk’s dialplan to play files one-by-one. For example like this: exten => 123,3,Set(i=0); exten => 123,n(loop),Set(i=$[ ${i} + 1 ]) exten => 123,n,GotoIF($[ $i > ${file_max} ]?exit) exten => … Read more

Asterisk Play a file while calling for curl

In my dialplan I need to call a php file like below: exten => 6666,n,Set(foo=${CURL(http://reports.cr.mrgroup.in/IVR/sp.php?tid=${tid})}) it gives reponse after 1 min or 2min , I want to play a music file in these times. please give me some idea how to achieve this and if there any other option.

call transfer or call forwarding in asterisk

call transfer or call forwarding in asterisk [test] exten => 1000,1,Dial(SIP/User1) exten => 1000,n,Hangup() exten => 2000,1,Dial(SIP/User2) exten => 2000,n,Hangup() exten => 3000,1,Dial(SIP/User3) exten => 3000,n,Hangup() ;call forwarding exten => _*21*X.,1,NoCDR exten => _*21*X.,2,Set(DB(CFIM/${CALLERID(NUM)}=${EXTEN:4}) exten => _*21*X.,3,Playback(vm-saved) exten => _*21*X.,4,Hangup()