Previous Up Next

11.10  Sequence manipulations

11.10.1  use of push

   1 service push_seq {
       processing {
         dialog {
           response incoming INVITE() {
   5         uri<> students =
             <'sip:student.1@labri.fr',
             'sip:student.2@labri.fr',
             'sip:student.3@labri.fr',
             'sip:student.1@inria.fr',
  10         'sip:student.2@inria.fr',
             'sip:student.3@inria.fr'>;
     
             uri<100> st_inria;
             uri<100> st_labri;
  15         
             if (requestURI == 'sip:students@labri.fr') {
               foreach (student in students) {
                 if (student match ".*@labri\.fr") {
                   push st_labri student;
  20             }
               }
               return forward st_labri;
             }
             else if (requestURI == 'sip:students@inria.fr') {
  25           foreach (student in students) {
                 if (student match ".*@inria\.fr") {
                   push st_inria student;
                 }
               }
  30           return forward st_inria;
             }
             return forward;
           }
         }
  35   }
     }

11.10.2  use of pop

   1 service pop_seq {
       processing {
         dialog {
           response incoming INVITE() {
   5         uri<> students =
             <'sip:student1@labri.fr',
             'sip:student2@labri.fr',
             'sip:student3@labri.fr'>;
     
  10         uri<2> callee;
     
             foreach (student in students) {
               push callee pop students;
             }
  15         return forward callee;
           }
         }
       }
     }

Previous Up Next