# Methods overview Methods in SWML control the program flow and execute functions. This includes setting and unsetting variables, conditional statements, making calls, and sending faxes etc. ## **The AI method** The [ai](./ai/index.mdx) method is an incredibly powerful tool to instantiate an AI agent that holds a natural conversation with the caller, and perform actions based on their input. ## **Control-flow methods** ### execute and return The [execute](./execute.mdx) method is similar to a function call in most languages. It can be sent parameters, and it can return values using the [return](./return.mdx) object. The SWML function to be executed can exist as a subsection in the same SWML document, but it can also be a separate SWML document hosted on an internet-accessible web-server. ### transfer The [transfer](./transfer.mdx) statement transfers the execution to a different section or a different SWML document. Unlike the execute statement, the transfer statement doesnt return back to the calling section. ### goto and label The [goto](./goto.mdx) statement can jump to a specified [label](./label.mdx) either depending on a given condition or unconditionally, and repeatedly for a specified number of repetitions. ### cond and switch The [cond](./cond.mdx) statement is a general purpose conditional branching statement that executes SWML code based on the evaluation of a JavaScript expression. The [switch](./switch.mdx) statement allows switch-case like conditional execution depending on whether a certain variable is a certain value. ## **Call related methods** ### answer and hangup Use these methods to decide when to [answer](./answer.mdx) the call and when to [hangup](./hangup.mdx). Some other methods (like [play](./play.mdx)) will automatically answer calls, but you can use these methods to be more specific about when it happens. ### denoise and stop_denoise The [denoise](./denoise.mdx) method starts the noise reduction filter and the [stop_denoise](./stop_denoise.mdx) method stops it. ### live_transcribe The [live_transcribe](./live_transcribe/index.mdx) method starts a live transcription of the call. ### live_translate The [live_translate](./live_translate/index.mdx) method starts a live translation of the call. ### play and prompt The [play](./play.mdx) method can be used to send TTS speech, play audio files, send different rings etc. The [prompt](./prompt.mdx) method also plays TTS or URLs like play but it can receive keypad or speech input in response. ### connect Use the [connect](./connect/index.mdx) method to connect the caller to other phone or SIP calls. You can set it up to dial multiple numbers in series, parallel or a combination of the two. ### join_room The [join_room](./join_room.mdx) method seamlessly connects your call to a [video room](/guides/video/creating-a-video-room), enabling participants to join from various sources, including mobile apps, web browsers, or phone calls. ### receive_fax The [receive_fax](./receive_fax.mdx) method will interpret the call as a fax and process it. ### record, record_call and stop_record_call The [record](./record.mdx) and the [record_call](./record_call.mdx) methods will record the call. The record method, however, waits for the recording to terminate before continuing execution. The [record_call](./record_call.mdx) method starts a call recording in the background, and it stops recording when you call [stop_record_call](./stop_record_call.mdx). ### tap and stop_tap The [tap](./tap.mdx) method starts streaming the call to an RTP or a web socket sink. The [stop_tap](./stop_tap.mdx) method stops it. ### sip_refer The [sip_refer](./sip_refer.mdx) method transfer a SIP call by sending a SIP REFER message. ### send_sms Use [send_sms](./send_sms.mdx) to send an SMS to a phone number. ### send_digits Use [send_digits](./send_digits.mdx) to send digits as DTMF tones.